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

Computer lock bugs

Started by FoxData, 05 April 2016 - 02:56 PM
FoxData #1
Posted 05 April 2016 - 04:56 PM
Hi everyone. I am working on a computer lock program (Not telling the name of it). But its got bugs that i can't fix.

Can you fix them?

I need the program to:

Loop round until a correct password has been inputted.

Automatically start the program after 20 minutes.

Cannot be terminated or rebooted.

Here is the code:


-- Computer Lock
--By FoxData
os.pullEvent = os.pullEventRaw
while true do
term.clear()
term.setCursorPos(10,5)

local password = "changethis"
print("This Machine has been locked")
term.setCursorPos(5,10)
print("Please Enter your password:")
term.setCursorPos(33,10)
local input = read("*")
if input == password then os.reboot()
else
error("Password is wrong")
end
  end  
Lupus590 #2
Posted 05 April 2016 - 06:07 PM
Thing about what happens when any program throws an error (which is not caught).

Additionally think about how a CC computer starts up.


With this information, have a look at what your code is doing on it's last 5 lines
KingofGamesYami #3
Posted 05 April 2016 - 06:08 PM
You cannot prevent Control+R or Control+S.
Anavrins #4
Posted 05 April 2016 - 07:02 PM
That code should work by replacing os.reboot (why???), with break.