Advertisement
MigasRocha

Reactor Button On/Off (Rafa)

Jan 7th, 2024 (edited)
749
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.02 KB | None | 0 0
  1. while true do
  2.  
  3. m = peripheral.wrap("front")
  4.  
  5. term.redirect(m)
  6.  
  7. m.clear()
  8. m.setTextColor(colors.purple)
  9. m.setCursorPos(1,1)
  10. m.write("Reator")
  11. m.setTextColor(colors.green)
  12. m.setCursorPos(1,3)
  13. m.write("On")
  14. m.setTextColor(colors.red)
  15. m.setCursorPos(1,5)
  16. m.write("Off")
  17.  
  18.  
  19. local event, side, x, y = os.pullEvent("monitor_touch")
  20.  
  21. if x == 1 and y == 3 then
  22.  
  23. m.clear()
  24. m.setTextColor(colors.purple)
  25. m.setCursorPos(1,1)
  26. m.write("Reator")
  27. m.setTextColor(colors.green)
  28. m.setCursorPos(1,3)
  29. m.write("On")
  30. m.setTextColor(colors.red)
  31. m.setCursorPos(1,5)
  32. m.write("Off")
  33.     m.setCursorPos(5,3)
  34.     m.setTextColor(colors.yellow)
  35.     m.write("X")
  36.     sleep(10)
  37.   end
  38.      
  39. if x == 1 and y == 5 then
  40.    
  41. m.clear()
  42. m.setTextColor(colors.purple)
  43. m.setCursorPos(1,1)
  44. m.write("Reator")
  45. m.setTextColor(colors.green)
  46. m.setCursorPos(1,3)
  47. m.write("On")
  48. m.setTextColor(colors.red)
  49. m.setCursorPos(1,5)
  50. m.write("Off")
  51.     m.setCursorPos(5,5)
  52.     m.setTextColor(colors.yellow)
  53.     m.write("X")
  54.     sleep(10)
  55. end
  56. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement