Advertisement
LikeGeil

[MINERAX] Spawner System

Oct 28th, 2016
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  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 schutz()
  11. addText()
  12. --button.toggleButton("Schutz")
  13. if button.active("Schutz") then
  14. -- print("now on")
  15. rs.setOutput("right", true)
  16. rs.setOutput("left", false)
  17. button.standby()
  18. button.setName("Schutz", "Status: OFFLINE")
  19. else
  20. -- print("now off")
  21. rs.setOutput("right", false)
  22. rs.setOutput("left", true)
  23. button.standby()
  24. button.setName("Schutz", "Status: ONLINE")
  25. end
  26. button.toggleButton("Schutz")
  27. button.save()
  28. addText()
  29. end
  30. function fillMainTable()
  31. m.clear()
  32. addText()
  33. button.clearTable()
  34. button.setTable("Schutz", schutz, "", 2, mx-1, 2, my-1, "Status: UNBEKANNT")
  35. button.screen()
  36. button.standby()
  37. end
  38. function addText()
  39. local text = "Spawner System 1.1"
  40. local mx, my = m.getSize()
  41. m.setBackgroundColor(colors.black)
  42. m.setCursorPos((mx/2-#text/2)+1 , 1)
  43. m.write(text)
  44. end
  45. addText()
  46. fillMainTable()
  47. button.load()
  48. while true do
  49. getClick()
  50. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement