How would you set up a machine with a lever that can be set to several different settings, which trigger different effects? There are examples in the manual for switching devices on and off, but I’m having trouble creating new settings and then being able to refer to them.
The action you want is “setting it to”.
Instead of setting the machine to "xyzzy"...
Thanks for that, but how do I refer to the settings? For example, fast, medium, and slow. Is it possible to say something like “The lever is currently set to [lever setting]” in the description of the lever, or to use “if the lever setting is slow” as a condition?
[code]The lever can be xyzzy, plugh, frotz, or deactive.
The lever is deactive.
After setting the lever to xyzzy:
The compiler didn’t like “setting the lever to xyzzy.”
Ok, here’s what I’ve got now. If there’s a better way to do it, I’d be interested to hear it. This seems to work except for the last two Instead rules.
[code]Control Room is a room.
A machine is a thing in the Control Room. “There is a machine here with an enormous lever.”.
A lever is part of the machine.
Setting is a kind of value. The settings are fast, medium, and slow.
The lever has a setting. The description of the lever is “The lever can be set to fast, medium, or slow. At the moment it’s set to [setting of the lever].”.
Instead of setting the lever to “fast”:
Now the setting of the lever is fast;
Say “You set the lever to fast.”;
Instead of setting the lever to “medium”:
Say “You set the lever to medium.”;
Now the setting of the lever is medium.
Instead of setting the lever to “slow”:
Say “You set the lever to slow.”;
Now the setting of the lever is slow.
[These don’t compile.]
Instead of setting the lever to something when the second noun is not a setting:
Say “That’s not a valid setting. You can only set the lever to fast, medium, or slow.”
Instead of setting the lever to the setting of the lever:
Say “That’s not necessary. The lever is already set to [setting of the lever].”.
If you want to do it that way, you can define a new kind of value.
A lever setting is a kind of value. The lever settings are fast, medium, and slow. The complicated machine has a lever setting. The description of the complicated machine is "It is currently set to '[lever setting]'." Instead of setting the complicated machine to a topic: if the topic understood matches "[lever setting]": now the lever setting of the complicated machine is the lever setting understood; else: say "You don't see a marking for '[topic understood]' on the dial."
The setting it to action takes a topic (literal text from the player’s command) as its second argument, so if you want to compare it to some other kind of value you need to use the topic-matching tools.
That works great! Thanks, all!