Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("right")
- msg = "spawner"
- side = "front"
- reversed = true
- active = false
- function update()
- if reversed then
- rs.setOutput(side,not active)
- else
- rs.setOutput(side,active)
- end
- end
- function replace(num)
- turtle.suck()
- turtle.select(num)
- turtle.drop()
- end
- update()
- while true do
- event,id,message = os.pullEvent()
- if event == "rednet_message" then
- print("Got message: "..message)
- if message == msg.." on" then
- active = true
- update()
- print("Turned on.")
- rednet.broadcast(msg.." on.")
- elseif message == msg.." off" then
- active = false
- update()
- print("Turned off.")
- rednet.broadcast(msg.." off.")
- elseif string.sub(message, 0, 4) == "pick" then
- replace(tonumber(string.sub(message, 6, 6)))
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment