Advertisement
Guest User

test

a guest
Feb 27th, 2015
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.64 KB | None | 0 0
  1. mon = peripheral.wrap("back")
  2. rec = peripheral.wrap("BigReactors-Reactor_0")
  3.  
  4. function pos(x, y)
  5.  mon.setCursorPos(x,y)
  6. end
  7.  
  8. function bg(color)
  9.  mon.setBackgroundColor(color)
  10. end
  11.  
  12. function draw()
  13.  pos(2,2)
  14.  mon.write("Reactor Switch.")
  15.  pos(3,3)
  16.  bg(colors.green)
  17.  mon.write("> ON ")
  18.  pos(3,4)
  19.  bg(colors.red)
  20.  mon.write("> OFF")
  21.  bg(colors.black)
  22. end
  23.  
  24. while true do
  25.  mon.clear()
  26.  hoi()
  27.  
  28.  draw()
  29.  
  30.  event, side, x, y = os.pullEvent("monitor_touch")
  31.   if x > 3 and x < 7 and y == 3 then
  32.    rec.setActive(true)
  33.    sleep(.5)
  34.   end
  35.   if x > 3 and x < 7 and y == 4 then
  36.    rec.setActive(false)
  37.    sleep(.5)
  38.   end
  39.  
  40. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement