Trying to trigger examine in a rule or just say description

Hey.

New to Inform7 (but not programming). Working on a dead simple game just to try it but having an issue
with getting something working.

I have a sign that is either grimy or clean. After cleaning it I’d like to go ahead and either cause examine to occur or basically just say the description so I don’t have to have the user follow up with ‘read sign’. Not having any luck. Any suggestions?

Code below.

The Front Gate is a room. "A Front Gate"  

The Old Sign is a thing in the front gate. "[if grimy]An old sign covered with rust and grime. There does seem to be some writing underneath the grime.[else]An old sign that has enough of it's rust and grime cleaned off to read." The sign is fixed in place.  The sign can be grimy or clean. The sign is grimy.

Instead of examining the old sign:
	say "[if grimy]You really can't read the text under the dirt and rust.[else]The text is readable now. 'Trespassing Forbidden'.".

After rubbing the old sign:
	now the sign is clean;
	say "You take your sleeve and wipe the grime and rust off the sign.";
	say "[the description of sign]";
	rule succeeds.

When doing rub sign the game does not show the description.

rub sign
You take your sleeve and wipe the grime and rust off the sign.

The way that you’ve defined the sign:

The Old Sign is a thing in the front gate. "[if grimy]An old sign covered with rust and grime. There does seem to be some writing underneath the grime.[else]An old sign that has enough of it's rust and grime cleaned off to read." The sign is fixed in place.  The sign can be grimy or clean. The sign is grimy.

uses the “quoted text following initial declaration method.” This creates an initial appearance property for the sign, but not a description property.

See WWI 3.11 Two descriptions of things for details. (WWI is “Writing With Inform,” the built-in documentation.)

1 Like

Thank you!

What @otistdog said, but just flagging that your “Instead of examining the old sign” rule is preempting the regular description from showing when you examine it – I assume that “[if grimy]You really can’t read…” bit is what you want to move over into the description, and then you can delete that rule. And then instead of your “Say [description…]” approach in the after rubbing rule, it might be easier to just say “try examining the old sign”, which might be better practice on the off chance you have some other action rules that might apply.

1 Like

Thank you as well.

That did it.

I didn’t realize the 2 descriptions, and the try keyword was the other part I needed.
I’ve tried reading the documentation but for me personally it’s really hard to work through.

1 Like