Here’s an abstraction of the game I’m working on:
"Towel" by Philip Riley
The lab is a room. The monster's den is east of the lab.
Definition: a room is dangerous if the ravenous bugblatter beast of traal is in it.
Definition: a room is safe if it is not dangerous.
The ravenous bugblatter beast of traal is an animal. It is in the monster's den.
The towel is a wearable thing. The player is carrying the towel;
Before going from a safe room to a dangerous room:
if the towel is touchable:
try wearing the towel;
if the player does not wear the towel:
say "You can't go in there without a towel!";
stop the action;
Check wearing the towel when the location is safe:
[Check wearing the towel when the location is safe and the room gone to is safe:]
say "There's no point in wearing the towel in a safe place like this!";
stop the action;
Running the code as is yields:
lab
> e
There’s no point in wearing the towel in a safe place like this!
You can’t go in there without a towel!
But reversing which line is commented yields:
> wear towel
Variable unavailable for this action, activity or rulebook: internal ID number 20007/1
You put on the towel.
Neither of these is unexpected. My question is how to get around it, while retaining the functionality. I could change the before to an after, but in the particular case in my game, it’s not acceptable to put on the towel after you’ve already seen the ravenous bugblatter beast of traal. Is there a way to check if a variable is available or not? By looking at MStack.i6t I can kind of see a way to check if a variable is available, but I really feel I’m way off track here.