Posted 26 July 2014 - 12:43 AM
Im having a problem with my program to launch a missile. Basically I wrote it to ask a password, once its entered ask if you are sure you want to launch, options Y/N, (basically another password, the password being Y or N). Then it simply outputs a redstone signal, and turns it off. But when I enter the first password, it says password incorrect every time. probably will be the same with the Y/N question as well. Please help, heres the program code:
local password = “test”
while true do
term.clear()
term.setCursorPos(1, 1)
print("Enter the Access Password:")
imput = read("*")
if input == "password" then
term.clear()
term.setCursorPos(1, 1)
print("Password Correct. Are you sure you want to Launch Missile A? Y/N")
imput = read("*")
if imput == "Y" then
print("Launching Missile…")
redstone.setOutput("left", true)
sleep(5)
redstone.setOutput("left", false)
print("Missile Launched Successfully")
elseif imput == "N" then
print("N selected, Rebooting…")
reboot()
else
print("Invalid Resonse: Valid response is Y/N")
end
else
print("Incorrect Password!")
sleep(2)
end
end
local password = “test”
while true do
term.clear()
term.setCursorPos(1, 1)
print("Enter the Access Password:")
imput = read("*")
if input == "password" then
term.clear()
term.setCursorPos(1, 1)
print("Password Correct. Are you sure you want to Launch Missile A? Y/N")
imput = read("*")
if imput == "Y" then
print("Launching Missile…")
redstone.setOutput("left", true)
sleep(5)
redstone.setOutput("left", false)
print("Missile Launched Successfully")
elseif imput == "N" then
print("N selected, Rebooting…")
reboot()
else
print("Invalid Resonse: Valid response is Y/N")
end
else
print("Incorrect Password!")
sleep(2)
end
end