Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to trigger a rule on entering a room in inform7

Tags:

inform7

I'm trying to trigger the end of the game if the player enters a room with an object (their phone) "charged".

I must just not understand the syntax for triggering a rule on entering a location, as I realized that my other similar rules are also not occurring.

I have:

Instead of entering Great Hall:
    if phone is charged:
         say "Hooray you win.";

but rules like:

Instead of entering Big house:
    If butler is in big house:
         say "'blah blah blah";
         now player is in big house;
    otherwise:
         say "Oh no, can't get into the house.";

Also are not working. I read section 9.4 on ending play, have replaced my instead with after and before as well, with no luck. How do I do something after a player enters a room under conditions?

Thank you!

like image 566
singmotor Avatar asked Mar 17 '23 08:03

singmotor


1 Answers

The entering action is triggered when entering things like containers, supporters and doors. For rooms you'll want "going to".

After going to the Great Hall when the phone is charged:
    end the story saying "Hooray you win."

It's also better, instead of moving the player manually, to let the library handle transitioning between rooms whenever possible which is what continue the action does here:

Instead of going to the Big House:
    If the butler is in the Big House:
         say "'blah blah blah'";
         continue the action;
    otherwise:
         say "Oh no, can't get into the house."
like image 127
JJJ Avatar answered Jun 04 '23 09:06

JJJ