Plazter

Touch computer

Jun 26th, 2013
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.34 KB | None | 0 0
  1. a = peripheral.wrap("right")
  2. rednet.open("back")
  3. term.clear()
  4. w, h = term.getSize()
  5. term.setCursorPos(1,2)
  6. print("ON")
  7. term.setCursorPos(1,3)
  8. print(">>OFF")
  9. a.setCursorPos(8, 3)
  10. a.write("Currently status of Generator:")
  11. a.setCursorPos(40,3)
  12. a.setTextColor(colors.red)
  13. a.write("Off!")
  14. rednet.broadcast("engine off")
  15. while true do
  16.  
  17. term.setCursorPos(1,1)
  18. term.setTextColor(colors.white)
  19. print("Obsidian generator:")
  20.  
  21. local  event, buttom, w, h = os.pullEvent("mouse_click")
  22.  
  23.  if buttom == 1 and w == 1 and h == 2 then
  24.  a.setTextColor(colors.white)
  25.  a.clear()
  26.  a.setCursorPos(8,3)
  27.  a.write("Currently status of Generator: ")
  28.  a.setCursorPos(40,3)
  29.  a.setTextColor(colors.lime)
  30.  a.write("On!")
  31.  term.clear()
  32.  term.setCursorPos(1,2)
  33.  term.setTextColor(colors.lime)
  34.  term.write(">>ON<<")
  35.  term.setCursorPos(1,3)
  36.  term.setTextColor(colors.white)
  37.  term.write("OFF")
  38.  rs.setOutput("right",true)
  39.  rednet.broadcast("on")
  40.  
  41.  end
  42.  
  43. if buttom == 1 and w == 1 and h == 3 then
  44. a.setTextColor(colors.white)
  45. a.clear()
  46. a.setCursorPos(8,3)
  47. a.write("Currently status of Generator: ")
  48. a.setCursorPos(40, 3)
  49. a.setTextColor(colors.red)
  50. a.write("Off!")
  51. rednet.broadcast("off")
  52. term.clear()
  53. term.setCursorPos(1,2)
  54. term.setTextColor(colors.white)
  55. term.write("ON")
  56. term.setCursorPos(1,3)
  57. term.setTextColor(colors.red)
  58. term.write(">>OFF<<")
  59. end
  60. end
Add Comment
Please, Sign In to add comment