Posted 24 November 2012 - 07:56 AM
My code is as follows
When I press the key 4 however, it just exits the program, any help?
user = "icecube45"
user1 = "sun1raven"
user2 = "AdmKennedy"
password = "cubeice45"
password1 = "tomcat5"
password2 = "flyer42"
function menu()
term.clear()
term.setCursorPos(1,1)
print("Control Panel V1.0")
print("1: Toggle Dungeon")
print("2: Toggle Quarry")
print("3: Toggle Logo")
print("4: Status Report")
print("5: Log Out")
print("What Would You Like To Do?")
input = read()
if input == "2" then
print("Under Construction")
os.sleep(2)
return menu()
elseif input == "5" then
print("Thank You for Using The Control Panel")
os.sleep(2)
os.reboot()
elseif input == "4" then
c = colors.combine(c, colors.blue)
if redstone.testBundledInput("left", c) == true then
logostatus = "Off"
else
logostatus = "On"
if redstone.testBundledInput("left", d) == true then
dungeonstatus = "Off"
else
dungeonstatus = "On"
term.clear()
term.setCursorPos(1,1)
print("Dungeon is "..dungeonstatus)
print("Quarry is UNKNOWN")
print("Logo is "..logostatus)
os.sleep(4)
return menu()
end
elseif input == "1" then
c = colors.combine(c, colors.blue)
rs.setBundledOutput("back", c )
os.sleep(1)
c = colors.subtract(c, colors.blue)
rs.setBundledOutput("back", c)
return menu()
elseif input == "3" then
d = colors.combine(d, colors.yellow)
rs.setBundledOutput("back", d )
os.sleep(1)
d = colors.subtract(d, colors.yellow)
rs.setBundledOutput("back", d)
return menu()
end
end
shell.run("monitor", "top", "face")
term.clear()
term.setCursorPos(1,1)
print("FactoryOS V2.0")
print("Choose A User:")
usercheck = read()
if usercheck == user or usercheck == user1 or usercheck == user2 then
term.clear()
term.setCursorPos(1,1)
print(usercheck.."'s Password:")
passcheck = read("*")
if passcheck == password or passcheck == password1 or passcheck == password2 then
term.clear()
term.setCursorPos(1,1)
menu()
else
print("Invalid Password")
os.reboot()
end
else
print("Invalid User")
os.reboot()
end
When I press the key 4 however, it just exits the program, any help?