Two questions...
mostlyuseless
30 Nov 2012, 02:05Hi, sorry to ask for help again so soon, but I'm struggling to get everything I need from the wiki.
1) How can I tell Quest to act as if the player typed something else when a specified command is entered? I find this useful for various reasons and remember using this in Quest 2.0, but can't seem to find it in 5.
2) I have a closed, locked container for which the player does not have the key. I have used a custom 'If the player tries to lock/unlock' message which I would also like to be displayed when the player tries to open the object, but instead the parser returns 'It is locked.' How can I customise this message, as the open verb seems to be unchangeable for container objects?
Thanks for reading!
1) How can I tell Quest to act as if the player typed something else when a specified command is entered? I find this useful for various reasons and remember using this in Quest 2.0, but can't seem to find it in 5.
2) I have a closed, locked container for which the player does not have the key. I have used a custom 'If the player tries to lock/unlock' message which I would also like to be displayed when the player tries to open the object, but instead the parser returns 'It is locked.' How can I customise this message, as the open verb seems to be unchangeable for container objects?
Thanks for reading!
The Pixie
30 Nov 2012, 08:41For the second, at the bottom left of Quest, click on filter, and tick "Show Library Elements". Look through the greyed out list of dynamic templates in the left pane for "LockedObject", and click on it, then click on the "Copy" button, top right. Type your desired response in the "Text" box (this will be the response for all objects in your game, by the way).
I am not quite sure what the first means, but you could try over-writing the command. Create a new command, with a new name, but use the matching pattern of the existing command.
I am not quite sure what the first means, but you could try over-writing the command. Create a new command, with a new name, but use the matching pattern of the existing command.
Alex
30 Nov 2012, 09:15What are you trying to achieve? There may be a better way of doing it than manually triggering the parser a second time. But if you really want to, you could call something like:
HandleSingleCommand ("look at fish")
mostlyuseless
30 Nov 2012, 21:03Hi guys, thanks for the help. I have realised my first question was irrelevant; I can achieve the desired effect by using command synonyms, e.g. 'kick #object#; punch #object#', which is a much tidier way of doing things.
With the second question, however, I need the message to be object specific. In this particular case the container is a wardrobe, which when locked I would like 'open wardrobe' to return "It's locked. Let's pretend that's why you dumped your clothes on the floor." Obviously I don't want every container in the game to say that. I suppose one workaround would be to create a fake wardrobe object that isn't a container with an open verb displaying my message and then replace this object with the actual container when the player finds the key. Is there a more elegant solution?
Thanks again for your help.
With the second question, however, I need the message to be object specific. In this particular case the container is a wardrobe, which when locked I would like 'open wardrobe' to return "It's locked. Let's pretend that's why you dumped your clothes on the floor." Obviously I don't want every container in the game to say that. I suppose one workaround would be to create a fake wardrobe object that isn't a container with an open verb displaying my message and then replace this object with the actual container when the player finds the key. Is there a more elegant solution?
Thanks again for your help.

jaynabonne
01 Dec 2012, 07:30I would click on the Wardrobe object, then go to its attributes and find "openscript", click "Make Editable Copy" and munge it your heart's content. You can replace the locked text with whatever you want instead of the template.
mostlyuseless
01 Dec 2012, 14:08Thanks jaynabonne, that works perfectly. One more related question, if you don't mind...
I have a door which when opened will take you to the next room if a certain condition has been fulfilled. To do this I have made the door openable/closeable and checked a flag in the open script. If the condition is not fulfilled it returns a 'first time' message, which then changes to an 'otherwise' message if the player tries again still not having fulfilled the condition.
I would like the same script to be triggered if the player types 'answer door' (the room description states that the door is being knocked upon), but simply copying the script to a custom command is unsuitable because the 'first time' message would display twice if the player tried 'answer door' and then 'open door'. So I need 'answer door' to trigger the actual 'open door' script. How can this be achieved?
I hope this makes sense, it's what I was trying to ask in my first question but I couldn't think of a succinct example. Alex may have answered this question above, but I wasn't sure where/how his code should be implemented and therefore couldn't try it out. Thanks again!
I have a door which when opened will take you to the next room if a certain condition has been fulfilled. To do this I have made the door openable/closeable and checked a flag in the open script. If the condition is not fulfilled it returns a 'first time' message, which then changes to an 'otherwise' message if the player tries again still not having fulfilled the condition.
I would like the same script to be triggered if the player types 'answer door' (the room description states that the door is being knocked upon), but simply copying the script to a custom command is unsuitable because the 'first time' message would display twice if the player tried 'answer door' and then 'open door'. So I need 'answer door' to trigger the actual 'open door' script. How can this be achieved?
I hope this makes sense, it's what I was trying to ask in my first question but I couldn't think of a succinct example. Alex may have answered this question above, but I wasn't sure where/how his code should be implemented and therefore couldn't try it out. Thanks again!

jaynabonne
01 Dec 2012, 15:31I'm going to just dump this as script. If you need it as Quest edit sequences, let me know... 
The open command just does this:
which is quite handy, as it gives you a function to call. So you could do this.
First, add a new "answer" verb. You can easily do that in the editor.
That creates a default verb which can apply to any object, but by default says, "You can't answer that." Feel free to make that what you want.
Then implement an "answer" attribute on your door object, which will be called when someone types "answer door". Have its script be:
You need "this" instead of "object" as the verb is executed in the context of the door object (passed as "this") as opposed to a command which is matching pattern with param "object".)
Hope that helps!
(The other approach which I toyed with but rejected was copying the "open" command up and adding "answer" into the list of choices, but that then meant that any object you could open, you could also answer, which didn't really make sense. I think this is the better approach and in line with Quest's design.)

The open command just does this:
TryOpenClose(true, object)
which is quite handy, as it gives you a function to call. So you could do this.
First, add a new "answer" verb. You can easily do that in the editor.
<verb name="answer">
<pattern>answer #object#</pattern>
<property>answer</property>
<defaulttext>You can't answer that.</defaulttext>
</verb>
That creates a default verb which can apply to any object, but by default says, "You can't answer that." Feel free to make that what you want.

Then implement an "answer" attribute on your door object, which will be called when someone types "answer door". Have its script be:
<answer type="script">
TryOpenClose(true, this)
</answer>
You need "this" instead of "object" as the verb is executed in the context of the door object (passed as "this") as opposed to a command which is matching pattern with param "object".)
Hope that helps!
(The other approach which I toyed with but rejected was copying the "open" command up and adding "answer" into the list of choices, but that then meant that any object you could open, you could also answer, which didn't really make sense. I think this is the better approach and in line with Quest's design.)
mostlyuseless
01 Dec 2012, 19:26Perfect, many thanks! Works a charm. 
