Advertisement
Guest User

g

a guest
Mar 26th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. -- Coder: Julian B., @langeweile1533, Copyyy
  2. os.loadAPI("button")
  3. local m = peripheral.wrap("back")
  4. local mx, my = m.getSize()
  5. function getClick()
  6. local event, side, x, y = os.pullEvent()
  7. if event == "monitor_touch" then
  8. button.checkxy(x, y)
  9. end
  10. end
  11. function schutz()
  12. addText()
  13. --button.toggleButton("Schutz")
  14. if button.active("Schutz") then
  15. -- print("now on")
  16. rs.setOutput("left", false)
  17. button.standby()
  18. button.setName("Schutz", "Abweahr an")
  19. else
  20. -- print("now off")
  21. rs.setOutput("left", true)
  22. button.standby()
  23. button.setName("Schutz", "Abweahr aus")
  24. end
  25. button.toggleButton("Schutz")
  26. button.save()
  27. addText()
  28. end
  29. function fillMainTable()
  30. m.clear()
  31. addText()
  32. button.clearTable()
  33. button.setTable("Schutz", schutz, "", 2, mx-1, 2, my-1, "Deakiviert")
  34. button.screen()
  35. end
  36. function addText()
  37. local text = "AbweahrSystem"
  38. local mx, my = m.getSize()
  39. m.setBackgroundColor(colors.black)
  40. m.setCursorPos((mx/2-#text/2)+1 , 1)
  41. m.write(text)
  42. end
  43. addText()
  44. fillMainTable()
  45. button.load()
  46. while true do
  47. getClick()
  48. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement