This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
hadesdaman's profile picture

Looping 'Excavate' program

Started by hadesdaman, 19 February 2015 - 09:37 PM
hadesdaman #1
Posted 19 February 2015 - 10:37 PM
I have a mining turtle which is currently excavating, with a wood pipe sucking its items out when the excavate is completed. However, I would like to loop the excavation command so that I don't need to manually restart it each time, but with a wait of 120 seconds between each iteration to allow for the items to be sucked out.

All loops that I Google seem to work only for user-programmed commands, and not to loop a preset program.

Is there any way that I could achieve the loop of 'excavate x' with a 120 second wait after each return to the start position?

Thanks in advance for your help! :)/>
Bomb Bloke #2
Posted 20 February 2015 - 12:07 AM
Place a chest in the space directly behind the turtle's starting location, and connect your pipe to that instead. The "excavate" script will automatically dump items into it, allowing the turtle to continue on nearly immediately afterwards.

Once the excavation script has completed, and assuming it didn't run out of fuel first, the turtle will've dug out every block that "excavate x" could reach from its starting location. There's therefore no point in running the exact same command again without repositioning the turtle and its chest.
Lyqyd #3
Posted 20 February 2015 - 01:05 AM
What version of ComputerCraft are you using?
hadesdaman #4
Posted 20 February 2015 - 05:00 PM
Place a chest in the space directly behind the turtle's starting location, and connect your pipe to that instead. The "excavate" script will automatically dump items into it, allowing the turtle to continue on nearly immediately afterwards.

Once the excavation script has completed, and assuming it didn't run out of fuel first, the turtle will've dug out every block that "excavate x" could reach from its starting location. There's therefore no point in running the exact same command again without repositioning the turtle and its chest.

I have tried that and for some reason the turtle isn't putting stuff into the chest, tried in a variety of different configurations and still nothing, I'm playing on Tekkit Classic if that helps?

Also, even if I can this still doesn't answer how I can loop 'excavate' itself?
Lyqyd #5
Posted 20 February 2015 - 06:18 PM
Tekkit Classic is incredibly outdated. Turtles in that version cannot interact with chests or other inventories. Looping the excavate program would look something like:


local gotItems = true
while gotItems do
  shell.run("excavate", "12")
  gotItems = turtle.getItemCount(1) > 0
  --# adjust number of seconds to allow pipe to extract items.
  sleep(60)
end

Of course, if you update to a more recent version, the excavate program drops items off in a chest placed behind the turtle's original starting location, and the program will continue running until the entire excavation is complete on its own.
hadesdaman #6
Posted 21 February 2015 - 02:55 PM
Tekkit Classic is incredibly outdated. Turtles in that version cannot interact with chests or other inventories. Looping the excavate program would look something like:


local gotItems = true
while gotItems do
  shell.run("excavate", "12")
  gotItems = turtle.getItemCount(1) > 0
  --# adjust number of seconds to allow pipe to extract items.
  sleep(60)
end

Of course, if you update to a more recent version, the excavate program drops items off in a chest placed behind the turtle's original starting location, and the program will continue running until the entire excavation is complete on its own.

Yeah I previously played on Direwolf and wondered why it wasn't doing it now, thank you for confirming my suspicions and for the help! :)/>