Let’s say I have a switch that causes something random to happen when pulled, but that action would only happen once, and once only. Essentially, it’s removed from the list of possible actions to happen after it’s triggered.
It’s an exception. That sounds like a good reason to use an Instead rule.
[code]The Cavern is a room. “A cavernous cavern.”
Some rocks are a thing. “Huge rocks lie here.”
The suspicious lever is a thing. The initial appearance is “A suspicious-looking lever protrudes from the wall.” It is fixed in place in the cavern. Instead of trying pulling the lever for the first time, have the player trigger a cave-in. Instead of pulling the lever, say “The lever is stuck.”
To have the player trigger a cave-in:
say “You pull the lever. With an ominous rrrrumble, rocks begin to fall, and you leap aside just in time.”;
now the rocks are fixed in place in the cavern.[/code]
As for whether that constitutes a good or clean way of doing it, I’ll defer to more experienced authors. The above works and is, I think, reasonably succinct.
No, emphasis on the word ‘random’. Maybe pulling the lever would cause a cave in, maybe it’d turn off the lights, maybe a whale would materialise out of thin air.
BUT, the same action couldn’t repeat. So only one cave in could be caused, only one whale would be summoned, you get the idea.
Hm, I read this a little differently than Eleas. I was thinking you were looking for a lever that when pulled, triggered a random event from a list of possibilities and then if pulled again, would trigger a different random event. This would continue until all the possible events were triggered (only one time each) and then some sort of default would be triggered.
This scenario made me think of text substitutions, which can execute code in addition to (or instead of) printing text. There are also a variety of different ways to randomize them using the “[one of]” tag (see ch 5.7). Anyway, this is what I came up with:[code]Lab is a room. The lever and a magic ball are in Lab.
North of Lab is a locked door called a red door. South of Lab is a locked door called a blue door.
North of the red door is the Back. South of the blue door is the Front.
After pulling the lever:
if we have pulled the lever more than three times,
continue the action; [<-- goes to the default report rule (“Nothing obvious happens.”)]
otherwise say “[one of][option 1][or][option 2][or][option 3][in random order]”.
To say option 1:
now the red door is unlocked;
now the red door is open;
say “The red door opens.”
To say option 2:
now the blue door is unlocked;
now the blue door is open;
say “The blue door opens.”
To say option 3:
now the magic ball is off-stage;
say “The magic ball dissappears!”
test me with “n / s /pull lever / g / g / g / x magic ball / n / s / s”.[/code]
Unfortunately, no. The I7 compiler doesn’t seem to be able to parse a quote within a bracket no matter what you do (the Mac IDE syntax coloring can’t deal with it either).