Advertisement
Guest User

Untitled

a guest
Mar 24th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 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 < 99 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. for i=0,99 do
  34. turtle.up()
  35. end
  36.  
  37. -- move forward 4 blocks
  38. local count = 0
  39. while count ~= 2 do
  40. if turtle.forward() then
  41. count = count + 1
  42. end
  43. end
  44.  
  45. -- invalid command otherwise
  46. else
  47. print("Invalid command!")
  48. end
  49. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement