what i was trying to do was make an option menu but i dont know how to make it go back to the option menu
after you choose an option (bold is the menu). it can be changed (from functions to something else)
but the base stuff like names and what it does has to do the same thing.
also im not saying to rewrite my code im just saying that i would like the way to do it (like just say the commands and maybe a small example
and ill just rewrite my code)
Spoiler
local function loginScreen()
local password = "missile"
term.clear()
term.setCursorPos(11,2)
write("[Door Terminal]")
term.setCursorPos(6,3)
write("[Enter Security Password]")
term.setCursorPos(2,6)
write("Password: ")
status, input = pcall( read, "*" )
if input == password then
term.setCursorPos(2,7)
write("Password Correct")
sleep(2)
term.clear()
else
term.setCursorPos(2,7)
term.write("Password Incorrect")
pcall( sleep, 2 )
loginScreen()
end
end
local function clearScreen()
term.clear()
term.setCursorPos(2,1)
end
local function optionScreen()
[b]term.setCursorPos(5,1)
term.write("[Door Terminal]")
term.setCursorPos(2,2)
write("Please select an option")
term.setCursorPos(2,3)
write("[1] Open Door")
term.setCursorPos(2,4)
write("[2] Close Door")
term.setCursorPos(2,5)
write("[3] Lock System")
term.setCursorPos(2,6)
write("[4] Shutdown System")
term.setCursorPos(2,8)
write("Option: ")
status, option = pcall(read)
if option == "1" and redstone.getInput("back") == false then
clearScreen()
textutils.slowWrite("Opening Door")
pcall( sleep, 0.5 )
write(".")
pcall( sleep, 0.5 )
write(".")
pcall( sleep, 0.5 )
write(".")
pcall( sleep, 0.5 )
redstone.setOutput("left", true)
if redstone.getInput("back") == true then
redstone.setOutput("left", false)
redstone.setOutput("left", true)
end
write("Done")
optionScreen()
elseif option == "1" and redstone.getInput("back") == true then
clearScreen()
write("Door Already Open")
pcall( sleep, 2 )
optionScreen()
elseif option == "2" and redstone.getInput("back") == true then
clearScreen()
textutils.slowWrite("Closing Door")
pcall( sleep, 0.5 )
write(".")
pcall( sleep, 0.5 )
write(".")
pcall( sleep, 0.5 )
write(".")
pcall( sleep, 0.5 )
redstone.setOutput("left", false)
redstone.setOutput("left", true)
write("Done")
optionScreen()
elseif option == "2" and redstone.getInput("back") == false then
clearScreen()
write("Door Already Closed")
pcall( sleep, 2 )
clearScreen()
optionScreen()
elseif option == "3" then
os.reboot()
elseif option == "4" then
os.shutdown()
else
clearScreen()
write("Not a valid option")
pcall( sleep, 2 )
clearScreen()
optionScreen()[/b]
end
end
loginScreen()
optionScreen()