Advertisement
Guest User

startup

a guest
Jul 24th, 2014
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.36 KB | None | 0 0
  1. mouseWidth = 0
  2. mouseHeight = 0
  3.  
  4. monitor = peripheral.wrap("back")
  5.  
  6. monitor.clear()
  7.  
  8. monitor.setCursorPos(2,2)
  9. w,h=monitor.getSize()
  10.  
  11. print("X = "..w)
  12. print("Y = "..h)
  13.  
  14.  
  15.  
  16. monitor.setBackgroundColor((colors.green))
  17. monitor.setCursorPos(1,1)
  18. monitor.setTextColor((colors.green))
  19. monitor.write("--------")
  20. monitor.setCursorPos(1,2)
  21. monitor.write("--------")
  22. monitor.setCursorPos(1,3)
  23. monitor.write("--------")
  24. monitor.setCursorPos(1,4)
  25. monitor.write("---")
  26. monitor.setTextColor((colors.white))
  27. monitor.write("ON")
  28. monitorsetTextColor((colors.green))
  29. monitor.write("---")
  30. monitor.setCursorPos(1,5)
  31. monitor.write("--------")
  32. monitor.setCursorPos(1,6)
  33. monitor.write("--------")
  34. monitor.setCursorPos(1,7)
  35. monitor.write("--------")
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42. monitor.setCursorPos(2,4)
  43. monitor.setBackgroundColor((colors.red))
  44. monitor.write(" OFF ")
  45.  
  46.  
  47.  
  48.  
  49.  
  50. monitor.setBackgroundColour((colours.black))
  51.  
  52. function checkClickPosition()
  53.   if mouseWidth > 1 and mouseWidth < 8 and mouseHeight == 2 then
  54.     rs.setOutput("top",true)
  55.   elseif mouseWidth > 1 and mouseWidth < 8 and mouseHeight == 4 then
  56.     rs.setOutput("top",false)
  57.   end
  58. end
  59.  
  60.  
  61.  
  62. repeat
  63.   event,p1,p2,p3 = os.pullEvent()
  64.    if event=="monitor_touch" then
  65.  
  66.    
  67.      mouseWidth = p2
  68.      mouseHeight = p3
  69.      checkClickPosition()
  70.      
  71.    end
  72.  
  73. until event=="char" and p1==("x")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement