Hi! I'm trying to create a puzzle where the player finds a phone number and later has to use a telephone to dial that number. Basically I was trying to figure out if there's a way to ask the player to input some information and then, if the correct information is entered, run a script.
I'm not sure if this is even possible to do, since I haven't seen anything in Quest that suggests it would be, but thought I'd ask. Thanks for your help!
Here is how I would do it.
"You pick up the phone. Now, what number would you like to call?"
I used <.b> before the word 'what' and <./b> after the question mark (without the periods) to print this part of the message in bold. I do this for every situation where the player is requested to answer a question. It kind of forces the player to realize that whatever is entered next will be answering the question. Of course, this is optional (just a personal preference).
Here is the code for the telephone if seeing it in this fashion is more helpful.
msg ("You pick up the phone. Now, <b>what number do you want to call?</b>")
get input {
switch (result) {
case ("1234567","123-4567","123.4567","123 4567","123 - 4567","123 . 4567") {
msg ("You have successfully called your friend.")
}
default {
msg ("You dial that number and wait. After ringing a few times, you hear a robotic operator say \"The number you have dialed is no longer in service or has been disconnected. Please check the number and dial again.\"")
}
}
}
That should do it, right? If you have any questions, please feel free to ask. Good luck!
EDIT: You could also add a verb 'dial' to the phone and paste this same code under the dial verb in addition to putting it in the use (on its own) script. That way 'dial phone' would also illicit a proper/reasonable response.
As a side note, if you haven't done this already, I would go to the object tab of the telephone and add 'phone' to the other names section. =)
XanMag
if you want the person playing the game to type in (in the text-command box at bottom of screen) their phone number input, you can do that via using the 'get input' Script. If you wanted to have actual Objects and their Verbs as the 0-9 numbers on your 'phone' Object to be clicked on, that's a different implementation (let me know if this is the case). Here's a good example guide on using the 'get input' Script (though it's used for something else: character creation, in the guide/link below):
http://docs.textadventures.co.uk/quest/guides/character_creation.html
hidden from you, it sets: result = your_typed_in_input
which you can then use that 'result' Variable for whatever you want.
for your interest, a simple example:
get input {
if (result = "81927") {
msg ("ding ding ding, that's the correct password!")
} else {
msg ("Wrong password, you lose the game!")
msg ("GAME OVER")
finish
}
}
the other way to get typed-in input by the person playing the game is via a Command.