Advertisement
Guest User

Untitled

a guest
Mar 24th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. side = "right"
  2. rednet.open(side)
  3. while true do
  4. print("Listening for a message...")
  5. local id, message = rednet.receive()
  6.  
  7. -- print info about command and who sent it
  8. write("Recieved command: ")
  9. write(message)
  10. write(" From: ")
  11. print(id)
  12.  
  13. -- quit if they want to quit
  14. if message == "quit" then
  15. break
  16. -- run if they type run
  17. elseif message == "mine" then
  18. print("Mining a column!")
  19.  
  20. -- do the minging down
  21. local downCount = 0
  22. while downCount < 95 do
  23. if turtle.getFuelLevel() < 10 then
  24. turtle.refuel()
  25. end
  26. turtle.digDown()
  27. if turtle.down() then
  28. downCount = downCount + 1
  29. end
  30. end
  31.  
  32. -- come back to the top
  33. local upCount = 0
  34. while upCount < 95 do
  35. if turtle.up() then
  36. upCount = upCount + 1
  37. end
  38. end
  39.  
  40. -- move forward 4 blocks
  41. local count = 0
  42. while count ~= 2 do
  43. if turtle.forward() then
  44. count = count + 1
  45. end
  46. end
  47.  
  48. -- invalid command otherwise
  49. else
  50. print("Invalid command!")
  51. end
  52. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement