Advertisement
Guest User

home

a guest
Mar 21st, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.67 KB | None | 0 0
  1. rednet.open("right")
  2. gateOpt = true
  3.  
  4. term.clear()
  5.  
  6. local function gate()
  7.     term.setCursorPos(1,1)
  8.     if gateOpt == true then
  9.         term.setBackgroundColor(colors.red)
  10.     elseif gateOpt == false then
  11.         term.setBackgroundColor(colors.green)
  12.     end
  13.     print("      ")
  14.     print(" Gate ")
  15.     print("      ")
  16. end
  17.  
  18. gate()
  19. while true do
  20.     local event,button,X,Y = os.pullEvent()
  21.     if event == "mouse_click" then
  22.         if  X >= 1 and X <= 6 and Y >= 1 and Y <= 3 then
  23.             gateOpt = false
  24.             gate()
  25.             rednet.send(1609,"open")
  26.             sleep(2)
  27.             gateOpt = true
  28.             gate()
  29.         end
  30.     end
  31. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement