This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Klausar's profile picture

How to hide my password?

Started by Klausar, 25 June 2012 - 12:59 PM
Klausar #1
Posted 25 June 2012 - 02:59 PM
I use this code for my door code, but I want to hide it, so it shows up as *******
How do I have to change the code?

pass = ("123")
osacces = ("123123")
tries = 3
triesfull = 0
print ("Password:")

for triesnum = 1,tries,1 do
password = read ()

if password == osacces then
print ("os activated")
break
end

if password == (pass) then
print ("Door is open!")
redstone.setOutput("back", true)
shell.exit()
sleep(5)
redstone.setOutput("back", false)
os.shutdown()
else
print ("Wrong Password!")
print ("Password:")
triesfull = triesfull + 1
end

end

if triesfull == tries then
os.shutdown()
end
tfoote #2
Posted 25 June 2012 - 03:01 PM

password = read("*")
-- right now we set it so that as you type it looks like ******. you can change it to @@@@, AAAA, BBBB, whatever you want as long as it is a character. you put it in the ""