Advertisement
Ferruccioboss

Minecraft>Door

May 22nd, 2015
406
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.47 KB | None | 0 0
  1. rednet.open("left")
  2. local val = 0
  3. local msg = "door-on"
  4. while true do
  5.     event, id, text = os.pullEvent()
  6.     if event == "redstone" then
  7.         if msg == "door-on" then
  8.             val = redstone.getAnalogInput("back")
  9.             if val >= 9 then
  10.             redstone.setOutput("right", false)
  11.             else
  12.             redstone.setOutput("right", true)  
  13.             end
  14.         end
  15.     elseif event == "rednet_message" then
  16.         if id == 5 then
  17.             if text == "door-on" or text == "door-off" then
  18.                 msg = text
  19.             end
  20.         end
  21.     end
  22. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement