Advertisement
Guest User

Licht

a guest
Jul 26th, 2014
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.00 KB | None | 0 0
  1. mouseWidth = 0
  2. mouseHeight = 0
  3. monitor = peripheral.wrap("top")
  4. monitor.clear()
  5. monitor.setCursorPos(1, 1)
  6. w,h=monitor.getSize()
  7. print(w)
  8. print(h)
  9. print("Die Taste 'x' beendet das Programm, alternativ")
  10. print("ebenfalls auch CTRL+T!")
  11.  
  12. function checkCklickPosition()
  13.   if mouseWidth > 0 and mouseWidth < 11 and mouseHeight > 0 and mouseHeight < 6 then
  14.   fs.open("LichtOPT/SN", "a")
  15.   elseif mouseWidth > 10 and mouseWidth < 21 and mouseHeight > 0 and mouseHeight < 6 then
  16.   fs.open("LichtOPT/NS", "a")
  17.   elseif mouseWidth > 20 and mouseWidth < 31 and mouseHeight > 0 and mouseHeight < 6 then
  18.   fs.open("LichtOPT/WE", "a")
  19.   elseif mouseWidth > 30 and mouseWidth < 41 and mouseHeight > 0 and mouseHeight < 6 then
  20.   fs.open("LichtOPT/EW", "a")
  21.   elseif mouseWidth > 40 and mouseWidth < 51 and mouseHeight > 0 and mouseHeight < 6 then
  22.  end
  23. end
  24.  
  25. --1. Monitor
  26. if fs.exists("LichtOPT/SN") == true
  27. then
  28. monitor.setBackgroundColor((colors.lime))
  29. elseif fs.exists("LichtOPT/SN") == false
  30. then
  31. monitor.setBackgroundColor((colors.red))
  32. end
  33.  
  34. monitor.setCursorPos(1, 1)
  35. monitor.write("Sued-Nord")
  36. monitor.setCursorPos(1, 2)
  37. monitor.write("         ")
  38. monitor.setCursorPos(1, 3)
  39. monitor.write("         ")
  40. monitor.setCursorPos(1, 4)
  41. monitor.write("         ")
  42. monitor.setCursorPos(1, 5)
  43. monitor.write("         ")
  44.  
  45. --2. Monitor
  46. if fs.exists("LichtOPT/NS") == true
  47. then
  48. monitor.setBackgroundcolor((colors.lime))
  49. elseif fs.exists("LichtOPT/NS") == false
  50. then
  51. monitor.setBackgroundColor((colors.red))
  52. end
  53.  
  54. monitor.setCursorPos(10, 1)
  55. monitor.write("Nord-Sued")
  56. monitor.setCursorPos(11, 2)
  57. monitor.write("         ")
  58. monitor.setCursorPos(11, 3)
  59. monitor.write("         ")
  60. monitor.setCursorPos(11, 4)
  61. monitor.write("         ")
  62. monitor.setCursorPos(11, 5)
  63. monitor.write("         ")
  64.  
  65. --3. Monitor
  66.  
  67. --4. Monitor
  68.  
  69. repeat
  70.  
  71.  event,p1,p2,p3 = os.pullEvent()
  72.  if event=="monitor_touch"
  73.  then
  74.  mouseWidth = p2
  75.  mouseHeight = p3
  76.  checkClickPosition()
  77.  end
  78.  
  79. until event=="char" and p1==("x")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement