Is there a way to make “Instead of doing anything other than” apply to more than one action?
I need something like this to work:
Instead of doing anything other than taking inventory or dropping something:
if the player is dropasked:
say "The robber says, 'Drop your valuables!'";
otherwise:
continue the action.
Of course this is my error message:
Problem. You wrote ‘Instead of doing anything other than taking inventory or dropping something’ , which seems to introduce a rule taking effect only ‘doing anything other than taking inventory or dropping something’. But this is a combination of actions which cannot be mixed
The player may not remember what they are carrying, and I don’t want to force “drop all” to be the only possible command, so I need both actions to be available, but no other actions.
I think I’d group the allowed actions into a new kind of action (cf. 7.15. Kinds of action) and then put that into the rule header:
Taking inventory is allowed behaviour.
Dropping something is allowed behaviour.
Looking is allowed behaviour.
Instead of doing anything other than allowed behaviour:
if the player is dropasked:
say "The robber says, 'Drop your valuables!'";
otherwise:
continue the action.
I included “looking” in the allowed behaviour because otherwise we wouldn’t get a room description, which is generated by an implicit looking action.
For simple cases (no objects mentioned) you can do this:
Instead of doing anything other than looking or taking inventory or dropping:
This works up until you need to specify dropping something, and then you run into the “cannot be mixed” error. Then it’s time for StJohnLimbo’s solution.
(You’d think “dropping” and “dropping something” would be equivalent. Usually they are, but here the compiler isn’t quite smart enough to realize it.)
What if I want to restrict what to player can do with an NPC to examining and asking about something? The same trick:
Asking someone about something is OKaction.
Examining is OKaction.
Instead of doing anything other than OKaction with (or to) the serial killer:
say "That would be unwise.".
yields this message:
Translating the Source - Failed
The application ran your source text through the Inform 7 compiler, as usual, but the compiler unexpectedly failed. This should not happen even if your source text is gibberish, so you may have uncovered a bug in the program, etc, etc.
I couldn’t get ANYTHING to work when I put a specific noun in with this. It’s fine when it’s just “Instead of allowed behavior”, but “allowed behavior to/with something” always throws this error.
Instead of OKaction when the noun is the serial killer.
I use this kind of thing a lot; I call all the actions involving touching something physicality, and then have commands like:
A thing can be distant or not distant. A thing is usually not distant.
Instead of physicality when the noun is distant:
say "[The noun] is too far away.'
I know there’s some way to put a clause on an action description that checks any sort of involvement: noun, second noun, actor. Unfortunately I don’t remember the wording. Maybe it’s “involving”?
If you put something in scope that’s in another location, the touchability rules should already produce generic fob-off messages in this style. But scope can be annoying to fiddle with, so this is a good alternative.
EDIT: Actually, I realise that if the fob-off message is ‘You can’t reach into (distant location)’, I wouldn’t want to read that!