Does not equal

metalmario991
24 Jun 2016, 23:32
In the game I am making you need to enter a combination to open a locker door. I have it set up so that the game checks if the result/input equals the combination but I want to enter an else if for if the input/result is not the combination. How do I write it so the game checks if the result does not equal the combination?
Here's my code:
msg ("Please enter the combination. (Enter like this: XX-XX-XX)")
get input {
if (result="9-18-10") {
msg ("You enter the combination and move your hand towards the locker handle. Was that combination right?")
wait {
msg ("YES! The locker opens!")
IncreaseScore (10)
MakeObjectVisible (locker672)
RemoveObject (Locker67)
HelperOpenObject (locker672)
}
}
else if (result) {
}

jaynabonne
25 Jun 2016, 00:19
You don't need an else if. Just use an else. If it doesn't match the "if", all it can be is the other. There's no need to check. It can't be anything else.

if (result="9-18-10") {
// matches
} else {
// doesn't match
}

But if you ever do need not equals, it's "<>". or you can do "not result = xxxx",