arbarr3

up

Nov 12th, 2014
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.55 KB | None | 0 0
  1. local args = { ... }
  2.  
  3. numArgs = table.getn(args)
  4.  
  5. function fuel ()
  6.     if turtle.getFuelLevel() == 0 then
  7.         turtle.select(1)
  8.         turtle.refuel(1)
  9.     end
  10. end
  11.  
  12. function goodDigUp ()
  13.     while turtle.detectUp() do
  14.         fuel()
  15.         turtle.digUp()
  16.         sleep(0.5)
  17.     end
  18.     fuel()
  19. end
  20.  
  21. if numArgs > 0.0 then
  22.     height = tonumber(args[1])
  23.  
  24.     while height > 0 do
  25.         fuel()
  26.         goodDigUp()
  27.         turtle.up()
  28.         height = height-1
  29.     end
  30. end
  31.  
  32. if numArgs == 2.0 then
  33.     height = tonumber(args[1])
  34.  
  35.     while height > 0 do
  36.         fuel()
  37.         turtle.down()
  38.         height = height-1
  39.     end
  40. end
Advertisement
Add Comment
Please, Sign In to add comment