<NME> using_attributes.md
<BEF> ---
layout: index
title: More on Attributes
---


Most things in Quest are objects. In fact there are five types of objects. Rooms, objects and player objects are objects of the object type. Commands and verbs are objects of the command type. Exits are objects of the exit type. Turnscripts are objects of the turnscript type (timers are not objects by the way). The game object is an object of the game type.

You can use the `GetObject` function to get any of these, and all will register as an object with the `TypeOf` command.

So what makes a turnscript different to a room or the player? The answer is: attributes.

Attributes are values that are attached to an object. All objects have a "name" attribute that is unique to them. All objects have an "elementtype" attribute that is equal to "object". All objects have a "type" attribute equal to the type of the object ("object", "command", "exit", "turnscript" or "game"). Quest uses these to track what things are, and they cannot be changed during play, and indeed only the "name" attribute can be changed in the editor.

By the way, it is also worth mentioning that you cannot give anything an attribute with any of these five names.

All other attributes you can add, modify or remove as you like, both with the editor and during play, and this is what makes your game world.


Built-in Attributes
-------------------

Lots of things in Quest have built-in attributes; these are the attributes you can set on the various tabs for an object (or whatever). You can access more of them using the _Features_ tab. However, this page is more about custom attributes...


Setting Up Custom Attributes
---------------------

On the desktop version you can set up attributes on the _Attributes_ tab. The lower half lists all the attributes for this object, those in grey are what it has inherited from its types (which are listed in the upper half). To add a new attribute, click "Add", give it a name, select a type (it defaults to string), and then give it a starting value.

The web version does not support an _Attributes_ tab, so you need to do it differently. Go to the _Features_ tab, and tick "Run an initialisation script for this object", and then go to the _Initialisation script_ tab. Here we can set attributes in a script. Obviously you can do that using the GUI, but it is easier to show using code, and the code is trivial, so that is how I will show it here. In this example, two attributes are set:

```
this.colour = "red"
this.size = 15
```

Each line starts with `this`, which is a special value meaning the object the script is attached to - this object. The dot says we want something attached to the object, and the next bit is the name of attribute (like objects, these can only contain numbers, letters, spaces and underscores, and must start with a letter). Then there is an equals, followed by the value. Note that _red_ is a string, so needs to start and end with double quotes. The 15 is a number, so no quotes required.


Status Attributes
-----------------

[Status attributes](status_attributes.html) are just attributes that you tell Quest to display - there is nothing special about the attribute itself. 


Change Scripts
--------------

A [change script](change_scripts) is a special attribute, a script that will fire whenever another attribute changes. From the example above, we want to update `player.ammonote`, whenever `player.ammo` changes (and `player.ammomax` too).




Attribute names to avoid
------------------------

Quest uses "name", "type" and "elementtype" to track what things are, and will not allow you to change them during a game; only "name" can be changed in the editor.

There are several [important attributes](important_attributes.html) that already have a meaning in Quest, and you are probably best avoiding them to avoid confusion.

Do not use the following as names for attributes: **command, delegate, dynamictemplate, exit, function, game, include, object, template, timer, turnscript, type, verb**. It may appear at first that these are okay, but when you save the game (whether during play or when editing), the attribute will be converted to an XML element with the same name. When the game is re-loaded, Quest will assume these refer to something else entire, an actual command, or whatever.

For lists and dictionaries, attribute names cannot include spaces. Again, Quest will not complain when you do it, but it will when it tries to save your game (and you might have added a shed of load of data by then). If using the web version this might only become apparent when the player tries to save the game.

<MSG> [docs] Updates to docs

<DFF> @@ -12,7 +12,7 @@ So what makes a turnscript different to a room or the player? The answer is: att
 
 Attributes are values that are attached to an object. All objects have a "name" attribute that is unique to them. All objects have an "elementtype" attribute that is equal to "object". All objects have a "type" attribute equal to the type of the object ("object", "command", "exit", "turnscript" or "game"). Quest uses these to track what things are, and they cannot be changed during play, and indeed only the "name" attribute can be changed in the editor.
 
-By the way, it is also worth mentioning that you cannot give anything an attribute with any of these five names.
+By the way, it is also worth mentioning that you cannot give anything an attribute with any of these five names: "object", "command", "turnscript", "game", "exit", "type", "elementtype", "finish".
 
 All other attributes you can add, modify or remove as you like, both with the editor and during play, and this is what makes your game world.
 

{'commit': 'diff --git a/docs/advanced_scope.md b/docs/advanced_scope.md\nindex 4c584e60..2a599934 100644\n--- a/docs/advanced_scope.md\n+++ b/docs/advanced_scope.md\n@@ -108,7 +108,7 @@ You can combine scopes, so "contents;storeroom" would collect any object that th\n \r\n For commands with multiple objects, you can specify by each object. You can see the format in this example:\r\n \r\n-> object1=contents;storeroom|object2=room\r\n+> object1=contents;storeroom\\|object2=room\r\n \r\n In this example, Quest will look for object1 in containers or the storeroom location, and for object2 in the current location.\r\n \r\ndiff --git a/docs/ask_about.md b/docs/ask_about.md\nindex 882d57dc..519b7bc8 100644\n--- a/docs/ask_about.md\n+++ b/docs/ask_about.md\n@@ -1,6 +1,6 @@\n ---\n layout: index\n-title: Handling ask ... about\n+title: Handling ASK/TELL\n ---\n \n Interactive fiction has broadly three ways for the player to talk to NPCs.\n@@ -11,22 +11,23 @@ Interactive fiction has broadly three ways for the player to talk to NPCs.\n \n > ASK ... ABOUT ...\n \n-This page is about using ask ... about.\n-\n This is something built in to Quest, but it does need to be turned on. On the _Features_ tab of the game object, tick the "Ask/Tell" box. You should now find there is an _Ask/Tell_ tab for the objects in your game.\n \n-I am just going to focus on ASK on this page, but you will see there is also the capability to do TELL too. It works just the same, so everything here can also be applied to TELL.\n+This page is about using ASK/ABOUT. This also includes TELL/ABOUT and TELL/TO, both of which are on the same tab, and work in exactly the same way, so everything here can also be applied to TELL/ABOUT and TELL/TO. For simplicity, we will go though just ASK/ABOUT.\n+\n \n-Ask ... about\n+Ask ... about ...\n -------------\n \n The way ASK works is that you give a list of topics and corresponding scripts. Suppose we have a character, Mary, and we want to ask her about the murder of Dr Black. In the ASK section, click _Add_, and then type in the topic, "dr black". Click _Okay_, and then add the script that will run when the player asks about Dr Black. For now, just have it print a simple message.\n \n Now go in game, and type ASK MARY ABOUT DR BLACK, and you should see your message. Quest will do its best to match topics, so you should also see the message if you type ASK MARY ABOUT DR or ASK MARY ABOUT BLACK. Ah, but what if the player types ASK MARY ABOUT DOCTOR BLACK? Go back to the _Ask/Tell_ tab for Mary, make sure this topic is selected and click on "Edit Key". Replace "dr black" with "dr doctor black".\n \n+![](images/Asktell3.png "Asktell.png")\n+\n What Quest does is attempt to match the topic against each word in the topic\'s key, rather than exactly matching the whole thing, so you can put a list of keywords here, separated by spaces.\n \n-Obviously you can change the script that runs by selecting the topic and clicking "Edit Script". However, I am not going to worry about that in this tutorial.\n+Obviously you can change the script that runs by selecting the topic and clicking "Edit Script"...\n \n \n More advanced...\n@@ -37,14 +38,66 @@ We can make this system more sophisticated in a number of ways. However, we will\n For more on how to copy-and-paste code, see [here](copy_and_paste_code.html).\n \n \n+\n+Varying the response\n+--------------------\n+\n+Currently Mary will give the same response every time the player asks her about the murder.\n+\n+```\n+msg ("\'What do you know about the murder of Dr. Black?\'")\n+msg ("\'Me? Nothing!\'")\n+```\n+\n+It will be better if she varies it a bit. In this simple example we set a flag, "askedaboutmurder" on the character the first time she is asked. We can then test that flag using `GetBoolean` (which returns false if the attribute does not exist, so saves us having to set it to false from the start).\n+\n+```\n+if (not GetBoolean(this, "askedaboutmurder")) {\n+  msg ("\'What do you know about the murder of Dr. Black?\'")\n+  msg ("\'Me? Nothing!\'")\n+  this.askedaboutmurder = true\n+}\n+else {\n+  msg ("\'Tell me what do you know about the murder!\'")\n+  msg ("\'I told you - nothing!\'")\n+}\n+```\n+\n+We might also want to have it change depending on the player\'s progress through the game.\n+\n+```\n+if (Got(lab report)) {\n+  msg ("\'What do you know about the murder of Dr. Black?\' you say, showing Mary the lab report.")\n+  msg ("\'Oh, God! Okay, yes, it was me. But he had it coming to him!\'")\n+}\n+else if (Got(poison bottle)) {\n+  msg ("\'What do you know about the murder of Dr. Black?\' you say, showing Mary the poison bottle.")\n+  msg ("\'Nothing! That\'s not mine! You can\'t prove anything!\'")\n+}\n+else if (not GetBoolean(this, "askedaboutmurder")) {\n+  msg ("\'What do you know about the murder of Dr. Black?\'")\n+  msg ("\'Me? Nothing!\'")\n+  this.askedaboutmurder = true\n+}\n+else {\n+  msg ("\'Tell me what do you know about the murder!\'")\n+  msg ("\'I told you - nothing!\'")\n+}\n+```\n+\n+This does have the potential to become complex, but that is the nature of the beast. The more complex, the more natural it will seem to the player. It will need thorough testing, however!\n+\n+\n Default replies\n ---------------\n \n Underneath the list of ASK topics, you can put a script to run when there is no topic for this character. Perhaps for Mary we could print a message that says "She looks at you, wondering what you are talking about."\n \n-As of Quest 5.7, you can use a special variable, "text", which will contain the subject the player was asking about. You could have something like this:\n+You can use a special variable, "text", which will contain the subject the player was asking about. You could have something like this:\n \n-    msg("Mary shrugs, and says, \'I know nothing about " + text + ".\'")\n+```\n+msg("Mary shrugs, and says, \'I know nothing about " + text + ".\'")\n+```\n \n \n Topics\n@@ -52,24 +105,29 @@ Topics\n \n It can be frustrating for the player to have to guess what topics are available, so an option is to provide a TOPICS command, which simply lists the topics the player can ask about. The best way to do this is to set up a string with some initial entries, and then to add to it as the game progresses. In the investigation of the murder of Dr Black, new topics could be added as new evidence comes to light, for instance.\n \n-Note that this assumes all NPCs will have the same topics available. I think it likely that the player will assume that if she can ask Mary about Dr Black, she can ask any other character too. This does mean you will need to add all these topics to all the NPCs.\n+Note that this assumes all NPCs will have the same topics available. I think it likely that the player will assume that if she can ask Mary about Dr Black, she can ask any other character too. This does mean you will need to add all these topics to all the NPCs, even if they only say that they know nothing. This should be done anyway!\n \n The first step, then, is to create our string list. If using the off-line editor, go to the _Attributes_ tab of the game object, and create a new attribute called "topics". Set it to be a string list, and add names of any topics that will be available from the start. \n \n If using the on-line editor, you will have to add the attribute in a script. Go to the _Scripts_ tab of the game object, and add this to the start script (this will set "Job" and "Alibi" as topics from the start):\n+\n ```\n game.topics = Split("Job;Alibi", ";")\n ```\n-This will be shown to the player, so capitalise it nicely and bear in mind it needs to fit the ASK ... ABOUT ... format. Also, it makes the script for the topics command easier if there are at least two topics from the start.\n+\n+This will be shown to the player, so capitalise it nicely and bear in mind it needs to fit the ASK ... ABOUT ... format. Also, it makes the script for the topics command easier if there are at least two topics from the start (because we can refer to them in the plural knowing there is at least two).\n \n Now we need to create a new command. Go to _Commands_ in the left pane, then click "Add" in the right pane. For the command pattern, type in "topics", and paste in this code:\n+\n ```\n msg ("Topics you might want to ask about include:")\n foreach (s, game.topics) {\n   msg (s)\n }\n ```\n+\n You can add to the list of topics at any time during the game, as the plot develops. For example:\n+\n ```\n list add(game.topics, "Forensic results")\n ```\n@@ -79,6 +137,7 @@ Ask about ...\n -------------\n \n If there is only one NPC in the room, we can save the player some typing by creating an ASK ABOUT ... command. Go to _Commands_ in the left pane, then click "Add" in the right pane. For the command pattern, type in "ask about #text#", and paste in this code:\n+\n ```\n npcs = NewObjectList()\n opts = NewStringDictionary()\n@@ -104,6 +163,7 @@ else {\n   }\n }\n ```\n+\n What the code does is firstly go through all the objects in the current room (which it gets using `GetDirectChildren(player.parent)`), and collects up all those with an "ask" attribute (this is where Quest stores the topics we set earlier, so this is a good test of whether the object is a character).\n \n Then it looks at how many NPCs it found. If none, an error message; if one, then it calls the same function that the built-in ask/tell system uses, `DoAskTell`, using the one NPC it found.\ndiff --git a/docs/ask_simple_question.md b/docs/ask_simple_question.md\nindex edcfaf81..b708a581 100644\n--- a/docs/ask_simple_question.md\n+++ b/docs/ask_simple_question.md\n@@ -40,6 +40,11 @@ Here is an example, setting up a character called Cindy as a flower seller. This\n \n ![](images/menu1.png "menu1.png")\n \n+In some situations, you might want to vary the list. There are various ways to do that, but the easiest is just to add an `if` to the script. Have the `if` command check if the option should be added (are orchids in stock), and if so, add that option to the list.\n+\n+![](images/menu1a.png "menu1a.png")\n+\n+\n \n Show the menu\n -------------\n@@ -68,6 +73,10 @@ You need to do that for each option. Below you can see it has been done for two,\n \n ![](images/menu4.png "menu4.png")\n \n+If you have variable options (for example, the option to buy orchids is only there if the flower seller has them in stick), that is no problem. You just need to make sure there is a `case` for all of them. You do not need to check the condition again or check that the option was in the list. The player will only be able to make that choice if it was in the list, and it will only be in the list if it is allowed. Below I have added both lilies and orchids, and also move the relevant object to the player. It is starting to get long, so only the lower half of the script is shown:\n+\n+![](images/menu4a.png "menu4a.png")\n+\n \n In code?!?\n ----------\n@@ -79,13 +88,26 @@ options = NewStringList()\n list add (options, "Red roses")\n list add (options, "Lavender")\n list add (options, "Lilies")\n+if (GetBoolean(Cindy, "orchids in stock")) {\n+  list add (options, "Orchids")\n+}\n ShowMenu ("What flowers do you want to buy?", options, true) {\n   switch (result) {\n     case ("Red roses") {\n       msg ("You buy some red roses from Cindy.")\n+      MoveObject (roses, player)\n     }\n     case ("Lavender") {\n       msg ("You buy some lavender from Cindy.")\n+      MoveObject (lavender, player)\n+    }\n+    case ("Lilies") {\n+      msg ("You buy some lilies from Cindy.")\n+      MoveObject (lilies, player)\n+    }\n+    case ("Orchids") {\n+      msg ("You buy some orchidsfrom Cindy.")\n+      MoveObject (orchids, player)\n     }\n   }\n }\ndiff --git a/docs/ask_tell.md b/docs/ask_tell.md\nnew file mode 100644\nindex 00000000..b9c0a307\n--- /dev/null\n+++ b/docs/ask_tell.md\n@@ -0,0 +1,98 @@\n+---\n+layout: index\n+title: Handling ASK/TELL\n+---\n+\n+\n+Ask/Tell\n+--------\n+\n+Finally, the player can specify both the person to talk to and the subject:\n+\n+> ASK BORIS ABOUT KEY\n+\n+> TELL MARY ABOUT LOCK\n+\n+You should also consider whether you want both sides of the conversation in the output. Which you chose is up to you, but it will look better if you are consistent, so I suggest decided now, before you start typing.\n+\n+> \\>TALK TO BORIS\n+>\n+> \'Hi,\' you say to Boris, \'can you help me find the key to this door?\'\n+>\n+> \'Sure, you need to look in the bedroom.\'\n+\n+> \\>TALK TO BORIS\n+>\n+> \'Hi,\' says Boris, \'do you need to find the key to this door? You need to look in the bedroom.\'\n+\n+\n+\n+\n+ASK ABOUT\n+---------\n+\n+In play this might look like this:\n+\n+> \\>ASK BORIS ABOUT KEY\n+>\n+> \'Hi,\' you say to Boris, \'can you help me find the key to this door?\'\n+>\n+> \'Sure, you need to look in the bedroom.\'\n+\n+This is the most open-ended approach, though in reality that flexibility is an illusion - the player is limited to asking about only the topics you have included, he just does not know it. This is also the major downfall of this method - the player might not guess the subjects you have coded for, and just get frustrated as the character fails to respond to guess after guess. This system is probably best suited to when you have a large number of topics you will include for every character in the game, as a menu will soon get unwieldly, and thematically, it feels right for a mystery.\n+\n+Quest has a tab just for Ask/Tell, making it easy to set up each response (but you need to activate in on the Features tab of the game object).\n+\n+![](images/Talk3.png "Talk3.png")\n+\n+For each topic, click on add, then put in the topic name. You can put in several; try to guess what words the player will use. They should be separated by spaces, as shown above. Then you need to put in the script, just as before.\n+\n+You should also put in a script to run for unknown topics.\n+\n+The Quest Ask/About system is discussed in detail [here](ask_about.html)\n+\n+\n+Varying Responses\n+-----------------\n+\n+In all the above examples, the character will respond the same every time. That is not ideal, people are not like that, they will get annoyed if you ask the same question fifteen times, and wonder why you are asking where the key is when you have just used it to open the door.\n+\n+For all the methods above, the important part here is the lines that start "msg". We have gone through the three ways to arrive at them, now we are concentrating on just those lines.\n+\n+If you have a counter in there, then you could have the response depend on how often the topic has been raised (but remember to set up an integer attribute for the counter). Or use a boolean to flag that the topic has been asked (the version below automatically sets the attribute for you).\n+\n+Instead of:\n+\n+        msg ("\'Hi,\' you say to Philippa, \'can you help me find the key to this door?\'")\n+        msg ("\'Sure, you need to look in the bedroom.\'")\n+\n+Try:\n+\n+        if (not GetBoolean (philipa, "key_asked") {\n+          msg ("\'Hi,\' you say to Philippa, \'can you help me find the key to this door?\'")\n+          msg ("\'Sure, you need to look in the bedroom.\'")\n+          philipa.key_asked = true\n+        }\n+        else {\n+          msg ("\'Hi again,\' you say to Philippa, \'can you help me find the key to this door?\'")\n+          msg ("\'Have you tried looking in the bedroom?\'")\n+        }\n+\n+Or it could respond to changes in the world. The code below will make Philippa respond differently if the door is unlocked, or you are carrying the key.\n+\n+        if (not that_door.locked) {\n+          msg ("\'I see you finally managed to unlock the door then,\' said Philippa sarcastically.\'")\n+        }\n+        else if (key.parent = player) {\n+          msg ("\'You found the key then,\' said Philippa sarcastically.\'")\n+        }\n+        else if (not GetBoolean (philippa, "key_asked")) {\n+          msg ("\'Hi,\' you say to Philippa, \'can you help me find the key to this door?\'")\n+          msg ("\'Sure, you need to look in the bedroom.\'")\n+          philippa.key_asked = true\n+        }\n+        else {\n+          msg ("\'Hi again,\' you say to Philippa, \'can you help me find the key to this door?\'")\n+          msg ("\'Have you tried looking in the bedroom yet?\'")\n+        }\n+\ndiff --git a/docs/clones.md b/docs/clones.md\nindex 3b800175..8c0786c1 100644\n--- a/docs/clones.md\n+++ b/docs/clones.md\n@@ -4,9 +4,11 @@ title: Attack of the Clones!\n ---\r\n \r\n \r\n-A clone is an exact copy of a prototype, and can be a useful way to quickly create several of the same things whilst a game is underway. For example, you could create a single orc, and then clone it several times to give the player a hoard to fight against, or you could implement a shop where all the goods for sale get cloned when the player purchases them, so the shop remains stocked.\r\n+A clone is an exact copy of a prototype, and can be a useful way to quickly create several of the same things whilst a game is underway. For example, you could create a single orc, and then clone it several times to give the player a hoard to fight against, or you could [implement a shop](shop.html) where all the goods for sale get cloned when the player purchases them, so the shop remains stocked.\r\n \r\n-Actually clones are not exact copies. Every object in Quest must have a unique name, so each clone will have its own name. This name will be the name of the prototype, with a number appended (orc1, orc2, etc.). To ensure the clone is _apparently_ identical to the player, it is best to use the `CloneObject` function (rather than the `Clone` function), so the clone will be given the name of the prototype as an alias, if none is already set.\r\n+Actually clones are not exact copies. Every object in Quest must have a unique name, so each clone will have its own name. This name will be the name of the prototype, with a number appended (orc1, orc2, etc.). To ensure the clone is _apparently_ identical to the player, it is best to use the `CloneObject` function (rather than the `Clone` function), so the clone will be given the name of the prototype as an alias, if none is already set. It will also (as of Quest 5.7) be given a new attribute "prototype", which points to the prototype.\r\n+\r\n+Note that cloning an object with `CloneObject` will also clone any objects it contains.\r\n \r\n Alternatively, use the `CloneObjectAndMove` function, which uses `CloneObject`, but then moves the clone to the given location, or the `CloneObjectAndMoveHere` function which is similar but moves the clone to the current room.\r\n \r\n@@ -17,17 +19,6 @@ newgoblin = CloneObjectAndMoveHere(goblin)\n newgoblin.look = "This goblin has a wooden leg."\r\n ```\r\n \r\n-\r\n-It can be useful to note what the prototype was when an object was cloned so you can refer to it later. You can set it like this:\r\n-\r\n-\r\n-```\r\n-newgoblin = CloneObjectAndMoveHere(goblin)\r\n-newgoblin.look = "This goblin has a wooden leg."\r\n-newgoblin.prototype = goblin\r\n-```\r\n-\r\n-\r\n Once the player is interacting with a clone, you need to ensure that it is the clone that things happen to. And this is where it gets complicated...\r\n \r\n In the code above, `goblin` is an object that has the name "goblin", and this is the way of all objects in Quest. However, `newgoblin` is quite different; it is a _local variable_, which is a kind of temporary container. The first line above puts the clone into the container, and we can then use it as though it is the real thing, as you see above. That is fine in that script, but as soon as the script ends, the container is gone. The clone still exists; that is now a part of the game world, but we have lost the container called "newgoblin".\r\n@@ -78,7 +69,7 @@ Finding and checking for clones\n \r\n Note that neither of these techniques will flag up the prototype; it is generally best to keep the prototypes somewhere the player will never find them.\r\n \r\n-Back at the start we set the "prototype" attribute on our clones. We can use that to see if an object is a clone of a certain item. In this case, we are testing a object in a local variable called "obj".\r\n+Back at the start the "prototype" attribute was mentioned. This will point to the protoype (even if you clone a clone, it will point to the original protortype) on our clones. We can use that to see if an object is a clone of a certain item. In this case, we are testing a object in a local variable called "obj".\r\n \r\n \r\n ```\r\n@@ -117,28 +108,26 @@ else {\n Specialised Functions\r\n ---------------------\r\n \r\n-If you are going to be cloning several of the same type of thing in your game, you might want to create functins to do the job for you. Let\'s look at some examples, from an RPG style game.\r\n+If you are going to be cloning several of the same type of thing in your game, you might want to create functions to do the job for you. Let\'s look at some examples, from an RPG-style game.\r\n \r\n The first is `CreateTreasure`. It is going to create a clone of a given object, then mix it up a bit. It has no return type, and two parameters, obj and room. Here is the code:\r\n \r\n ```\r\n     o = CloneObjectAndMove(obj, room)\r\n-    o.prototype = obj\r\n     if (HasString(o, "look")) o.look = ProcessText(o.look)\r\n     o.price = o.price - GetRandomInt(o.price/-4, o.price/4)\r\n ```\r\n \r\n-It will clone any item, move it to the given room, then, to give some variety, it will call `ProcessText` on the "look" attribute. This means that if the attribute is set to this:\r\n+It will clone any item, move it to the given room, then, to give some variety, it will call `ProcessText` on the "look" attribute. This means that we can set the attribute to something like this:\r\n \r\n > This is a {random:red:blue:green} hat.\r\n \r\n-The text processor directive will get processed now, as the item is created, and so its colour will not change each time the player looks at it. The price is also varietyed to with 25% of the prce of the prototype.\r\n+The text processor directive will get processed now, as the item is created, and so its colour will not change each time the player looks at it. The price is also varietied to with 25% of the price of the prototype.\r\n \r\n The next one, `CreateProtectionPotion` is a bit more specialised, but could readily be adapted. It take a single parameter, room. It makes a clone of a specific item, masterpotionprotection, and assigns an element from one of a set of predefined objects too.\r\n \r\n ```\r\n     o = CloneObjectAndMove(masterpotionprotection, room)\r\n-    o.prototype = masterpotionprotection\r\n     o.element = GetObject(PickOneStr("fire|frost|necrotic"))\r\n     o.alias = "Potion of Protection from " + CapFirst(o.element.name)\r\n     o.listalias = o.alias\r\n@@ -155,7 +144,6 @@ This is a more involved example, but the principle is the same. `CreateScroll` h\n \r\n ```\r\n     o = CloneObjectAndMove(masterscroll, room)\r\n-    o.prototype = masterscroll\r\n     o.element = GetObject(PickOneStr("fire|frost|divine|storm|earthmight"))\r\n     qualifier = StringListItem(Split("Lesser ||Greater ", "|"), level % 3)\r\n     o.alias = "Scroll of " + qualifier + CapFirst(o.element.name) + " Blast " + Roman(level / 3 + 1)\r\ndiff --git a/docs/conversations.md b/docs/conversations.md\nindex 3768ce52..f4145851 100644\n--- a/docs/conversations.md\n+++ b/docs/conversations.md\n@@ -1,15 +1,27 @@\n ---\n layout: index\n-title: Conversations\n+title: Introduction to Conversations\n ---\n \n-This page is a guide to the issues involved, and some of it is general to all interactive fiction. Conversations are a thorny subject in interactive fiction; there are several ways to present them to the player and none are accepted as "the" way to do it, or acknowledged as the best.\n+This page is a guide to the issues involved, and is general to all interactive fiction.\n+\n+Conversations are a thorny subject; there are several ways to present them to the player and none are accepted as "the" way to do it, or acknowledged as the best. You will need to think carefully about what is best for your game (and having some characters respond to one command, and others to another is just going to annoy your players).\n+\n+\n+SAY\n+---------\n \n In the tutorial the "broadcast" method was introduced:\n \n > SAY HELLO\n \n-The player says something to everyone present. This is actually very difficult to implement well, as you need to have each character response to anything the player might type.\n+The player says something to everyone present. This is potentially very difficult to implement well, as you need to have each character response to anything the player might type, from SAY YOU STINK to SAY I LOVE YOU, and ideally you would want a parser just to handle this.\n+\n+It will work best if there is no chance of two characters being in the same room at a time, so it is always clear who should respond.\n+\n+\n+SPEAK TO\n+--------\n \n The "speak to" method is directed to a specific character:\n \n@@ -17,152 +29,55 @@ The "speak to" method is directed to a specific character:\n \n This could than be handled with a stock response or by offering a list of options (Quest will accept TALK TO as a synonym of SPEAK TO).\n \n-Finally, the player can specify both the person to talk to and the subject:\n-\n-> ASK BORIS ABOUT KEY\n+[More here](speak_to.html)\n \n-> TELL MARY ABOUT LOCK\n \n-You should also consider whether you want both sides of the conversation in the output. Which you chose is up to you, but it will look better if you are consistent, so I suggest decided now, before you start typing.\n \n-> \\>TALK TO BORIS\n->\n-> \'Hi,\' you say to Boris, \'can you help me find the key to this door?\'\n->\n-> \'Sure, you need to look in the bedroom.\'\n+ASK/TELL\n+--------\n \n-> \\>TALK TO BORIS\n->\n-> \'Hi,\' says Boris, \'do you need to find the key to this door? You need to look in the bedroom.\'\n+Finally, the player can specify both the person to talk to and the subject:\n \n+> ASK BORIS ABOUT KEY\n \n-SPEAK TO and stock responses\n-----------------------------\n+> TELL MARY ABOUT LOCK\n \n-The examples above illustrate this in play.\n+> TELL BORIS TO DANCE\n \n-To set this up in Quest, select the character, go to the verbs tab, and add a new verb, "speak" (Quest will match this up to the right command as you type). Then put in the response underneath. It could look like this:\n+[More here](ask_about.html)\n \n-![](images/Talk1.png "Talk1.png")\n \n \n-SPEAK TO and a menu of responses\n---------------------------------\n+How it is displayed\n+-------------------\n \n-In play this might look like this:\n+You should also consider whether you want both sides of the conversation in the output. Which you chose is up to you, but it will look better if you are consistent, so I suggest deciding now, before you start typing.\n \n > \\>TALK TO BORIS\n >\n-> 1. Where is key\n->\n-> 2. Who is the Queen\n->\n-> 3. How do I defeat the troll\n->\n-> \\>1\n->\n > \'Hi,\' you say to Boris, \'can you help me find the key to this door?\'\n >\n > \'Sure, you need to look in the bedroom.\'\n \n-Quest handles menus well, and it would actually look rather more slick than that.\n-\n-As this is again using the "TALK TO" command, setting it up is like the first option. However, the script for that "SPEAK" verb is rather more complicated.\n+OR\n \n-![](images/Talk2.png "Talk2.png")\n-\n-In code view, it looks like this:\n-\n-      topics = Split ("Where is key;Who is the Queen;How do I defeat the troll", ";")\n-      ShowMenu ("Talk to Boris about...", topics, true) {\n-        switch (result) {\n-          case ("Where is key") {\n-            msg ("\'You need to look in the bedroom.\'")\n-          }\n-          case ("Who is the Queen") {\n-            msg ("\'Just some girl.\'")\n-          }\n-          case ("How do I defeat the troll") {\n-            msg ("\'Use fire to stop it regenerating.\'")\n-          }\n-        }\n-      }\n-\n-The first line of the script sets up the topics. They need to be a string list, and the easiest way to create one is to use the Split function. Each topic is separated by a semi-colon, with no spaces.\n-\n-A switch statement is used to decide which response will be seen. Note that the key for each case must be exactly the same as the topic you listed before. The script for each case is set up just as the script for the first option.\n-\n-\n-ASK ABOUT\n----------\n-\n-In play this might look like this:\n-\n-> \\>ASK BORIS ABOUT KEY\n->\n-> \'Hi,\' you say to Boris, \'can you help me find the key to this door?\'\n+> \\>TALK TO BORIS\n >\n-> \'Sure, you need to look in the bedroom.\'\n-\n-This is the most open-ended approach, though in reality that flexibility is an illusion - the player is limited to asking about only the topics you have included, he just does not know it. This is also the major downfall of this method - the player might not guess the subjects you have coded for, and just get frustrated as the character fails to respond to guess after guess. This system is probably best suited to when you have a large number of topics you will include for every character in the game, as a menu will soon get unwieldly, and thematically, it feels right for a mystery.\n-\n-Quest has a tab just for Ask/Tell, making it easy to set up each response (but you need to activate in on the Features tab of the game object).\n-\n-![](images/Talk3.png "Talk3.png")\n-\n-For each topic, click on add, then put in the topic name. You can put in several; try to guess what words the player will use. They should be separated by spaces, as shown above. Then you need to put in the script, just as before.\n-\n-You should also put in a script to run for unknown topics.\n-\n-The Quest Ask/About system is discussed in detail [here](ask_about.html)\n-\n-\n-Varying Responses\n------------------\n-\n-In all the above examples, the character will respond the same every time. That is not ideal, people are not like that, they will get annoyed if you ask the same question fifteen times, and wonder why you are asking where the key is when you have just used it to open the door.\n-\n-For all the methods above, the important part here is the lines that start "msg". We have gone through the three ways to arrive at them, now we are concentrating on just those lines.\n-\n-If you have a counter in there, then you could have the response depend on how often the topic has been raised (but remember to set up an integer attribute for the counter). Or use a boolean to flag that the topic has been asked (the version below automatically sets the attribute for you).\n-\n-Instead of:\n+> \'Hi,\' says Boris, \'do you need to find the key to this door? You need to look in the bedroom.\'\n \n-        msg ("\'Hi,\' you say to Philippa, \'can you help me find the key to this door?\'")\n-        msg ("\'Sure, you need to look in the bedroom.\'")\n+OR\n \n-Try:\n+> \\>TALK TO BORIS\n+>\n+> \'Hi, do you need to find the key to this door? You need to look in the bedroom.\'\n \n-        if (not GetBoolean (philipa, "key_asked") {\n-          msg ("\'Hi,\' you say to Philippa, \'can you help me find the key to this door?\'")\n-          msg ("\'Sure, you need to look in the bedroom.\'")\n-          philipa.key_asked = true\n-        }\n-        else {\n-          msg ("\'Hi again,\' you say to Philippa, \'can you help me find the key to this door?\'")\n-          msg ("\'Have you tried looking in the bedroom?\'")\n-        }\n \n-Or it could respond to changes in the world. The code below will make Philippa respond differently if the door is unlocked, or you are carrying the key.\n \n-        if (not that_door.locked) {\n-          msg ("\'I see you finally managed to unlock the door then,\' said Philippa sarcastically.\'")\n-        }\n-        else if (key.parent = player) {\n-          msg ("\'You found the key then,\' said Philippa sarcastically.\'")\n-        }\n-        else if (not GetBoolean (philippa, "key_asked")) {\n-          msg ("\'Hi,\' you say to Philippa, \'can you help me find the key to this door?\'")\n-          msg ("\'Sure, you need to look in the bedroom.\'")\n-          philippa.key_asked = true\n-        }\n-        else {\n-          msg ("\'Hi again,\' you say to Philippa, \'can you help me find the key to this door?\'")\n-          msg ("\'Have you tried looking in the bedroom yet?\'")\n-        }\n \n \n See also\n --------\n \n For a more comprehensive discussion on conversations in interactive fiction, you might like to read [this article](http://emshort.wordpress.com/how-to-play/writing-if/my-articles/conversation/)\n+\n+If using the desktop version, there is a [library](https://github.com/ThePix/quest/wiki/Library:-Conversations) that uses TALK TO together with dynamic menus.\ndiff --git a/docs/developers.md b/docs/developers.md\nindex ae3d2779..735da93f 100644\n--- a/docs/developers.md\n+++ b/docs/developers.md\n@@ -8,11 +8,10 @@ Join In\n \n Quest is an open-source software project, [hosted on GitHub](https://github.com/textadventures/quest).\n \n-To compile the source code, you will need Visual Studio 2010 or later. You can edit the desktop version of Quest for free using [Visual Studio Express for Windows Desktop](http://www.microsoft.com/visualstudio/eng/downloads#d-express-windows-desktop).\n+To compile the source code, you will need Visual Studio, which you can download for free. More details on how to do that [here](source_code.html).\n \n The code is a mixture of C\\# (for the internals) and VB.NET (for the GUI).\n \n-Visual Studio may complain that it can\'t load the Setup project. This will happen if you do not have InstallShield installed. You can safely ignore this message. Also if you are using Visual Studio Express for Windows Desktop, you can safely ignore the warning that the WebPlayer and WebEditor projects cannot be loaded, as these are not required for loading and running the main Quest project.\n \n Developer Guidelines\n --------------------\n@@ -23,17 +22,42 @@ The [Issue Tracker](https://github.com/textadventures/quest/issues) contains all\n \n Assign yourself something that looks sensible. It is probably best to pick a small bug first, to give yourself a feel for the code before attempting something major.\n \n-You can also create items - if there\'s an obvious missing feature or bug, add it to the Issue Tracker, and assign it to yourself if you want to work on it. Check it\'s not a duplicate first. And if you\'re proposing a major new feature, please suggest it on the forums (or email me) first.\n+You can also create items - if there\'s an obvious missing feature or bug, add it to the Issue Tracker, and assign it to yourself if you want to work on it. Check it\'s not a duplicate first. And if you\'re proposing a major new feature, please suggest it on the forums (or PM me) first.\n \n-Please ask me for help! I\'m happy to answer your questions about how things work, and why things are the way they are. Just send an email to me at <alex@axeuk.com> or ask in the Quest Forum: <http://textadventures.co.uk/forum/quest>\n+Please ask me for help! I\'m happy to answer your questions about how things work, and why things are the way they are. Just ask in the [Quest Forum](http://textadventures.co.uk/forum/quest).\n \n You can create a fork in GitHub, clone it, and then push your changes to that fork. When you have finished working on your issue, send a Pull Request. I\'ll then review the code, and it can then be merged into the main repository.\n \n+\n ### Translating Quest\n \n If you know a language other than English, why not try translating the English.aslx file? The more languages Quest supports, the better, so please feel free to add any language you can speak!\n \n-See [Translating Quest](guides/translating_quest.html) for full information.\n+See [Translating Quest](translating_quest.html) for full information.\n+\n+\n+### Adding your changes to Quest\n+\n+When you have a set of changes that you want included in Quest, you first need to be sure they work! There will be tests you will need to do specific to those changes, but additionally ensure:\n+\n+The unit tests all pass\n+The desktop version can be used to open a game to edit, and the game, the player, a room and an item will all display tabs properly\n+The desktop version can be used to open a game to play, and that you an save games whilst playing\n+The web player starts up properly, and will accept a couple of commands\n+The web editor starts up properly, and you can look at a couple of rooms/items\n+\n+You can then commit your changes to your local Github repository. When you do so, you will need to give it a name. Please prefix the name with the appropriate code. This allows us to quickly see what changes need special attention when Quest is updated - when adding a new file, we need to ensure it is replicated properly for example.\n+\n+[docs]  Changes to the documentation (including new files) in the `docs` folder only.\n+[lang]  Changes to existing language files, in `WorldModel\\WorldModel\\Core\\Languages` only\n+[lang][new]  New language files and/or changes to existing language files, in `WorldModel\\WorldModel\\Core\\Languages` and `WorldModel\\WorldModel\\Core\\Templates`only\n+[aslx]  Changes to existing files (including language files), in `WorldModel\\WorldModel\\Core\\Languages` and subfolders only.\n+[aslx][new]  New files and/or changes to existing files (including language files), in `WorldModel\\WorldModel\\Core\\Languages` and subfolders only.\n+\n+Commits that make changes outside of the `docs` and ``WorldModel\\WorldModel\\Core` can potentially causes big problems when updating the web player and web editor (in part because they cannot be tested properly), and so are less likely to be permitted.\n+\n+\n+\n \n Technical Overview\n ------------------\ndiff --git a/docs/images/Asktell3.png b/docs/images/Asktell3.png\nnew file mode 100644\nindex 00000000..f4018e75\nBinary files /dev/null and b/docs/images/Asktell3.png differ\ndiff --git a/docs/images/menu1a.png b/docs/images/menu1a.png\nnew file mode 100644\nindex 00000000..380c24fe\nBinary files /dev/null and b/docs/images/menu1a.png differ\ndiff --git a/docs/images/menu4a.png b/docs/images/menu4a.png\nnew file mode 100644\nindex 00000000..31baacbd\nBinary files /dev/null and b/docs/images/menu4a.png differ\ndiff --git a/docs/index.md b/docs/index.md\nindex d746461d..49f4ba2f 100644\n--- a/docs/index.md\n+++ b/docs/index.md\n@@ -165,6 +165,7 @@ Adding people that the player can interactive with can help bring your game to l\n \n -  [Following the player](follower.html)\n -  [Introduction to Conversations](conversations.html)\n+-  [Speak to](speak_to.html)\n -  [Ask/Tell](ask_about.html)\n -  [Patrolling NPCs](patrolling_npcs.html)\n -  [Independent NPCs](independent_npcs.html)\ndiff --git a/docs/shop.md b/docs/shop.md\nindex d759bc3a..7b0d211a 100644\n--- a/docs/shop.md\n+++ b/docs/shop.md\n@@ -10,6 +10,7 @@ There are several ways to set up a shop; this is more comprehensive, which does\n \r\n The approach is to have separate rooms that the player cannot get to to hold the stock. When goods are purchased from stock, a clone is made for the player. When the player sells an item, if it is something that was purchased, it will get destroyed, otherwise it will get added to stock (and if bought back will not be cloned).\r\n \r\n+\r\n Setting Up An Economy\r\n ---------------------\r\n \r\n@@ -34,7 +35,7 @@ foreach (o, GetDirectChildren(stock)) {\n }\r\n ```\r\n \r\n-It should like like this it all went well:\r\n+It should like like this if all went well:\r\n \r\n ![](images/SetUpShop.png "SetUpShop.png")\r\n \r\n@@ -193,3 +194,10 @@ SetUpShop (Cake Shop, Cake Shop Stock)\n It should look like this:\r\n \r\n ![](images/StartShop.png "StartShop.png")\r\n+\r\n+\r\n+\r\n+Clones\r\n+------\r\n+\r\n+There some issues when using clones in your game. See [here](clones.html).\n\\ No newline at end of file\ndiff --git a/docs/source_code.md b/docs/source_code.md\nindex 5301b4a9..f8e750cd 100644\n--- a/docs/source_code.md\n+++ b/docs/source_code.md\n@@ -7,7 +7,7 @@ title: Quest Source Code\n Open Source\n -----------\n \n-Quest is open-source (like, say, TADS and Inform 7), which means anyone can look at the code, and indeed (within the terms of the [licence agreement](https://github.com/textadventures/quest/blob/master/LICENSE)) make your own version.\n+Quest is open-source (unlike, say, TADS and Inform 7), which means anyone can look at the code, and indeed (within the terms of the [licence agreement](https://github.com/textadventures/quest/blob/master/LICENSE)) make your own version.\n \n An important implication of this is that Quest can survive its authors. It will always be possibly for YOU to maintain and update Quest.\n \n@@ -20,7 +20,7 @@ This describes how to download and compile the Quest source code. This is my exp\n \n ### Download\n \n-Quest can be downloaded from Github. Go to this address and over on the right is a "Clone or download" button. Download the ZIP and unpack it somewhere convenient (or even better, if you have GitHub desktop installed, use that to download it).\n+Quest can be downloaded from Github. Go to this address and over on the right is a "Clone or download" button. Download the ZIP and unpack it somewhere convenient (or even better, if you have GitHub desktop installed, use that to Clone it).\n \n [https://github.com/textadventures/quest](https://github.com/textadventures/quest)\n \n@@ -95,6 +95,8 @@ Press F5 to start the web editor. It will open a new tab in your browser with th\n The Quest Solution\n ------------------\n \n+See also [here](developers.html).\n+\n Visual Studio is designed for developing huge software, and that can make it pretty daunting to use and to find anything. You will see in the first place that Quest is split into numerous projects. If you look inside each project, you will see further folders. The "bin" and "obj" folders are used by Visual Studio when you build the project, the object file for intermediate files, the binaries folder for the compiled program. In each of them is an "x86" folder, because Quest is targeting 32-bit Windows, and inside that, "debug" and "release" folders, for whether your build for debugging or release. Both "debug" and both "release" folders have copies of Quest in them, which generally you do not have to worry about, but if you do a search across the whole solution, you will get numerous hits in these files.\n \n Generally the only folders of interest are "Resources" (containing images) and either "My Project" or "Properties" (with the actual code) - but they are plenty of exceptions.\ndiff --git a/docs/speak_to.md b/docs/speak_to.md\nnew file mode 100644\nindex 00000000..012c3af8\n--- /dev/null\n+++ b/docs/speak_to.md\n@@ -0,0 +1,172 @@\n+---\n+layout: index\n+title: Handling SPEAK TO\n+---\n+\n+\n+When setting up conversations between the player and a character, one option is to implement the SPEAK TO command.\n+\n+> SPEAK TO BORIS\n+\n+This could than be handled with a stock response or by offering a list of options (Quest will accept TALK TO as a synonym of SPEAK TO). This is a restricted approach to conversations, compared to [ASK/TELL](ask_about.html), because while the player can choose who to talk to, you are dictating what the conversation is about.\n+\n+\n+Stock responses\n+----------------------------\n+\n+The examples above illustrate this in play.\n+\n+> \\>TALK TO BORIS\n+>\n+>‘Hi,’ you say to Boris, ‘can you help me find the key to this door?’\n+>\n+>‘Sure, you need to look in the bedroom.’\n+\n+To set this up in Quest, select the character, go to the verbs tab, and add a new verb, "speak" (Quest will match this up to the right command as you type; if you type in "talk to" if will find "speak to" for you too). Then put in the response underneath. It could look like this:\n+\n+![](images/Talk1.png "Talk1.png")\n+\n+Here it is in code, which we will be using from now on!\n+\n+```\n+msg ("\'Hi,\' you say to Boris, \'can you help me find the key to this door?\'")\n+msg ("\'Sure, you need to look in the bedroom.\'")\n+```\n+\n+\n+\n+Varying Responses\n+-----------------\n+\n+In the above example, the character will respond the same every time. That is not ideal, people are not like that, they will get annoyed if you ask the same question fifteen times, and wonder why you are asking where the key is when you have just used it to open the door.\n+\n+If you have a counter in there, then you could have the response depend on how often the topic has been raised (but remember to set up an integer attribute for the counter). Or use a Boolean to flag that the topic has been asked. In the example below a Boolean is used, but as we use `GetBoolean` we do not need to set it before hand (as `GetBoolean` returns `false` if it is not set).\n+\n+Instead of:\n+\n+```\n+msg ("\'Hi,\' you say to Boris, \'can you help me find the key to this door?\'")\n+msg ("\'Sure, you need to look in the bedroom.\'")\n+```\n+\n+Try:\n+\n+```\n+if (not GetBoolean (boris, "key_asked") {\n+  msg ("\'Hi,\' you say to Boris, \'can you help me find the key to this door?\'")\n+  msg ("\'Sure, you need to look in the bedroom.\'")\n+  boris.key_asked = true\n+}\n+else {\n+  msg ("\'Hi again,\' you say to Boris, \'can you help me find the key to this door?\'")\n+  msg ("\'Have you {i:tried} looking in the bedroom?\'")\n+}\n+```\n+\n+Or it could respond to changes in the world. The code below will make Boris respond differently if the door is unlocked, or you are carrying the key.\n+\n+```\n+if (not that_door.locked) {\n+  msg ("\'I see you finally managed to unlock the door then,\' says Boris sarcastically.\'")\n+}\n+else if (key.parent = player) {\n+  msg ("\'You found the key then,\' says Boris sarcastically.\'")\n+}\n+else if (not GetBoolean (boris, "key_asked")) {\n+  msg ("\'Hi,\' you say to Boris, \'can you help me find the key to this door?\'")\n+  msg ("\'Sure, you need to look in the bedroom.\'")\n+  boris.key_asked = true\n+}\n+else {\n+  msg ("\'Hi again,\' you say to Boris, \'can you help me find the key to this door?\'")\n+  msg ("\'Have you {i:tried} looking in the bedroom yet?\'")\n+}\n+```\n+\n+\n+A menu of responses\n+---------------------------\n+\n+In play this might look like this:\n+\n+> \\>TALK TO BORIS\n+>\n+> 1. Where is key\n+>\n+> 2. Who is the Queen\n+>\n+> 3. How do I defeat the troll\n+>\n+> \\>1\n+>\n+> \'Hi,\' you say to Boris, \'can you help me find the key to this door?\'\n+>\n+> \'Sure, you need to look in the bedroom.\'\n+\n+Quest handles menus well, and it would actually look rather more slick than that.\n+\n+As this is again using the "TALK TO" command, setting it up is like the first option. However, the script for that "SPEAK" verb is rather more complicated.\n+\n+![](images/Talk2.png "Talk2.png")\n+\n+In code view, it looks like this:\n+\n+```\n+topics = Split ("Where is key;Who is the Queen;How do I defeat the troll", ";")\n+ShowMenu ("Talk to Boris about...", topics, true) {\n+  switch (result) {\n+    case ("Where is key") {\n+      msg ("\'You need to look in the bedroom.\'")\n+    }\n+    case ("Who is the Queen") {\n+      msg ("\'Just some girl.\'")\n+    }\n+    case ("How do I defeat the troll") {\n+      msg ("\'Use fire to stop it regenerating.\'")\n+    }\n+  }\n+}\n+```\n+\n+The first line of the script sets up the topics. They need to be a string list, and the easiest way to create one is to use the Split function. Each topic is separated by a semi-colon, with no spaces.\n+\n+A switch statement is used to decide which response will be seen. Note that the key for each case must be exactly the same as the topic you listed before. The script for each case is set up just as the script for the first option.\n+\n+\n+Menu and varying?\n+-----------------\n+\n+We can combine the last two, giving the player a menu to pick from, but having the character give a response depending on game state. In this example, it is only done for the first option. All we have done is inserted the code from "Varying Responses" into the above.\n+\n+```\n+topics = Split ("Where is key;Who is the Queen;How do I defeat the troll", ";")\n+ShowMenu ("Talk to Boris about...", topics, true) {\n+  switch (result) {\n+    case ("Where is key") {\n+      if (not that_door.locked) {\n+        msg ("\'I see you finally managed to unlock the door then,\' says Boris sarcastically.\'")\n+      }\n+      else if (key.parent = player) {\n+        msg ("\'You found the key then,\' says Boris sarcastically.\'")\n+      }\n+      else if (not GetBoolean (boris, "key_asked")) {\n+        msg ("\'Hi,\' you say to Boris, \'can you help me find the key to this door?\'")\n+        msg ("\'Sure, you need to look in the bedroom.\'")\n+        boris.key_asked = true\n+      }\n+      else {\n+        msg ("\'Hi again,\' you say to Boris, \'can you help me find the key to this door?\'")\n+        msg ("\'Have you {i:tried} looking in the bedroom yet?\'")\n+      }\n+    }\n+    case ("Who is the Queen") {\n+      msg ("\'Just some girl.\'")\n+    }\n+    case ("How do I defeat the troll") {\n+      msg ("\'Use fire to stop it regenerating.\'")\n+    }\n+  }\n+}\n+```\n+\n+This does have the potential to become complex, but that is the nature of the beast. The more complex, the more natural it will seem to the player. It will need thorough testing, however!\n\\ No newline at end of file\ndiff --git a/docs/using_attributes.md b/docs/using_attributes.md\nindex e01e8808..36aa7af4 100644\n--- a/docs/using_attributes.md\n+++ b/docs/using_attributes.md\n@@ -12,7 +12,7 @@ So what makes a turnscript different to a room or the player? The answer is: att\n \n Attributes are values that are attached to an object. All objects have a "name" attribute that is unique to them. All objects have an "elementtype" attribute that is equal to "object". All objects have a "type" attribute equal to the type of the object ("object", "command", "exit", "turnscript" or "game"). Quest uses these to track what things are, and they cannot be changed during play, and indeed only the "name" attribute can be changed in the editor.\n \n-By the way, it is also worth mentioning that you cannot give anything an attribute with any of these five names.\n+By the way, it is also worth mentioning that you cannot give anything an attribute with any of these five names: "object", "command", "turnscript", "game", "exit", "type", "elementtype", "finish".\n \n All other attributes you can add, modify or remove as you like, both with the editor and during play, and this is what makes your game world.\n \n', 'commit_subject': '[docs] Updates to docs', 'repo_name': 'textadventures/quest', 'committer': {'name': 'ThePix', 'email': '3cc3e70d64beddb8ccd46b6c652d76bd67f81253@hotmail.com', 'time_sec': '1540459740', 'tz_offset': '60', 'date': {'seconds': '1540459740'}}, 'commit_tree': 'ed0ce982030f5794d0229f886559f4a5d7523e36', 'commit_message': '[docs] Updates to docs\n', 'language_name': 'JavaScript', 'license': 'mit', 'hunks': '@@ -12,7 +12,7 @@ So what makes a turnscript different to a room or the player? The answer is: att\n \n Attributes are values that are attached to an object. All objects have a "name" attribute that is unique to them. All objects have an "elementtype" attribute that is equal to "object". All objects have a "type" attribute equal to the type of the object ("object", "command", "exit", "turnscript" or "game"). Quest uses these to track what things are, and they cannot be changed during play, and indeed only the "name" attribute can be changed in the editor.\n \n-By the way, it is also worth mentioning that you cannot give anything an attribute with any of these five names.\n+By the way, it is also worth mentioning that you cannot give anything an attribute with any of these five names: "object", "command", "turnscript", "game", "exit", "type", "elementtype", "finish".\n \n All other attributes you can add, modify or remove as you like, both with the editor and during play, and this is what makes your game world.\n \n', 'addition_count': 1, 'deletion_count': 1, 'src_file': 'a/docs/using_attributes.md', 'tgt_file': 'b/docs/using_attributes.md', 'file_extension': '.md', 'before_file': '---\nlayout: index\ntitle: More on Attributes\n---\n\n\nMost things in Quest are objects. In fact there are five types of objects. Rooms, objects and player objects are objects of the object type. Commands and verbs are objects of the command type. Exits are objects of the exit type. Turnscripts are objects of the turnscript type (timers are not objects by the way). The game object is an object of the game type.\n\nYou can use the `GetObject` function to get any of these, and all will register as an object with the `TypeOf` command.\n\nSo what makes a turnscript different to a room or the player? The answer is: attributes.\n\nAttributes are values that are attached to an object. All objects have a "name" attribute that is unique to them. All objects have an "elementtype" attribute that is equal to "object". All objects have a "type" attribute equal to the type of the object ("object", "command", "exit", "turnscript" or "game"). Quest uses these to track what things are, and they cannot be changed during play, and indeed only the "name" attribute can be changed in the editor.\n\nBy the way, it is also worth mentioning that you cannot give anything an attribute with any of these five names.\n\nAll other attributes you can add, modify or remove as you like, both with the editor and during play, and this is what makes your game world.\n\n\nBuilt-in Attributes\n-------------------\n\nLots of things in Quest have built-in attributes; these are the attributes you can set on the various tabs for an object (or whatever). You can access more of them using the _Features_ tab. However, this page is more about custom attributes...\n\n\nSetting Up Custom Attributes\n---------------------\n\nOn the desktop version you can set up attributes on the _Attributes_ tab. The lower half lists all the attributes for this object, those in grey are what it has inherited from its types (which are listed in the upper half). To add a new attribute, click "Add", give it a name, select a type (it defaults to string), and then give it a starting value.\n\nThe web version does not support an _Attributes_ tab, so you need to do it differently. Go to the _Features_ tab, and tick "Run an initialisation script for this object", and then go to the _Initialisation script_ tab. Here we can set attributes in a script. Obviously you can do that using the GUI, but it is easier to show using code, and the code is trivial, so that is how I will show it here. In this example, two attributes are set:\n\n```\nthis.colour = "red"\nthis.size = 15\n```\n\nEach line starts with `this`, which is a special value meaning the object the script is attached to - this object. The dot says we want something attached to the object, and the next bit is the name of attribute (like objects, these can only contain numbers, letters, spaces and underscores, and must start with a letter). Then there is an equals, followed by the value. Note that _red_ is a string, so needs to start and end with double quotes. The 15 is a number, so no quotes required.\n\n\nStatus Attributes\n-----------------\n\n[Status attributes](status_attributes.html) are just attributes that you tell Quest to display - there is nothing special about the attribute itself. \n\n\nChange Scripts\n--------------\n\nA [change script](change_scripts) is a special attribute, a script that will fire whenever another attribute changes. From the example above, we want to update `player.ammonote`, whenever `player.ammo` changes (and `player.ammomax` too).\n\n\n\n\nAttribute names to avoid\n------------------------\n\nQuest uses "name", "type" and "elementtype" to track what things are, and will not allow you to change them during a game; only "name" can be changed in the editor.\n\nThere are several [important attributes](important_attributes.html) that already have a meaning in Quest, and you are probably best avoiding them to avoid confusion.\n\nDo not use the following as names for attributes: **command, delegate, dynamictemplate, exit, function, game, include, object, template, timer, turnscript, type, verb**. It may appear at first that these are okay, but when you save the game (whether during play or when editing), the attribute will be converted to an XML element with the same name. When the game is re-loaded, Quest will assume these refer to something else entire, an actual command, or whatever.\n\nFor lists and dictionaries, attribute names cannot include spaces. Again, Quest will not complain when you do it, but it will when it tries to save your game (and you might have added a shed of load of data by then). If using the web version this might only become apparent when the player tries to save the game.\n', 'message': '[docs] Updates to docs\n', 'author_name': 'ThePix', 'lang': 'md'}