Tooki

PCS_UserSoft

Mar 22nd, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.85 KB | None | 0 0
  1. multishell.setTitle(multishell.getCurrent(), "Console")
  2. local rsSide = "back"
  3.  
  4. local LightsColor = colors.orange
  5. local PCSDoorColor = colors.white
  6. local ElevatorColor = colors.lime
  7.  
  8. function NewMenue(name)
  9.     local Cx, Cy = term.getCursorPos()
  10.     term.setCursorPos(49-string.len(name), 1)
  11.     term.clearLine()
  12.     term.setTextColor(16)
  13.     print("[" .. name .. "]")
  14.     term.setTextColor(1)
  15.     term.setCursorPos(Cx, Cy)
  16. end
  17. function printHelp(helpTag, helpTxt)
  18.     term.setTextColor(16)
  19.     write("[" .. helpTag .. "] ")
  20.     term.setTextColor(1)
  21.     print(helpTxt)
  22. end
  23. -- Fonctions Usables
  24. function CMD_help()
  25.     print("Help :")
  26.     print("------")
  27.     print("Lights")
  28.     print("Doors")
  29.     print("Elevator")
  30.     print("help")
  31. end
  32. function CMD_light()
  33.     NewMenue("Light")
  34.     printHelp("Help", "on / off / exit")
  35.     while true do
  36.         local input = read()
  37.         if input == "" then --[[NewLinePrompt()--]]
  38.  
  39.         elseif input == "on" then
  40.              redstone.setBundledOutput(rsSide,colors.subtract(rs.getBundledOutput(rsSide), LightsColor))
  41.         elseif input == "off" then
  42.                 rs.setBundledOutput(rsSide,colors.combine(rs.getBundledOutput(rsSide),LightsColor))
  43.         elseif input == "exit" then break
  44.         else print("Unknown command")
  45.         end
  46.     end
  47. end
  48. function CMD_elevator()
  49.     NewMenue("Elevator")
  50.     printHelp("Help", "lock / unlock / exit")
  51.     while true do
  52.         local input = read()
  53.         if input == "" then --[[NewLinePrompt()--]]
  54.  
  55.         elseif input == "unlock" then
  56.              redstone.setBundledOutput(rsSide,colors.subtract(rs.getBundledOutput(rsSide), ElevatorColor))
  57.         elseif input == "lock" then
  58.                 rs.setBundledOutput(rsSide,colors.combine(rs.getBundledOutput(rsSide),ElevatorColor))
  59.         elseif input == "exit" then break
  60.         else print("Unknown command")
  61.         end
  62.     end
  63. end
  64. function CMD_door()
  65.     NewMenue("Door")
  66.     printHelp("Help", "PCS / .. / exit")
  67.     while true do
  68.         local input = read()
  69.         if input == "" then --[[NewLinePrompt()--]]
  70.         elseif input == "PCS" then
  71.             while true do
  72.                 NewMenue("Door/PCS")
  73.                 local input = read()
  74.                 if input == "" then
  75.                 elseif input == "open" then
  76.                     redstone.setBundledOutput(rsSide,colors.subtract(rs.getBundledOutput(rsSide), PCSDoorColor))
  77.                 elseif input == "close" then
  78.                     rs.setBundledOutput(rsSide,colors.combine(rs.getBundledOutput(rsSide),PCSDoorColor))
  79.                 elseif input == "exit" then break
  80.                 else print("Unknown command")
  81.                 end
  82.             end
  83.         elseif input == "exit" then break
  84.         else print("Unknown command")
  85.         end
  86.     end
  87. end
  88. term.setCursorPos(1,2)
  89.  
  90. function start()
  91.     while true do
  92.         NewMenue("Home")
  93.         write("> ")
  94.      
  95.         local input = read()
  96.         if input == "" then --[[NewLinePrompt()--]]
  97.    
  98.         elseif input == "light" then CMD_light()
  99.         elseif input == "Elevator" then CMD_elevator()
  100.         elseif input == "Doors" then CMD_door()
  101.         elseif input == "help" then CMD_help()
  102.  
  103.         else print("Unknown command")
  104.         end
  105.     end
  106. end
  107.  
  108. start()
Add Comment
Please, Sign In to add comment