Print a message once

theeocene
26 Mar 2011, 08:15
Hi,

This might be a stupid question, but if I want a message to be printed upon entering a room for the first time only, but afterwards the normal room description, how do I go about it?

Alex
26 Mar 2011, 08:32
You can make use of the fact that when you've entered a room, the property called "visible" is set. So, when entering a room, if the room doesn't have a "visible" property, then it's the first time the player has entered the room.

If your room is called "kitchen" and you want to print a message the first time the player enters it, go to the Advanced tab and edit the "When the player enters the room" script. Click the "Add Conditional" button [+if], and select the condition "An object (or room) has a property".

Choose "kitchen" from the "object or room" list, and then choose "visited" from the "property" list. Finally, tick the NOT checkbox on the left, as we only want to do something if this property has not been set yet.

Now in the "Then" box you can print your message, or whatever you'd like to happen when the player first enters the room.

The final script should look like:


If "kitchen" does not have the property "visited" Then Print "This is the first time you've entered the kitchen!"


theeocene
26 Mar 2011, 12:12
Thanks very much - I'm very new to this program! :oops: