Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mouseWidth = 0
- mouseHeight = 0
- monitor = peripheral.wrap("top")
- monitor.clear()
- monitor.setCursorPos(1, 1)
- w,h=monitor.getSize()
- print(w)
- print(h)
- print("Die Taste 'x' beendet das Programm, alternativ")
- print("ebenfalls auch CTRL+T!")
- function checkCklickPosition()
- if mouseWidth > 0 and mouseWidth < 11 and mouseHeight > 0 and mouseHeight < 6 then
- fs.open("LichtOPT/SN", "a")
- elseif mouseWidth > 10 and mouseWidth < 21 and mouseHeight > 0 and mouseHeight < 6 then
- fs.open("LichtOPT/NS", "a")
- elseif mouseWidth > 20 and mouseWidth < 31 and mouseHeight > 0 and mouseHeight < 6 then
- fs.open("LichtOPT/WE", "a")
- elseif mouseWidth > 30 and mouseWidth < 41 and mouseHeight > 0 and mouseHeight < 6 then
- fs.open("LichtOPT/EW", "a")
- elseif mouseWidth > 40 and mouseWidth < 51 and mouseHeight > 0 and mouseHeight < 6 then
- end
- end
- --1. Monitor
- if fs.exists("LichtOPT/SN") == true
- then
- monitor.setBackgroundColor((colors.lime))
- elseif fs.exists("LichtOPT/SN") == false
- then
- monitor.setBackgroundColor((colors.red))
- end
- monitor.setCursorPos(1, 1)
- monitor.write("Sued-Nord")
- monitor.setCursorPos(1, 2)
- monitor.write(" ")
- monitor.setCursorPos(1, 3)
- monitor.write(" ")
- monitor.setCursorPos(1, 4)
- monitor.write(" ")
- monitor.setCursorPos(1, 5)
- monitor.write(" ")
- --2. Monitor
- if fs.exists("LichtOPT/NS") == true
- then
- monitor.setBackgroundcolor((colors.lime))
- elseif fs.exists("LichtOPT/NS") == false
- then
- monitor.setBackgroundColor((colors.red))
- end
- monitor.setCursorPos(10, 1)
- monitor.write("Nord-Sued")
- monitor.setCursorPos(11, 2)
- monitor.write(" ")
- monitor.setCursorPos(11, 3)
- monitor.write(" ")
- monitor.setCursorPos(11, 4)
- monitor.write(" ")
- monitor.setCursorPos(11, 5)
- monitor.write(" ")
- --3. Monitor
- --4. Monitor
- repeat
- event,p1,p2,p3 = os.pullEvent()
- if event=="monitor_touch"
- then
- mouseWidth = p2
- mouseHeight = p3
- checkClickPosition()
- end
- until event=="char" and p1==("x")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement