Advertisement
Skreple

CC Receiver

Feb 21st, 2025
368
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.79 KB | None | 0 0
  1. -- Receiver Script
  2. -- Define rednet side and redstone output side
  3. local modemSide = "top" -- Change to the side where your modem is
  4. local redstoneOutputSide = "back" -- Change to the side where redstone output should be set
  5.  
  6. local receiverID = "UUID" -- Unique string ID to match transmitter
  7.  
  8. rednet.open(modemSide)
  9.  
  10. local function handleMessage(senderID, message, protocol)
  11.     if protocol == receiverID then
  12.         if message == "activate_output" then
  13.             redstone.setOutput(redstoneOutputSide, true)
  14.         elseif message == "deactivate_output" then
  15.             redstone.setOutput(redstoneOutputSide, false)
  16.         end
  17.     end
  18. end
  19.  
  20. while true do
  21.     local event, senderID, message, protocol = os.pullEvent("rednet_message")
  22.     handleMessage(senderID, message, protocol)
  23. end
  24.  
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement