Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ KillBot ]]--
- local status = false
- repeat
- rednet.open("left") -- turtle starts by idling until a rednet signal is received
- id, message = rednet.receive()
- if message == "stopfarm" then -- recognizes only id 20 and message startfarm
- if status == true then
- print("stoped")
- rednet.send(20, "stoped")
- rednet.close()
- sleep(1)
- shell.run(shell.getRunningProgram())
- else
- rednet.send(20, "not running")
- rednet.close()
- sleep(1)
- shell.run(shell.getRunningProgram())
- end
- elseif message == "startfarm" then -- recognizes only id 20 and message startfarm
- if status == false then
- print("started")
- rednet.send(20, "started")
- rednet.close()
- status = true
- else
- rednet.send(20, "running")
- rednet.close()
- end
- elseif message "status" then -- another alternative command that should tell the status of the turtle
- if redstone.getOutput("bottom") == false then
- rednet.send(20, "inactive")
- rednet.close()
- sleep(1)
- shell.run(shell.getRunningProgram())
- else
- rednet.send(20, "active")
- rednet.close()
- sleep(1)
- shell.run(shell.getRunningProgram())
- end
- end
- if status == true then
- turtle.attack()
- end
- until status == false
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement