Or alternatively, use the 'lock exit' function. (click on the exits tab of the room where you need the password, click on the exit you want to lock, clcik 'edit', then tick the box which says 'Locked'. You must also give this room a keyword (it will tell you where to add the keyword - I called mine 'locked')
Then go back to your room description, change it to 'Run a Script' from the dropdown menu, and make it look like this:
If you would rather use code, click the icon second from the right (looks like a document), and add this:
msg ("There is a guard here. He asks you for the password. The locked door is north. East is an ungaurded exit.")
get input {
if (result="e") {
MoveObject (player, room 3)
}
else if (result="1234") {
UnlockExit (locked)
msg ("The gaurd steps aside to allow you access.")
}
else {
msg ("\"Wrong password.\"")
ShowRoomDescription
}
}
Remember to add extra
if (result="e") { MoveObject (player, room 3) } for any other unlocked exits in the room.