Asking a question

Hippyonastick
17 Sept 2012, 15:56
I know that there's an if 'play answers yes...' option under the if section, but an intrusive popup appears so as to answer the question. Is there a way to ask a question without this happening.

Thank you,
Steven

sgreig
17 Sept 2012, 18:14
Of course. Use a get input function to get the player's response and then use an if statement to check what they typed.

Hippyonastick
17 Sept 2012, 18:25
Thanks. But how do I enter into the if statement to correspond with the player response? (sorry i'm new to this and scripting...)

sgreig
18 Sept 2012, 05:12

msg ("Ask player random yes or no question.")
get input {
if (result = "yes") {
msg ("Hooray!")
}
else {
msg ("You suck!")
}
}

The Pixie
18 Sept 2012, 06:59
I would suggest modifying it so that:

if (result = "yes") {

becomes

if (StartsWith (LCase (result), "y")) {

This will then interprete "Yes", "yay", "Yeah" and "y" to mean yes too.

sgreig
18 Sept 2012, 12:43
The Pixie wrote:I would suggest modifying it so that:

if (result = "yes") {

becomes

if (StartsWith (LCase (result), "y")) {

This will then interprete "Yes", "yay", "Yeah" and "y" to mean yes too.


Good call. :)

Hippyonastick
19 Sept 2012, 14:51
Thank you, it worked perfectly!