Conditional Code Not Working [SOLVED]

My conditional code

If the drawer is unexamined:
	Instead of searching the mirror:
	say "You should probably check the nightstand first. Maybe you could find something useful there."

My drawer code

A drawer is a kind of container. A drawer is always openable and closed. The nightstand drawer is a drawer. The nightstand drawer is part of the nightstand. A drawer can be explored or unexplored. A drawer is usually unexplored. Inside the nightstand drawer is a dagger and a paper.

No variations are working with this.
Can someone get me the correct code? I’ve been trying for a solid 10 minutes, and looking through the Documentation to no avail.

Instead of searching the mirror when the nightstand drawer is unexamined:
1 Like

Many thanks :slight_smile:

The major issue you’re running into here is that a rule preamble – that first line that ends in a colon – can’t be a bare condition, since Inform uses that preamble to figure out when to fire that rule. Typically, the way to do this is to tell Inform what actions should trigger it (you can also just use the preamble to name a rule, then insert it into an existing rulebook, but that’s more advanced and unnecessary in this case).

You also need to say which drawer you mean, since drawer is a kind, not a specific object.

So something like this should work:

Instead of searching the mirror when we have not examined the nightstand drawer, say “You should probably check the nightstand first. Maybe you could find something useful there.”

(I just used the built-in “we have not examined” phrase, but I see you defined a custom explored/unexplored property, which could work too so long as some code tells the game when the drawer should flip over into being explored).

EDIT:

when the nightstand drawer is unexamined

I don’t think that works as a condition out of the box, right?

2 Likes

The point being that the rule has to start with Instead of <....ing> rather than If...

You could also write

Instead of searching the mirror:
	If the nightstand drawer is unexplored:
		say "You should probably check the nightstand first. Maybe you could find something useful there."
2 Likes