Posted 02 December 2012 - 08:38 PM
I want to make this script do different things based on what the user inputs. For example, in this program if I were to enter "Alpha" as my password it would send a current to whatever is to the immediate right of the computer. Can this script be adapted to send a current to the left of the computer if I input "Bravo" as my password?
Could I just list some If statements like this?
os.pullEvent = os.pullEventRaw
while true do
term.clear()
term.setCursorPos(1,1)
print ("Door Status: Lock engaged")
print ("Enter Password")
write("Password:")
UserInput = io.read()
if UserInput == "Alpha" then
print ("Door lock disengaged")
rs.setOutput ("right", true )
sleep(5)
rs.setOutput ("right" , false )
else
print ("Password incorrect, try again")
sleep(1)
end
end
Could I just list some If statements like this?
if UserInput == "Alpha" then
print ("Right Side door unlocked")
if UserInput == "Bravo" then
print ("Toast")
if UserInput == "Charlie") then
print ("Entering alcohol induced coma")
sleep(9000)
end
end
end