I don’t know if it’s the weather (it’s over 100 degrees where I am) or if I’m just fatigued on a Sunday evening, but I can’t figure out why this code isn’t working. It compiles. All I want to do ti, when a button is pressed, is to have a different response than “you switch [the button] off”:
instead of pressing kirk button when kirk button is on:
if platform1desc is 50:
now platform1desc is 0;
say "There is a hissing, hydraulic noise as platform one drops from its height of fifty feet until it is even with your platform.";
otherwise:
increase platform1desc by 10;
say "There is a hissing, hydraulic noise as platform one raises.";
say "You press the button but nothing happens."
But, instead, I get the generic response:
You switch the button off.
I’m guessing that I am either not seeing something obvious or it has to do with some of the rules in the rule books. The player does not need to know whether the button is switched off or not.
Is pressing a new action you’ve defined somewhere, and is “(device) is on” syntax you’ve likewise told Inform about? By default, Inform devices activate and de-activate using the switch on/switch off actions, and they are either switched on or switched off. So that might be the issue you’re running into? Rewriting the rule using the standard syntax, this seems to work (though I’m not sure whether you meant to have that final say statement fire every time, in addition to the other ones? It seems kind of confusing to me):
instead of switching on kirk button when kirk button is switched on:
if platform1desc is 50:
now platform1desc is 0;
say "There is a hissing, hydraulic noise as platform one drops from its height of fifty feet until it is even with your platform.";
otherwise:
increase platform1desc by 10;
say "There is a hissing, hydraulic noise as platform one raises.";
say "You press the button but nothing happens."