Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ KillBot ]]--
- local status = false
- repeat
- rednet.open("right") -- turtle starts by idling until a rednet signal is received
- id, message = rednet.receive()
- if id == "20" and message == "stopfarm" then -- recognizes only id 20 and message startfarm
- if status == true then
- 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 id == "20" and message == "startfarm" then -- recognizes only id 20 and message startfarm
- if status == false then
- rednet.send(20, "started")
- rednet.close()
- status = true
- else
- rednet.send(20, "running")
- rednet.close()
- end
- elseif id == "20" and 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()
- else then
- end
- until status == false
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement