Advertisement
minecraft_storm

DoorRemote

Jul 17th, 2025 (edited)
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.61 KB | None | 0 0
  1. local modemSide = "back"
  2. rednet.open(modemSide)
  3.  
  4. print("Door Remote Control")
  5. print("Type 'open', 'close', 'status' or 'exit'")
  6.  
  7. while true do
  8.     io.write("> ")
  9.     local cmd = read()
  10.     if cmd == "open" or cmd == "close" or cmd == "status" then
  11.         rednet.broadcast(cmd, "door_control")
  12.         local id, response = rednet.receive("door_control", 15)
  13.  
  14.         if response then
  15.             print("Response: " .. response)
  16.         else
  17.             print("No response (timeout).")
  18.         end
  19.     elseif cmd == "exit" then
  20.         break
  21.     else
  22.         print("Unknown command.")
  23.     end
  24. end
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement