SHOW:
|
|
- or go back to the newest paste.
| 1 | local tArgs = { ... }
| |
| 2 | - | local nCount = tArgs[1] |
| 2 | + | local checkForEndOfRun = tArgs[1] |
| 3 | ||
| 4 | - | if not nCount then |
| 4 | + | continu = 1 |
| 5 | - | print("Usage: dig <count>")
|
| 5 | + | endOfRun = 0 |
| 6 | - | return |
| 6 | + | |
| 7 | - | end |
| 7 | + | while continu do |
| 8 | ||
| 9 | - | if nCount==0 then |
| 9 | + | |
| 10 | - | print("Arg 1, <count> must be greater than zero!")
|
| 10 | + | |
| 11 | - | return |
| 11 | + | endOfRun = endOfRun + 1 |
| 12 | - | end |
| 12 | + | if (endOfRun > 4 and not checkForEndOfRun) then break end |
| 13 | if endOfRun > 100 then break end | |
| 14 | - | while nCount do |
| 14 | + | |
| 15 | if not turtle.compare() then break end | |
| 16 | endOfRun = 0 | |
| 17 | - | nCount = nCount - 1 |
| 17 | + | |
| 18 | turtle.forward() | |
| 19 | end | |
| 20 | ||
| 21 | end |