Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Wrap the Chat Box peripheral
- local chatBox = peripheral.find("chatBox")
- if not chatBox then
- error("Chat Box not found. Please connect one to the computer.")
- end
- -- Initialize the back redstone output
- redstone.setOutput("back", false)
- print("Listening for chat messages...")
- while true do
- -- Capture the "chat" event
- local event, playerName, message = os.pullEvent("chat")
- -- Check for the specific player and message
- if playerName == "aabbcc" and message == "ccbbaa" then
- print("Message detected, sending redstone pulse!")
- -- Send a redstone pulse
- redstone.setOutput("back", true)
- sleep(1)
- redstone.setOutput("back", false)
- -- Broadcast a chat message to all players
- chatBox.sendMessage("Redstone signal triggered by player: " .. playerName)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement