Define a general rule related to the use of a noun (not a verb!) in inform 7

Hi there,

I’m trying to have a rule applied as soon as a noun is used by the user, whatever the verb implied. I tried:

“Check when noun is tree : now…”

But check needs a specific verb. The documentation seems to say it’s not allowed (12.9. Check, carry out, report) but I must be looking at the wrong place to achieve this.

Many thanks for your help!

1 Like

Inform is all verb-led. We can verb, and we can verb nouns, but we can’t start with a noun, at least not programatically.

There are a few ways to get at what you want. Have a look at §7.9. “All actions and exceptional actions”.

You can write Before and Instead rules that specify some or all verbs (‘doing anything’) in combination with nouns. One example given there –

Instead of doing something other than examining, taking or dropping with the dagger: say "Don't fool around with that dagger. It's exceedingly sharp."

is illustrative of a way to let a few actions through on a particular noun, but reject all other verbs with one response.

-Wade

3 Likes

You can set which actions (verbs) can be performed on a noun, effectively allowing you to make rules which apply whenever the player refers to it.

A rule which fires whenever the player tries to do anything to the tree:

Instead of doing something to the tree:
	say "The tree is mockingly hypothetical, reacting to it is ontologically futile. Plus, you don't want to give it the satisfaction."

The player will get this response any time they enter a valid command involving the tree, so long as it is visible. This is possible because of the description doing something to ...
doing something matches any action, while doing something to X matches any action with X as the noun.

You can also allow only certain actions on a noun.

Instead of doing something other than examining or taking with the tree:
	say "The tree is...".

This allows regular action processing for the examining and taking actions to take place, while blocking all other actions on the tree.
Note the with in other than examining or taking with the tree
This is like the to in doing something to the tree - it indicates the noun these restrictions apply to.
Without it, you will be allowing only two actions in your game - examining, and taking the tree.

[WI_7.9]

The reason you can’t do this in a Check rule is because Check rules (along with Cary Out and Report) are action specific. There’s one of each of those rulebooks per action. doing something is not a specific action, it’s any action, so it can’t fit in one of those rulebooks.
Before, Instead, and After rules are about actions in general. There’s just one of each for the whole game. doing something fits here, because it’s a description of actions in general.

EDIT: Ninjaed by @severedhand. The “people are typing” thingy is even accessible with a screen reader, I forget this.

4 Likes

I usually assume the other person will do a more thorough job, and considered stopping typing :slight_smile:

-Wdae

3 Likes

I’m glad you typed, it was a good summary. :slight_smile:

1 Like

I think this is the important bit to understand. Knowing this is useful for multiple reasons.

2 Likes

Thank you all for your very useful answers. I solved my problem with you help and will check the related docs to really grasp the concepts behind those Rulebooks.