Advertisement
Ferruccioboss

Minecraft>BaseDoor

Jun 1st, 2015
338
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.86 KB | None | 0 0
  1. rednet.open("right")
  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 >= 10 then
  10.                         redstone.setOutput("left", false)
  11.                         else
  12.                         redstone.setOutput("left", true)      
  13.                         end
  14.                 end
  15.         elseif event == "rednet_message" then
  16.                 if id == 24 then
  17.                         if text == "door-on" and msg == "door-off" then
  18.                                 msg = text
  19.                 redstone.setOutput("left", true)
  20.                         elseif text == "door-off" and msg == "door-on" then
  21.                 msg = text
  22.             end
  23.                 end
  24.         end
  25. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement