Inform6: Testing if object (e.g. player) is on a supporter

Hello hello! I’ve been working through the IBG and DM4 and slowly building my test rooms. I’m trying to build a control panel that can only be switched on when the player sits in the chair. Here’s was I have:

Object      Comm_Station "Communication's Station"
    has     light
    with    description "A room filled with many complicated consoles,
                positively writhing with tantalizing buttons. A large
                display screen broodingly occupies the wall facing the
                main computer terminal.",
                time_left,
                time_out [;
                    "A console light flickers.^";
                ]
                ;

Object -> control_console "control console"
    has switchable scenery,
    with name "control" "console",
    description [;
        if (self has on){
            "The now open control console shows a blinking button.";
            ! TODO: Implment more descriptions
        } else {
            "A dazzinglingly complex control console, you wouldn't 
            even know where to begin...";
            ! "The control console appears lively but is unresponsive 
            ! to your attempts to woo it."
        }
    ],
    before [;
        SwitchOff:
            if (self hasnt on) "Complex as the control console is, 
                you get the impression that it's already as off as 
                it will ever be.";
            else "Against all reasonableness, the console does not
                seem to want to turn off while you are sitting
                in the console chair.";
        SwitchOn:
            if (self has on) "The control console is on display,
                on point, on task, and online. On the other hand,
                you can't add any more to it's already fulfilled
                state of ~on-ness~.";
            else {
                if (sender == console_chair){
                    "Responding to some unseen signal, the console 
                    splits down the middle revealing a more
                    understandable set of controls.";
                } else {
                    "Despite your technical savvy, you don't see
                    any clear way to turn on the console.";
                }
            }
    ]
    ;


Object -> console_chair "console chair"
    has     static enterable supporter,
    with    name "chair", 
            initial "An operator's chair, bolted into place in front of the main
                    console, turns invitingly in your direction, making
                    a faint mechnical grinding noise.",
            description "A carefully-designed ergonomic chair. The seat's upholstery
                        ripples, in an unsettlingly way, as if it is eagerly
                        awaiting an opportunity to conform to your posterior.",
            before [;
                Take: 
                    "The chair is firmly bolted to the floor: a good thing,
                    too, as your outfit is newly tailored.";    
            ],
            after [;
                Enter:
                    print "Immediately upon contact, the upholstery starts to undulate. 
                    It moves rapidly from one form to another, in an intricate dance with 
                    the countours of your body. It finally settles and, now still, you 
                    realize you can barely feel the chair at all.^^";

                    <<SwitchOn control_console>>; ! <- right here
            ]
    ;

You can see at the “right here” line that I’m sending the SwitchOn message to the control_console but it gives the same response as if the player did it directly (because the sender is always the player).
So I have 2 questions.

  1. How can I send a message to one object and choose what the value of “sender” will be?
  2. How can I check if the player is “on” a supporter?

Thank you!

Don’t use action syntax for that sort of thing, instead call a property on the object directly:

control_console.activate();

(This also means that you probably don’t need to check the sender, unless there’s multiple things that can activate it and you want different behaviour – although you could just call different properties for each case too.)

The simplest way to check if a player is on a supporter is the same as if they’re in a room or container – check their immediate parent:

if (parent(player) == console_chair) ...
1 Like

All of this, thank you!