The newbie needs help

BOB ROSS420
01 Jun 2020, 10:42

I want to make it so that something is password protected but I can’t figure it out. I’m using “get input” and then trying to us “if” to make sure the password that is submitted is correct but I can’t seem to find a way to do it.


mrangel
01 Jun 2020, 11:19

The simplest way would be something like:

msg ("Enter password:")
get input {
  if (result = "swordfish") {
    msg ("Access granted!")
    // code here to open a door, or whatever else the password does
  }
  else {
    msg ("Incorrect")
  }
}

I would probably use Trim (LCase (result)), so that it doesn't matter if the player remembers capital letters, or puts an extra space in the input.

If you have a problem, it would be useful to post the code you're using, what you expect it to do, and what it does when you try it.


BOB ROSS420
01 Jun 2020, 13:17

Thanks!