wasliebob

control

Jul 10th, 2015
287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. os.loadAPI("api")
  2. os.loadAPI("touchpoint")
  3.  
  4. mon = peripheral.wrap("right")
  5. mon.clear()
  6. mon.setTextScale(1)
  7.  
  8. local t = touchpoint.new("right")
  9. t:add("Spawner 1", toggle, 1, 1, 29, 3, colors.red, colors.lime)
  10. t:draw()
  11.  
  12. mon.setBackgroundColor(colors.black)
  13. mon.setTextColor(colors.white)
  14.  
  15. function toggle()
  16. state = redstone.getOutput("left")
  17. stateChanged = false;
  18.  
  19. if state == false then
  20. stateChanged = true
  21. else
  22. stateChanged = false
  23. end
  24. redstone.setOutput("left", stateChanged)
  25. end
  26.  
  27. while true do
  28. local event, p1 = t:handleEvents(os.pullEvent())
  29. if event == "button_click" then
  30. t.buttonList[p1].func()
  31. end
  32. end
Advertisement
Add Comment
Please, Sign In to add comment