jaklsfjlsak

红石信号接收

Apr 21st, 2025 (edited)
619
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Script B: Listen for "pulse" broadcasts and drive front-side redstone
  2.  
  3. -- 1) Open your wireless modem on the top side
  4. rednet.open("top")                            -- Open Rednet on "top" :contentReference[oaicite:7]{index=7}
  5.  
  6. -- 2) Loop, receiving commands and setting the front output
  7. while true do
  8.   local senderID, message = rednet.receive("pulse")  -- Receive on protocol "pulse" :contentReference[oaicite:8]{index=8}
  9.  
  10.   -- 3) Update front-side redstone based on the message
  11.   if message == "ACTIVATE" then
  12.     redstone.setOutput("front", true)        -- Turn on front redstone :contentReference[oaicite:9]{index=9}
  13.   elseif message == "DEACTIVATE" then
  14.     redstone.setOutput("front", false)       -- Turn off front redstone :contentReference[oaicite:10]{index=10}
  15.   end
  16. end
  17.  
Advertisement
Add Comment
Please, Sign In to add comment