Passcode

Started by LinusKerman, Mar 11, 2021, 07:16 pm

Previous topic - Next topic

LinusKerman

Hello, I'm linus, and Im trying to make a program which will send a redstone signal at the computer's back once you enter the correct password, obviously this being my first program it hasn't worked, so I would like some pointers

Pastebin code:
https://pastebin.com/QDtMVQ9i

Don't expect me to ask for much more help about anything, I just want to do this one off program for giggles

Lupus590

So, points for improvement, I'll try to not hold back.

  • Use local variables.
  • Use a while true loop
  • : is not valid where you are using it, you should be using then at the end of an if and else doesn't need it either
  • Passwords are best hashed and salted
  • The sleep is not needed
  • Line 1: it looks better if you are consistent with how you do whitespace, that = needs a space before it
  • Line 2, input is undefined. I can infer what you mean but the computer can't

Sandgunslinger

Try using passattempt = read()
It should give a blank space for you to type input after you run the program; type in the password attempt and hit enter and it'll continue running the code after that.
All the stuff that Lupus590 said is right except you don't need a while true loop if you use read() unless you want to try entering the password again without having to run the program again.

QuickMuffin8782

Quote from: Sandgunslinger on May 29, 2021, 09:56 pmTry using passattempt = read()
It should give a blank space for you to type input after you run the program; type in the password attempt and hit enter and it'll continue running the code after that.
All the stuff that Lupus590 said is right except you don't need a while true loop if you use read() unless you want to try entering the password again without having to run the program again.

Also, if you want to mask a character with bullets (with 'string.char()') or asterisks, use 'read("*")"
GOTTA GO FAST!!!!
Gitlab - COSC - XenusSoft - Hangout