Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
81
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("left") -- turtle starts by idling until a rednet signal is received
  5. id, message = rednet.receive()
  6. if message == "stopfarm" then -- recognizes only id 20 and message startfarm
  7. if status == true then
  8. print("stoped")
  9. rednet.send(20, "stoped")
  10. rednet.close()
  11. sleep(1)
  12. shell.run(shell.getRunningProgram())
  13. else
  14. rednet.send(20, "not running")
  15. rednet.close()
  16. sleep(1)
  17. shell.run(shell.getRunningProgram())
  18. end
  19. elseif message == "startfarm" then -- recognizes only id 20 and message startfarm
  20. if status == false then
  21. print("started")
  22. rednet.send(20, "started")
  23. rednet.close()
  24. status = true
  25. else
  26. rednet.send(20, "running")
  27. rednet.close()
  28. end
  29. elseif message "status" then -- another alternative command that should tell the status of the turtle
  30. if redstone.getOutput("bottom") == false then
  31. rednet.send(20, "inactive")
  32. rednet.close()
  33. sleep(1)
  34. shell.run(shell.getRunningProgram())
  35. else
  36. rednet.send(20, "active")
  37. rednet.close()
  38. sleep(1)
  39. shell.run(shell.getRunningProgram())
  40. end
  41. end
  42. if status == true then
  43. turtle.attack()
  44. end
  45. until status == false
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement