Advertisement
Guest User

door

a guest
Aug 22nd, 2014
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.82 KB | None | 0 0
  1. function display()
  2.   term.setCursorPos(1,2)
  3.   term.setTextColor(colors.white)
  4.   term.setBackgroundColor(colors.green)
  5.   term.write(" Open ")
  6.   term.setCursorPos(1,3)
  7.   term.setBackgroundColor(colors.blue)
  8.   term.write("      ")
  9.   term.setCursorPos(1,4)
  10.   term.setBackgroundColor(colors.red)
  11.   term.write(" Close")
  12.   term.setCursorPos(1,1)
  13.   term.setBackgroundColor(colors.blue)
  14.   term.write("  SoulDoor  ")
  15.   term.setCursorPos(1,5)
  16. end
  17.  
  18. function open()
  19.   rednet.broadcast("open","soulDoor")
  20. end
  21.  
  22. function close()
  23.   rednet.broadcast("close","soulDoor")
  24. end
  25.  
  26. function eventHandler()
  27.   local event,button,x,y = os.pullEvent("mouse_click")
  28.   if x<=6 then
  29.     if y==2 then
  30.       open()
  31.     elseif y==4 then
  32.       close()
  33.     end
  34.   end
  35. end
  36.  
  37. display()
  38. rednet.open("back")
  39. while true do
  40.   eventHandler()
  41. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement