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

Password text hider

Started by viper151., 28 June 2014 - 03:21 PM
viper151. #1
Posted 28 June 2014 - 05:21 PM
Okay so I made a program that locks your computer and requires you to type in your password so resume your computer. I can't seem to figure out how to change the pasword text from text to a star *. I've tried
local input = ("*")
, but that does not work. Any suggestions? Heres the code i've got so far:

os.pullEvent = os.pullEventRaw
print ("Computer Locked")
print ("Locker v0.9.8")
print ("Username: viper151")
textutils.slowPrint ("To unlock this computer get the user who locked the computer to enter his/her password, or contact a   system administrator.")
local password = ""
while password ~= "youtube" do
  term.write ("Password: ")
  password = read()
end
print ("Computer Unlocked")
KingofGamesYami #2
Posted 28 June 2014 - 06:05 PM
read() takes an optional character that it will write instead of the pressed key. An example:

term.write("Password: ")
password = read("*")
viper151. #3
Posted 28 June 2014 - 06:12 PM
thank you, I have no idea why i didn't try that thanks!! :)/>