question about Print message when locked

agnes
14 Dec 2015, 13:43
I want the player to press a code before entering an exit, I did as the torial teaches, however whenever I test it, it turns out like this:

"> use keypad
Please enter the code.
Error running script: Error compiling expression 'result="45854"': Unknown object or variable 'result'"

Could someone tell me why? How could I do it correctly :cry: ?

OurJud
14 Dec 2015, 13:53
This is the script for a very simplified COMMAND with NAME UseKeyPad.

Add a command for 'use keypad' to the room where the keypad is used, and give it the name UseKeyPad.

msg ("Enter password")
get input {
if (result="123456") {
MoveObject (player, Hallway)
}
else {
msg ("Incorrect password.")
do (UseKeyPad, "script")
}
}


password.jpg


Please bear in mind, that should a player get to this point without knowing the password, they'll be trapped in a loop with no escape... At least I believe so (not tested for that)

If this is the case, then simply give them a 'safe word' before using the keypad, and then add another 'if' rule:

if (result="reject") {
ShowRoomDescription
}