Advertisement
Guest User

but

a guest
May 24th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.02 KB | None | 0 0
  1. os.loadAPI("touch")
  2. m = peripheral.wrap("top")
  3. m.clear()
  4.  
  5. function AddOutput(sSide, ...)
  6.   local c = colors.combine(rs.getBundledOutput(sSide), ...)
  7.   rs.setBundledOutput(sSide, c)
  8. end
  9.  
  10. function RemoveOutput(sSide, ...)
  11.   local c = colors.subtract(rs.getBundledOutput(sSide), ...)
  12.   rs.setBundledOutput(sSide, c)
  13. end
  14.  
  15.  
  16. function ToggleColor(sSide, color)
  17.  
  18.   if colors.test(rs.getBundledOutput(sSide), color) == true then
  19.     RemoveOutput(sSide, color)
  20.   else
  21.     AddOutput(sSide, color)
  22.   end
  23. end
  24.  
  25.  
  26.  
  27. function fillTable()
  28.  
  29.   touch.setTable("test1", test1, 10, 20, 3, 5)
  30.   touch.setTable("Quarry", quarry, 22, 32, 3 ,5)
  31.   touch.screen()
  32. end
  33.  
  34. function getClick()
  35.   event,side,x,y = os.pullEvent("monitor_touch")
  36.   touch.checkxy(x,y)
  37. end
  38.  
  39. function test1()
  40.   touch.toggleButton("test1")
  41.   print("test1")
  42.  
  43.   ToggleColor("left", colors.white)
  44. end
  45.  
  46.  
  47. function quarry()
  48.  
  49.   touch.toggleButton("Quarry")
  50.   ToggleColor("left", colors.orange)
  51.  
  52. end
  53.  
  54.  
  55. fillTable()
  56.  
  57.  
  58. while true do
  59.   getClick()
  60. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement