Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- multishell.setTitle(multishell.getCurrent(), "Console")
- local rsSide = "back"
- local LightsColor = colors.orange
- local PCSDoorColor = colors.white
- local ElevatorColor = colors.lime
- function NewMenue(name)
- local Cx, Cy = term.getCursorPos()
- term.setCursorPos(49-string.len(name), 1)
- term.clearLine()
- term.setTextColor(16)
- print("[" .. name .. "]")
- term.setTextColor(1)
- term.setCursorPos(Cx, Cy)
- end
- function printHelp(helpTag, helpTxt)
- term.setTextColor(16)
- write("[" .. helpTag .. "] ")
- term.setTextColor(1)
- print(helpTxt)
- end
- -- Fonctions Usables
- function CMD_help()
- print("Help :")
- print("------")
- print("Lights")
- print("Doors")
- print("Elevator")
- print("help")
- end
- function CMD_light()
- NewMenue("Light")
- printHelp("Help", "on / off / exit")
- while true do
- local input = read()
- if input == "" then --[[NewLinePrompt()--]]
- elseif input == "on" then
- redstone.setBundledOutput(rsSide,colors.subtract(rs.getBundledOutput(rsSide), LightsColor))
- elseif input == "off" then
- rs.setBundledOutput(rsSide,colors.combine(rs.getBundledOutput(rsSide),LightsColor))
- elseif input == "exit" then break
- else print("Unknown command")
- end
- end
- end
- function CMD_elevator()
- NewMenue("Elevator")
- printHelp("Help", "lock / unlock / exit")
- while true do
- local input = read()
- if input == "" then --[[NewLinePrompt()--]]
- elseif input == "unlock" then
- redstone.setBundledOutput(rsSide,colors.subtract(rs.getBundledOutput(rsSide), ElevatorColor))
- elseif input == "lock" then
- rs.setBundledOutput(rsSide,colors.combine(rs.getBundledOutput(rsSide),ElevatorColor))
- elseif input == "exit" then break
- else print("Unknown command")
- end
- end
- end
- function CMD_door()
- NewMenue("Door")
- printHelp("Help", "PCS / .. / exit")
- while true do
- local input = read()
- if input == "" then --[[NewLinePrompt()--]]
- elseif input == "PCS" then
- while true do
- NewMenue("Door/PCS")
- local input = read()
- if input == "" then
- elseif input == "open" then
- redstone.setBundledOutput(rsSide,colors.subtract(rs.getBundledOutput(rsSide), PCSDoorColor))
- elseif input == "close" then
- rs.setBundledOutput(rsSide,colors.combine(rs.getBundledOutput(rsSide),PCSDoorColor))
- elseif input == "exit" then break
- else print("Unknown command")
- end
- end
- elseif input == "exit" then break
- else print("Unknown command")
- end
- end
- end
- term.setCursorPos(1,2)
- function start()
- while true do
- NewMenue("Home")
- write("> ")
- local input = read()
- if input == "" then --[[NewLinePrompt()--]]
- elseif input == "light" then CMD_light()
- elseif input == "Elevator" then CMD_elevator()
- elseif input == "Doors" then CMD_door()
- elseif input == "help" then CMD_help()
- else print("Unknown command")
- end
- end
- end
- start()
Add Comment
Please, Sign In to add comment