Instead of doing anything other than X or Y

Hey All–

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.

8 Likes

Thanks! My other solution was a tangled mess of conditions and ifs that is really ugly, and naturally there is a simple and easy solution.

2 Likes

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.)

7 Likes

OK, follow-up question:

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.

Any way around this?

I’d build the specific noun into the collection of allowed behaviour:

Examining the serial killer is OKaction.
[etc.]

Instead of doing anything other than OKaction:
[...]
1 Like

I usually use:

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.'
2 Likes

ah, never mind.

1 Like

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”?

1 Like

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!

-Wade

1 Like

Your choice of

Instead of doing something other than okaction when the noun is the serial killer

or, if you want to cover the serial killer being any of the actor, noun, or second noun:

Instead of doing something other than okaction when the current action involves the serial killer
1 Like

dang it, was so close to getting this phrased correctly.

1 Like