Advertisement
kreezxil

Turtlescript Back Command

Jul 23rd, 2018
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. -- inspired by MIZE
  2. -- allows a turtle to be told to go back once or a number of times
  3. -- usage:
  4. -- b [x]
  5.  
  6. local tArgs = { ... }
  7. local dist = 1
  8. if #tArgs ~= 1 then
  9. dist = 1
  10. else
  11. dist = tonumber( tArgs[1] )
  12. end
  13.  
  14. --Check fuel and refuel if nessesary
  15. --Code source: sethbling http://www.youtube.com/watch?v=DSsx4VSe-Uk&feature=share&list=SP2Qvl4gaBge02Eh4AqtDSWg3sojt3jeRO
  16. if turtle.getFuelLevel() < 200 then
  17. turtle.select(1)
  18. turtle.refuel(1)
  19. end
  20.  
  21. -- Move Up one or more
  22. for n=1,dist do
  23. if turtle.back() then
  24. print( "True" )
  25. else
  26. print( "False" )
  27. end
  28. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement