if you want option A for example then the programs executes option A
When its finished it needs to return to the menu without starting all over again.
Wich means skip the login part but I dont know how.
So after the part DOORS OPEN (bottom of the code)
it should return to the menu (above the DOORS part)
the code:
os.pullEvent = os.pullEventRaw
local standby = 5
local side = "bottom"
local password = "appel"
local YES = "y"
local a = "a"
local b = "b"
local c = "c"
local d = "d"
local e = "e"
-- we'll put the "Security Panel" text exactle in the middle
-- and this'll help us fill the last row with orange
local width, height = term.getSize()
term.setCursorPos(1, 1)
term.setBackgroundColor(colors.white)
term.clear() -- fill the screen with white
term.setTextColor(colors.white)
term.setBackgroundColor(colors.red)
term.clearLine() -- that will fill the first row of the screen with orange
term.setCursorPos(1, height)
term.clearLine() -- ditto, but the cursor is on the last row, so will be the filling
local text = "<<< CAUTION >>>"
term.setCursorPos(math.floor((width - #text) / 2), 1)
-- this is the native text writing method from the term API
-- it writes text where the cursor currently is
term.write(text)
-- #### STAGE 1 LOGIN
term.setTextColor(colors.black)
term.setBackgroundColor(colors.white)
term.setCursorPos(1, 3)
term.write("STAGE I.")
term.setCursorPos(4, 5)
term.write("To continue, please enter the purge code.")
term.setTextColor(colors.black)
term.setCursorPos(4, 8)
term.write("Security Code: ") -- write the Password message
local input = read("*")
term.setCursorPos(4, 16) -- took this out of the IF block - it happens anyway
if input == password then
term.write("Correct")
sleep(1)
else
term.write("WRONG")
sleep(1)
os.reboot()
end
-- #### ENDSTAGE 1 LOGIN
term.setCursorPos(1, 1)
term.setBackgroundColor(colors.white)
term.clear() -- fill the screen with white
term.setTextColor(colors.white)
term.setBackgroundColor(colors.red)
term.clearLine() -- that will fill the first row of the screen with orange
term.setCursorPos(1, height)
term.clearLine() -- ditto, but the cursor is on the last row, so will be the filling
local text = "<<< Emergency Destruct System >>>"
term.setCursorPos(math.floor((width - #text) / 2), 1)
-- this is the native text writing method from the term API
-- it writes text where the cursor currently is
term.write(text)
-- #### MENU
term.setTextColor(colors.black)
term.setBackgroundColor(colors.white)
term.setCursorPos(1, 3)
term.write("Purge Menu.")
term.setCursorPos(4, 5)
term.write("a - Open blast doors.")
term.setCursorPos(4, 6)
term.write("2 - Close blast doors.")
term.setCursorPos(4, 7)
term.write("3 - Inspect Purge System.")
term.setCursorPos(4, 8)
term.write("4 - Countdown Test.")
term.setTextColor(colors.red)
term.setBackgroundColor(colors.white)
term.setCursorPos(4, 9)
term.write("5 - COMMENCE PURGE.")
term.setCursorPos(4, 11)
term.setTextColor(colors.black)
term.write("Option: ") -- write the Password message
local input = read("*")
-- #### DOORS OPEN
term.setCursorPos(4, 16) -- took this out of the IF block - it happens anyway
if input == a then
term.setTextColor(colors.orange)
term.write("Opening Blast Doors")
rs.setBundledOutput("bottom", colours.purple)
sleep(0.2)
rs.setBundledOutput("bottom", colours.black)
sleep(0.8)
rs.setBundledOutput("bottom", colours.purple)
sleep(0.2)
rs.setBundledOutput("bottom", colours.black)
sleep(0.8)
rs.setBundledOutput("bottom", colours.purple)
sleep(0.2)
rs.setBundledOutput("bottom", colours.black)
sleep(0.8)
rs.setBundledOutput("bottom", colours.purple)
sleep(0.2)
rs.setBundledOutput("bottom", colours.black)
sleep(0.8)
rs.setBundledOutput("bottom", colours.purple)
sleep(0.2)
rs.setBundledOutput("bottom", colours.black)
sleep(0.8)
rs.setBundledOutput("bottom", colours.purple)
sleep(0.2)
rs.setBundledOutput("bottom", colours.black)
sleep(0.8)
end