TheKojent

rowExcavate

Apr 6th, 2013
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.42 KB | None | 0 0
  1. local tArgs = { ... }
  2. local depth = 0
  3.  
  4. if #tArgs ~= 1 then
  5.     print("Usage: rowExcavate <length>")
  6.     return
  7. end
  8.  
  9. length = tonumber(tArgs[1])
  10. os.loadAPI("try")
  11.  
  12. for i = 1,length do
  13.     while try.down() do
  14.         depth = depth + 1
  15.     end
  16.     while depth ~= 0 do
  17.         try.up()
  18.         depth = depth - 1
  19.     end
  20.     if i ~= length then
  21.         if not try.forward() then
  22.             print("Cannot move forward! Exiting script!")
  23.             return
  24.         end
  25.     end
  26. end
Advertisement
Add Comment
Please, Sign In to add comment