Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mon = peripheral.wrap("back")
- rec = peripheral.wrap("BigReactors-Reactor_0")
- function pos(x, y)
- mon.setCursorPos(x,y)
- end
- function bg(color)
- mon.setBackgroundColor(color)
- end
- function draw()
- pos(2,2)
- mon.write("Reactor Switch.")
- pos(3,3)
- bg(colors.green)
- mon.write("> ON ")
- pos(3,4)
- bg(colors.red)
- mon.write("> OFF")
- bg(colors.black)
- end
- while true do
- mon.clear()
- hoi()
- draw()
- event, side, x, y = os.pullEvent("monitor_touch")
- if x > 3 and x < 7 and y == 3 then
- rec.setActive(true)
- sleep(.5)
- end
- if x > 3 and x < 7 and y == 4 then
- rec.setActive(false)
- sleep(.5)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement