Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mon=peripheral.find("monitor")
- red = "top"
- x,y = mon.getSize()
- if fs.exists("dialImage") ~= true then
- shell.run("pastebin get iPTy3ePs dialImage")
- end
- if fs.exists("buttonPress") then
- file = fs.open("buttonPress", "r")
- buttonPress = file.readAll()
- file.close()
- end
- term.redirect(mon)
- image = paintutils.loadImage("dialImage")
- paintutils.drawImage(image,1,1)
- term.redirect(term.native())
- while true do
- os.startTimer(3)
- event, param1, param2, param3 = os.pullEvent()
- print(event)
- if event == "timer" then
- sleep(0.05)
- elseif event == "monitor_touch" then
- print("touched")
- if param2 < x/3 and param3 < y/2 then
- userClick = 1
- elseif param2 > x/3 and param2 < x/3*2 and param3 < y/2 then
- userClick = 2
- elseif param2 > x/3*2 and param3 < y/2 then
- userClick = 3
- elseif param2 < x/3 and param3 > y/2 then
- userClick = 4
- elseif param2 > x/3 and param2 < x/3*2 and param3 > y/2 then
- userClick = 5
- elseif param2 > x/3*2 and param3 > y/2 then
- userClick = 6
- end
- file = fs.open("buttonPress", "w")
- file.write(buttonPress)
- file.close()
- print(userClick)
- end
- if userClick == 1 then
- if os.time() > 6 or os.time() < 5 then
- rs.setOutput(red, true)
- else
- rs.setOutput(red,false)
- userClick = 0
- end
- elseif userClick == 2 then
- if os.time() > 17 or os.time() < 6 then
- print("night")
- rs.setOutput(red, true)
- else
- print("day")
- rs.setOutput(red,false)
- end
- elseif userClick == 3 then
- if os.time() > 19 or os.time() < 18 then
- rs.setOutput(red, true)
- else
- rs.setOutput(red,false)
- userClick = 0
- end
- elseif userClick == 4 then
- if redstone.getAnalogInput("left") == 15 and os.time() > 23 then
- rs.setOutput(red, false)
- userClick = 0
- else
- rs.setOutput(red, true)
- end
- elseif userClick == 5 then
- if os.time() < 17 and os.time() > 5 then
- rs.setOutput(red, true)
- else
- rs.setOutput(red,false)
- end
- elseif userClick == 6 then
- if redstone.getAnalogInput("right") == 15 and os.time() > 18 then
- rs.setOutput(red, false)
- userClick = 0
- else
- rs.setOutput(red, true)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement