xavierlebel

SP COMP

Mar 23rd, 2014
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. os.loadAPI("button")
  2. m = peripheral.wrap("top")
  3. m.clear()
  4.  
  5. function fillTable()
  6.    button.setTable("SPAWN1", test1, 2,16,4,4)
  7.    button.setTable("SPAWN2", test2, 2,16,6,6)
  8.    button.setTable("SPAWN3", test3, 2,16,8,8)
  9.    button.setTable("STOP", test4, 2,16,10,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("SPAWN1")
  20.    rednet.open("right")
  21.    rednet.broadcast("SP1")
  22.    sleep(0.1)
  23.    rednet.broadcast(" ")
  24. end
  25.  
  26. function test2()
  27.    button.toggleButton("SPAWN2")
  28.    rednet.open("right")
  29.    rednet.broadcast("SP2")
  30.    sleep(0.1)
  31.    rednet.broadcast(" ")
  32. end
  33.  
  34. function test3()
  35.    button.toggleButton("SPAWN3")
  36.    rednet.open("right")
  37.    rednet.broadcast("SP3")
  38.    sleep(0.1)
  39.    rednet.broadcast(" ")
  40. end
  41.  
  42. function test4()
  43.    button.toggleButton("STOP")
  44.    rednet.open("right")
  45.    rednet.broadcast("STOP")
  46.    sleep(0.1)
  47.    rednet.broadcast(" ")
  48. end
  49.  
  50. fillTable()
  51. --button.heading("Demo Button Prog")
  52. button.label(2,2,"Materials")
  53.  
  54. while true do
  55.    getClick()
  56. end
Advertisement
Add Comment
Please, Sign In to add comment