Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- slaveName = "5" -- number of button to assign to
- masterID = 0
- outputBool = false -- default (off) state of redstone power for spawner, false means off
- masterActive = false
- function testMaster(pID, pMessage)
- if message == "KKRNBTNMaster" then
- rednet.send(pID, slaveName)
- masterID = pID
- print("Discovered Master with ID: " .. pID)
- masterActive = true
- return true
- end
- end
- function testMessage()
- id, message = rednet.receive()
- if message == "t" then
- if id == masterID then
- outputBool = not outputBool
- setRedstone(outputBool)
- end
- else
- if message == "KKRNBTNReload" then
- masterActive = false
- end
- if not masterActive then
- testMaster(id, message)
- end
- end
- end
- function setRedstone(state)
- print("Setting Redstone to: " .. tostring(state))
- redstone.setOutput("back", state)
- end
- setRedstone(outputBool)
- rednet.open("top")
- while true do
- testMessage()
- end
Advertisement
Add Comment
Please, Sign In to add comment