Change message the next time

RedTulip
27 Jan 2012, 12:09
I was wondering if there was a way so that the message could change when the player does something a second time.

For example, the player asks "Anne" about her life, then she answers, "My husband gave me a new phone for my birthday!". The second time the player asks the same exact question to Anne, she answers, "I had trouble starting my car again... I think I should go get a new one."

Thanks for any help!

Pertex
27 Jan 2012, 13:17
sure, there are several ways. The easiest way is to use a countervariable


if (counter<1) {
msg ("first message")
counter=counter+1
} else {
msg ("second message")
}

Alex
27 Jan 2012, 13:22
You'd have to store that counter somewhere, probably as an attribute of the object.

It may be easier to use object flags for this purpose. If the flag "blah" is not set, print the first message and set the flag. Else, print the second message.

This will become much easier in Quest 5.2 - there is a new "first time" script. This lets you add some script that will run the first time, and some script to run every other time.

In code it looks like this:


firsttime {
msg ("This is the first time you've looked at this")
}
otherwise {
msg ("You've already done that")
}

RedTulip
27 Jan 2012, 14:25
Pertex wrote:sure, there are several ways. The easiest way is to use a countervariable


if (counter<1) {
msg ("first message")
counter=counter+1
} else {
msg ("second message")
}


Thanks, Pertex! :D

Alex wrote:You'd have to store that counter somewhere, probably as an attribute of the object.

It may be easier to use object flags for this purpose. If the flag "blah" is not set, print the first message and set the flag. Else, print the second message.

This will become much easier in Quest 5.2 - there is a new "first time" script. This lets you add some script that will run the first time, and some script to run every other time.

In code it looks like this:


firsttime {
msg ("This is the first time you've looked at this")
}
otherwise {
msg ("You've already done that")
}


Flags were what I was supposed to use, but I wanted to know of any other way. Thanks, anyway. :) And that new feature will be really helpful!