Advertisement
Guest User

Untitled

a guest
Jul 19th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.10 KB | None | 0 0
  1. function println(s) print(s .. "\n") end
  2.  
  3. codes = {
  4.     ["all"] = false,
  5.     ["bedL"] = colors.white,
  6.     ["bedW"] = colors.orange,
  7.     ["hallL"] = colors.magenta,
  8.     ["hallW"] = colors.lightBlue,
  9.     ["craftL"] = colors.yellow,
  10.     ["craftW"] = colors.lime,
  11.     ["mainL"] = colors.pink,
  12.     ["mainW"] = colors.gray,
  13.     ["none"] = false
  14. }
  15.  
  16. side = "back"
  17.  
  18. state = redstone.getBundledInput(side)
  19. while true do
  20.     print("Enter device: ")
  21.     device = io.read()
  22.     if codes[device] == nil then
  23.         println("Invalid device")
  24.     else
  25.         if device == "all" then
  26.             state = 0x7FFF
  27.             println("Turned everything on")
  28.         elseif device == "none" then
  29.             state = 0
  30.             println("Turned everything off")
  31.         elseif colors.test(state, codes[device]) then
  32.             state = colors.subtract(state, codes[device])
  33.             println("Turned off " .. device)
  34.         else
  35.             state = colors.combine(state, codes[device])
  36.             println("Turned on " .. device)
  37.         end
  38.     end    
  39.     redstone.setBundledOutput(side, state)
  40. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement