Note:
In Quest, everything is an object, even rooms. To try to avoid confusion, I will use "item" to refer to things the player can manipulate, "room" to refer to rooms (obviously) and "object" to refer to everything, including the game and the player!Often you want the description of an object to change, depending on what the player has done. Perhaps she has blown a hole in the wall, and the room description needs to reflect that. Perhaps she has turning on the bizarre machine, and the item description needs to mention that.
Step 1First you need a Boolean attribute, also called a flag, which will be used to remember the state of the room or item. Attributes are attached to objects, and it does not matter what object you pick. It could be the game object, it could be the player object, it could be some other object. Generally, it is easiest to set an attribute on the object in question (the room or item). Whatever you choose, the procedure is more or less the same.
Go to the Attributes tab of the object, and look at the lower section, also called Attributes. Click on Add, and type a suitable name. If this is a room or item, "flag" is probably good enough, if this is the game or player object, choose something more descriptive so you know what it is for in three months time.
Right at the bottom, click on the button that says "String", and set it to "Boolean" instead.
A Boolean, by the way, is an attribute that is either True or False.
Step 2For now, I am assuming we have a Boolean flag called "flag", on the object itself.
Go to the description for the item (on the Setup tab) or room (Room tab). If you have already typed something there, copy-and-paste it somewhere first. Click on "Text", and select instead "Run script".
Click the "Add new script" button, and select "If...", and then click the "Add" button. A box with lots of stuff will appear within the object description area, with "If: expression" at the top. In the text box to the right of that type "this.flag" (no quotes).
Click "Add new script", select "Print a message", and in the new text box type in the description the player should see after the flag has been set.
Click "Add Else", then click the new "Add new script" button, and select "Print a message" again. In the new text box type in the description the player shoud see before the flag has been set.
It should look like this:
So what does it mean?
The expression is what Quest will use to decide what to do. Quest has a special word, "this", that refers to the current object (the object that the script belongs to), in this case your room or object. It does not matter what you called the object, "this" will refer to it. The dot indicates that what follows will be an attribute, and "flag" is just the name of the attribute we set up in step 1.
So if the flag is set to True, the top section of the box is done, and if it is set to False, the bottom section (the "Else" section) is done. And all each section does is print a message.
While we are here, look just under "Run script", and click on the seventh icon, "Code view". You will see this:
if (this.flag) {
msg ("A big room, with wood-panelled walls. There is a large hole in the west wall, where the wood is blackeden.")
}
else {
msg ("A big room, with wood-panelled walls.")
}
It is exactly same set of instructions, just displayed differently. If the flag is True do the first bit, if it is False, do the other bit. It is useful to get familiar withy this code view, as it is much easier to use on the forums.
Step 3The final set is to have something trigger the change. You are kind of on your own here as there are so many ways this might happen, but I will go through an example.
Let us suppose breaking a teapot causes something to explode in a room called "room". On the Verb tab of the teapot, "Add" a new verb, and change "Print a message" to "Run a script". From the "Add new script" menu, select "Set object flag", set the object to be the room (because that is trhe object with the flag attribute), and the flag name to "flag". You will probably want to print a message too.
For reference, the code view looks like this:
SetObjectFlagOn (room, "flag")
msg ("As the teapot breaks, the chamberpot suddenly explodes in a suicidal act of sympathy.")
And if I was typing it in,I would write this:
room.flag = true
msg ("As the teapot breaks, the chamberpot suddenly explodes in a suicidal act of sympathy.")
It is all the same, the first line is setting the flag to have a have of true.