I feel fairly foolish asking this...

HOwever, I am new to Inform 7. I have designed several IF games under ADRIFT, but am having trouble switching (mentally) from that sysem.

Trying to write about a bench that can be sat upon but will turn a message saying you can’t whenever you try. I have tried BEFORE, INSTEAD, etc. Have tried with general types of things, etc. Here’s the butchered code. Anyway, I appreciate the guidance. Am back at this and old.

small bench is in foyer. “A small bench is here.” Understand “small” as bench. Small bench is enterable supporter.

sitting is an action applying to one thing. Understand “sit on [something]” as sitting.

before examining bench:
say “It is the kind of bench that you might sit on to remove your shoes, perhaps after a rainy or snowy day.”;
stop the action.

instead of sitting:
say “We don’t have time for that. Who are you, Mr. Rogers?”;
stop the action. [why doesn’t this work?]

You’ll want the “entering” action.

Instead of entering the small bench: say "We don't have time for that."

The preexisting grammar for the entering action supersedes your new grammar for sitting.

When the player types “sit on bench”, the game tries entering the bench, and your instead rule doesn’t fire. You can use the “actions” debug command to see this.

To solve the issue, you can either go with the flow and write your rule in terms of the entering action:

Foyer is a room.

small bench is in foyer. "A small bench is here." Understand "small" as bench. Small bench is enterable supporter.

before examining bench:
	instead say "It is the kind of bench that you might sit on to remove your shoes, perhaps after a rainy or snowy day."

instead of entering bench:
	say "We don't have time for that. Who are you, Mr. Rogers?"

Test me with "x bench / sit on bench"

or you can disassociate “sit on [something]” from the entering action and associate it with your new sitting action (see §17.3. Overriding existing commands):

Understand the command "sit" as something new.

but you’ll have to define the general behavior of the sitting action (check, carry out, and report rules), and it will be pretty much identical to the entering action, so I wouldn’t recommend this approach.

Many thanks, my friends. The old saying is true, it is hard to teach an old dog new tricks.

Is there a reason you’re interrupting examining with a Before rule to give the description of the bench?

The examining action is designed to give a description when an object is examined.

The description of small bench is "It is the kind of bench that you might sit on to remove your shoes, perhaps after a rainy or snowy day."

And with my small test scenario, “sitting” seems to already be a synonym for entering. You can check the base action in the IDE by typing ACTIONS.

[code]“Bench of Doom”

Park is a room. “A beautiful sunny day in the neighborhood public park. Too bad this is the day you will encounter the bench.”

A small bench is here. [I’m not going to give it an initial description because the default is pretty much what you’ve wrote, and tells if anything is on the bench.] The description is “It is the kind of bench that you might sit on to remove your shoes, perhaps after a rainy or snowy day.”

Check entering bench (this is the Mr Rogers rule):
say “It’s not that kind of beautiful day, and you’re not Mr. Rogers.” instead [instead stops the action]

[naming rules helps with actions and rule tracing]

A discarded newspaper is on bench. The description is “News, Politics, a recipe for flan…boring.”

[/code]

BEFORE is when you want to catch an action to give an effect even before it starts processing CHECK rules - since your first check will override anything else with an INSTEAD, the BEFORE code still runs:

[code]small bench can be wet.
small bench is wet.

Before entering small bench when bench is wet:
say “Hmn. There’s no sign, but the paint on the bench looks extremely glossy almost as if it were wet.”[/code]

To add one thing to Hanon’s extensive examples, you can have “instead” in a Before rule also, to not even consider other rules. That’s useful when you don’t want the game to do any of the pre-action processing at all.

Before [doing something]: [result] instead.

Here’s the type of effect you can achieve using these rules strategically as Draconis points out (the player changes the reason they won’t sit on the bench based on an adjective):

[code]“Bench of Doom”

Park is a room. “A beautiful sunny day in the neighborhood public park. Too bad this is the day you will encounter the bench.”

A small bench is here. It is an enterable supporter. [I’m not going to give it an initial description because the default is pretty much what you’ve wrote, and tells if anything is on the bench.] The description is “It is the kind of bench that you might sit on to remove your shoes, perhaps after a rainy or snowy day.”

Check entering bench (this is the Mr Rogers rule):
say “It’s not that kind of beautiful day, and you’re not Mr. Rogers.” instead [instead stops the action]

small bench can be wet.
small bench is wet.

Instead of doing anything except examining to a wet thing (this is the don’t ruin your clothes rule):
say “Hmn. There’s no sign, but the paint on [the noun] looks extremely glossy almost as if it were wet.”

[naming rules helps with actions and rule tracing]

A discarded newspaper is on bench. The description is “News, Politics, a recipe for flan…boring.”

Volume 1 - Test Code - not for release

Instead of jumping (this is the test wet and dry rule):
repeat with foo running through wet things:
now foo is not wet;
say “(debug - made [the foo] dry).”[/code]