Entering and exiting

This is what I get for trying to do something simple and making scenery!

I am trying to have special text when the player enters the electroshock chair. In the following code, the “entering” portion works. But the “exiting” portion will not print the text I’d like:

report entering electroshock:
	say "Despite your anxiety screaming at you, you sit in the electroshock chair.";
	stop the action
	
report exiting when player is in electroshock:
	say "Thank goodness you decided to get out of the electroshock chair.  The anxiety of the moment was killing me.";
	now player is in dispensary;
	stop the action

The message I get when exiting:

You get out of an electroshock chair.

LIke I said, it’s simple but I’ve tried every trick I can think of to make it work but it doesn’t.

Thank you for your help in advance!

1 Like

I haven’t tested this since I have no laptop here, but report rules happen after the action has happened, so you need

report exiting when player was in electroshock:
2 Likes

I’m embarrassed that the solution was that simple but I learned something from this. Thank you!

1 Like

In general, also check out 7.13. Going from, going to

There are rules such as
Before going to the Catalogue Room, say "You emerge back into the Catalogue Room."

This is a good way to write travel narrations that print before the room description.

1 Like

The exiting action has an action variable just for this called the container exited from (matched as “from”). So you can also do this.

report exiting from electroshock:

This would probably be best done as a last carry out rule rather than a before rule, otherwise this will still print even if an instead rule or check rule blocks the action.

1 Like

Good point. Or phrase the text as an actual “before” action - something like “You decide to head [one of][or]back [stopping]into the Catalogue Room.” so if it is blocked by something like “It seems the maid has locked the Catalogue Room door again…” it still makes sense.

1 Like