Guest User

Untitled

a guest
Jul 22nd, 2019
68
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. os.loadAPI("button")
  2. local m = peripheral.wrap("back")
  3. local mx, my = m.getSize()
  4. function getClick()
  5. local event, side, x, y = os.pullEvent()
  6. if event == "monitor_touch" then
  7. button.checkxy(x, y)
  8. end
  9. end
  10. function Reaktor()
  11. addText()
  12. --button.toggleButton("Reaktor")
  13. if button.active("Reaktor") then
  14. -- print("now on")
  15. rs.setOutput("left", false)
  16. button.setName("Reaktor", "deactivating...")
  17. button.standby()
  18. button.setName("Reaktor", "Reactor deactivated!")
  19. else
  20. -- print("now off")
  21. rs.setOutput("left", true)
  22. button.setName("Reaktor", "activating...")
  23. button.standby()
  24. button.setName("Reaktor", "Reactor activated!")
  25. end
  26. button.toggleButton("Reaktor")
  27. button.save()
  28. addText()
  29. end
  30. function fillMainTable()
  31. m.clear()
  32. addText()
  33. button.clearTable()
  34. button.setTable("Reaktor", Reaktor, "", 2, mx-1, 2, my-1, "Reactor deactivated!")
  35. button.screen()
  36. end
  37. function addText()
  38. local text = "Reactor System"
  39. local mx, my = m.getSize()
  40. m.setBackgroundColor(colors.black)
  41. m.setCursorPos((mx/2-#text/2)+1 , 1)
  42. m.write(text)
  43. end
  44. addText()
  45. fillMainTable()
  46. button.load()
  47. while true do
  48. getClick()
  49. end
RAW Paste Data