Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. --[[ KillBot ]]--
  2. local status = false
  3. repeat
  4. rednet.open("right") -- turtle starts by idling until a rednet signal is received
  5. id, message = rednet.receive()
  6. if id == "20" and message == "stopfarm" then -- recognizes only id 20 and message startfarm
  7. if status == true then
  8. rednet.send(20, "stoped")
  9. rednet.close()
  10. sleep(1)
  11. shell.run(shell.getRunningProgram())
  12. else
  13. rednet.send(20, "not running")
  14. rednet.close()
  15. sleep(1)
  16. shell.run(shell.getRunningProgram())
  17. end
  18. elseif id == "20" and message == "startfarm" then -- recognizes only id 20 and message startfarm
  19. if status == false then
  20. rednet.send(20, "started")
  21. rednet.close()
  22. status = true
  23. else
  24. rednet.send(20, "running")
  25. rednet.close()
  26. end
  27. elseif id == "20" and message "status" then -- another alternative command that should tell the status of the turtle
  28. if redstone.getOutput("bottom") == false then
  29. rednet.send(20, "inactive")
  30. rednet.close()
  31. sleep(1)
  32. shell.run(shell.getRunningProgram())
  33. else
  34. rednet.send(20, "active")
  35. rednet.close()
  36. sleep(1)
  37. shell.run(shell.getRunningProgram())
  38. end
  39. end
  40. if status == true then
  41. turtle.attack()
  42. else then
  43. end
  44. until status == false
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement