different messages from the same button press

jaydee
Just wondering how would you create a script that plays a different message in and order each time you press the same button or something similar?

lightwriter
I'm not entirely sure what you mean but you can't have a key that automatically does something but you can create a command to do what you want:
http://docs.textadventures.co.uk/quest/ ... mmand.html

Pertex
The easiest way to do it is to use the textprocessor
msg ("{random:Good bye:ByeBye:See you}")

jaydee
Thanks, the random text processor seems to be pretty useful but I could do with having message played in a specific order, for example: Press the button for the elevator "ok elevator is on its way" Press it again "ok ok its coming down already" Press it again "pressing that button won't make it come quicker.... etc...

Any thoughts?

HaganeSteel
You'd use if statements and a boolean or an integer to do this.

Let's say the elevator button is an object called Button. Give it an attribute called Push. Make it an integer and set it to 0.

Let's say Button has a verb called Press. The script might look like this:

if (Button.Push = 0) {
Button.Push = Button.Push + 1
msg ("The elevator is coming.")
}
else if (Button.Push = 1) {
Button.Push = Button.Push + 1
msg ("Okay, okay. The elevator is on its way. Sheesh.")
}
else if (Button.Push = 2) {
msg ("Pressing that button won't make the elevator come any faster.")
}


When you press the button, it adds +1 to Button.Push. The message changes depending on if Button.Push is 0, 1, or 2. When it reaches 2, it won't add any more to Button.Push, so every time the player "Presses" the button, it'll always say the last message.

Father thyme
Set up a verb (press) on the object(button), play a script on that verb . Choose scripts option and tick first time. Print message (your first message). Go to else. Tick first time again . Print second message. Go to else . Tick first time.print third message. And so on.
On the first time player enters 'press button' the first message appears. The second time the second message. Third , third message and so on.
Basically you print a message on your first 'press button.'
Next time the prog moves to else as this is the second time.
Else tells it to print second message and notes that this was another first time.
The third press moves past both first times and prints the third message.
You can do this many times.
It sounds complicated but is simply repeating first time.else first time else.
I don't really understand coding, so I do it this way. It works for me.

jaydee
thanks father thyme, I'm unfamiliar with coding myself but your method seems to work really well for what I want to do, HaganeSteel thanks for your input, im going to look more into this method when i have a little more coding experience

HaganeSteel
Yeah, don't mind me. For some reason, I forgot "First Time" existed. :lol:

Father thyme
First time is also handy if you want to repick up or describe an object in different sircumstances. IE first time it is a rope hanging on a hook. Second time it is a coil of rope.( you are carrying it,or picking it up off the floor where you dropped it .)

HaganeSteel
Edit: Oh, nevermind. I'm not sure why I didn't think of that. :lol:

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums