Advertisement
Guest User

touch

a guest
Apr 30th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.20 KB | None | 0 0
  1. os.loadAPI("button")
  2. m = peripheral.wrap("right")
  3. m.clear()
  4.  
  5. function fillTable()
  6.    button.setTable("Reactor", test1, 4,14,3,5)
  7.    button.setTable("Fertilizer", test2, 16,26,3,5)
  8.    button.setTable("Coke Oven", test3, 4,14,8,10)
  9.    button.setTable("Test4", test4, 16,26,8,10)
  10.    button.screen()
  11. end
  12.  
  13. function getClick()
  14.    event,side,x,y = os.pullEvent("monitor_touch")
  15.    button.checkxy(x,y)
  16. end
  17.  
  18. function test1()
  19.   button.toggleButton("Reactor")
  20.   if rs.testBundledInput("back", colors.yellow) then
  21.       rs.setBundledOutput("back", 0)
  22.   else
  23.     rs.setBundledOutput("back", colors.yellow)
  24.   end
  25. end
  26.  
  27. rs.setBundledOutput("back", colors.blue)
  28.  
  29. function test2()
  30.    button.toggleButton("Fertilizer")
  31.    if rs.testBundledInput("back", 0) then
  32.        rs.setBundledOutput("back", colors.blue)
  33.    else
  34.      rs.setBundledOutput("back", 0)
  35.    end
  36. end
  37.  
  38. function test3()
  39.    button.toggleButton("Coke Oven")
  40.    if rs.testBundledInput("back", colors.red) then
  41.        rs.setBundledOutput("back", 0)
  42.    else
  43.      rs.setBundledOutput("back", colors.red)
  44.    end
  45. end
  46.  
  47. function test4()
  48.    print("Test4")
  49. end
  50.  
  51. fillTable()
  52. button.heading("Control Panel")
  53.  
  54. while true do
  55.    getClick()
  56. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement