Action that only applies in one room

total beginner here. This is my first bit of Inform 7 and i’m struggling a bit with documentation.
What i’m trying to do might be a bit non-standard (but it is what i really want to do)…

i want each of many rooms to have a ‘privileged’ action, eg.
‘scream’ in dungeon say…
‘burp’ in dining room say…
‘yawn’ in bedroom say…

the condition is always the room, no objects are involved, it’s not particularly important what happens if you ‘yawn’ in the garden

This is where i got to - as you can see, not very far.

bedroom is a room.
dungeon is a room.

Yawning is an action applying to nothing. Understand “yawn” as yawning.
Carry out yawning:
say… .

i really appreciate any help at all.
Steven

I’m a newbie too, and no doubt there’s a much better way of doing it, but I’d try something like this:

the dungeon is a room.

screaming is an action applying to nothing. Understand “scream” as screaming. [You probably want to add in a few synonyms too].

Carry out screaming:
say “[insert generic response for other rooms here]”

Before screaming:
if the player is in the dungeon:
say “You scream in the dungeon. Then this amazing thing happens …”;
[code in whatever you want to happen when the player screams in the dungeon];
stop the action.

This means you’ll get a standard default response if you try screaming in the other rooms, but if you try screaming in the dungeon something unique will happen.

I don’t know if that’s exactly what you want - just some thoughts. I’m pretty sure that would work.

Will.

Thanks, anything that gets me started is useful

[code]The bedroom is a room.
The dungeon is a room. The dungeon is south of the bedroom.

Yawning is an action applying to nothing. Understand “yawn” as yawning.
Carry out yawning:
say “Yawn…”

Instead of yawning in the dungeon:
say “Yawn…[paragraph break]The sound awakens five hundred zombies!”;
end the story saying “You are eaten by five hundred cranky zombies”.[/code]

So, carry out rules are used for regular actions, and instead (or before) rules are used for unique situations.

But be very careful about designing puzzles about arbitrary actions in arbitrary places. If you don’t give very good implicit hints it will turn into a guess-the-verb puzzle, and no one enjoys those! Furthermore as yawning isn’t a standard action most people won’t think to try it, and it won’t occur to them that anything could happen. Worse than a guess-the-verb puzzle is a guess-the-verb puzzle you don’t know exists.

I’d add a “rule succeeds” to the instead rule, otherwise inform will think your attempt to yawn has failed. This would make conditions like “if the player has yawned” always return false. Also, any “after”-rules would not be consulted.

It is my understanding, though I might be mistaken, that the outcome of the rulebook is irrelevant. An action “succeeds” if it reaches the carry out rulebook, and “fails” otherwise.

Carry out rules won’t be consulted if an instead rule intervenes earlier. Inform consults instead rules right after the before rules and before check rules. Since the default outcome of instead rules is “rule fails”, you have to add a “make no decision” if you want the check, carry out, after and report rules to fire, or a “rule succeeds” if not.

That’s not quite true.

This is only the case for the carry out and report rulebooks as they are “considered”, which means that the rulebook result is ignored. If the outcome for a rulebook were to be irrelevant, then the instead and after rules wouldn’t stop the action, since any rule in these rulebooks have default outcomes of failure and success respectively.

This is in fact the default case due to the fact that the before and check rulebooks have a default make no decision outcome, the instead rulebook has a default outcome of failure, the carry out and report rulebooks are “considered” and the after rulebook has a default outcome of success. Once “rule fails” and “rule succeeds” statements are added, this is no longer true.

You can see this in action here.

[code]“Test”

Instead of thinking:
say “You think!”;
rule succeeds.

The Testing Room is A Room.

Test me with “actions on / think / actions off”.[/code]

Hope this helps.

I see. It does strike me as unwise to violate those semantics, though…

I thought I read somewhere that the distinction between “consider” and “abide by” is likely to be eliminated in future versions of I7. Is my memory doing strange things in my old age?

Robert Rothman

That would be “consider” and “follow”.