Script that has worked before with similar actions not working in this example

I have used the format below many times but this time I am getting the error message: “In the sentence 'if first noun is not strap” i was expecting to read a condition, but instead found some text that I couldn’t understand – “first noun is not strap”

cutting with is an action applying to two things.  understand "cut [something] with [something]" as cutting with.

strap is a undescribed thing in Conan_Room.  it is fixed in place.

understand "straps" as strap.

before cutting with:
	if first noun is not strap:
		say "I don't know what you want me to cut." instead;
	if second noun is not potteryshard:
		say "I don't know what you want to cut with." instead.

carry out cutting with:
	Say "You deftly pinch the pottery shard between the fingers of your right hand and saw away at the strap.  Eventually, the strap breaks!  You then quickly untie the left strap and then sit up and undo your ankle straps.";
	increase score by 1;
	now playerX is 1;
	change the northeast exit of the Conan_Room to Night_Gallery;
	say "A shimmering portal has opened up to the northeast.  You can the Night Gallery through it.".

You don’t need to say “first noun”

Instead, just say “if the noun”

1 Like

Thank you. Now the second noun is not working. I’m very puzzled because I have used this format multiple times in the game. If I cut with the pottery shard or shard or even pottery shard it gives the response “I don’t know what you want me to cut with.”

cutting with is an action applying to two things.  understand "cut [something] with [something]" as cutting with.

strap is a undescribed thing in Conan_Room.  it is fixed in place.

understand "straps" as strap.

before cutting with:
	if noun is not strap:
		say "I don't know what you want me to cut." instead;
	if second noun is not potteryshard:
		say "I don't know what you want to cut with." instead;
	otherwise:
		continue the action.

carry out cutting with:
	Say "You deftly pinch the pottery shard between the fingers of your right hand and saw away at the strap.  Eventually, the strap breaks!  You then quickly untie the left strap and then sit up and undo your ankle straps.";
	increase score by 1;
	now playerX is 1;
	change the northeast exit of the Conan_Room to Night_Gallery;
	say "A shimmering portal has opened up to the northeast.  You can the Night Gallery through it.".

You need to define the action not as “cutting with”, but as “cutting it with”. That “it” allows inform to understand where the nouns go when you’re writing rules about the action so it’s critical to include in actions with two nouns (contrariwise, if you write an action applying to one object things will get weird if you put an “it” in the action name).

The docs don’t really explain this as far as I recall, you just need to figure it out from looking at the examples - I ran into the issue a lot when I was starting with Inform!

1 Like

And just to add to the confusion, in your Before, Instead, Check etc. rules you need to use a different placeholder: ‘it’ won’t work.

So not

Instead of brushing it with:

but

Instead of brushing something with:

or

Instead of brushing something with the broom:

or

Instead of brushing the front step with something:

or just plain:

Instead of brushing:

etc.

Note that

Instead of brushing something:

will be rejected.

EDIT: the above is not quite correct/complete. The 7 accepted action patterns for ‘brushing it with’ are:

brushing [all these first 3 are equivalent variations with both parameters unspecified¹]
brushing with
brushing it with [this is the only pattern allowed to use ‘it’ and restates precisely the action definition²]
brushing something with [2nd parameter unspecified]
brushing with something [1st parameter unspecified]
brushing something with something [both parameters specified]

¹ although the first three patterns may appear redundant, they may be useful for distinguishing the intended action from others whose name begins with ‘brushing’ or ‘brushing with’
² as flagged by @Zed currently (Ver 10.1.2 and previous) this pattern (bizarrely) only compiles in the specific (Check, Carry out and Report) action rulebooks and not in Before, Instead, After. Or, indeed, in conditions- so ‘Every turn when the current action is brushing it with: do nothing.’ won’t currently compile.

NB ‘something’ in an action pattern only matches things- ‘an object’, ‘a number’, ‘a topic’ etc. allow you to match with other elements of the Inform world.

Leaving a parameter unspecified imposes no restrictions on matching. So 'brushing' is not quite the same as 'brushing something with something' as the former will match ‘brushing the kitchen with the broom’ whereas the latter will not (because the kitchen is (presumably) not a thing, but a room).

NB2 if there are other words between the initial verb word and the first token in your action definition, declaring it as ‘abbreviable’ allows you to truncate or omit (all of) them in action patterns which don’t include anything beyond those words. e.g.

Writing on the back of it with is an action applying to two things and requiring light and abbreviable

allows you to then write:

Instead of writing:
Instead of writing on:
Instead of writing on the back:

(but not)

Instead of writing on something

This option (abbreviable) is used in the Standard Rules (solely) for the Listening to action so one can write

Instead of listening:

as well as

Instead of listening to:

NB3

Beware: if there is another action simply called writing then

Instead of writing:

will apply only to that and this rule will never fire for your abbreviated writing on the back of it action

5 Likes

Thank you for all of your, help, I greatly appreciate it.

Blink and you’ll miss it, but it is (just barely) mentioned in WI 12.7

2 Likes