Advertisement
Guest User

startup

a guest
Aug 24th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.05 KB | None | 0 0
  1. local oldState = rs.getBundledInput("front")
  2.  
  3. local colName = {"White", "Orange", "Magenta", "Light Blue", "Yellow", "Lime", "Pink", "Grey", "Light Grey", "Cyan", "Purple", "Blue", "Brown", "Green", "Red", "Black"}
  4.  
  5. print("Online")
  6.  
  7. repeat
  8.         local event, p1 = os.pullEvent()
  9.        
  10.         if event == "redstone" then
  11.                 local curState,  checkCol = rs.getBundledInput("front"), 1
  12.                
  13.                 for i = 1, 16 do
  14.                         local curOn, oldOn = colours.test(curState, checkCol), colours.test(oldState, checkCol)
  15.                        
  16.                         if curOn and not oldOn then
  17.                                 print(colName[i] .. " turned on.")
  18.                         elseif not curOn and oldOn then
  19.                                 print(colName[i] .. " turned off.")
  20.                         end
  21.                        
  22.                         checkCol = checkCol * 2
  23.                 end
  24.                
  25.                 oldState = curState
  26.         end
  27. until event == "key" and p1 == keys.x
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement