r/ComputerCraft • • Jun 13 '21

Less Stupid: Turtle Programs

Hello Everyone,

After avoiding coding in minecraft for a long time, i got curious about the turtles, since i lacked another way to Quarry.

I have now created scripts:

  • pastebin get z9WbNS89 Miner

  • pastebin get ViyCvtJ1 Planer

  • pastebin get xn7XEVrU Refuel

  • pastebin get wKfL4vr1 Module

  • pastebin get PAR9xAc5 Chop

As you can probably tell, this led to an appreciation for this mod and all the possibilities.

Feel free to ask questions and modify the code.

i will update the Pastebin, whenever i have a new stable version for release.

Currently the code isn't exactly optimized, but it is definitely acceptable for my needs.

(and in my biased opinion, more practical than a lot of other turtle scripts)

Less Stupid: Mining Turtle

My take on a semi intelligent mining turtle.

This Miner will leave minimal change in landscape, as it attempts to only mine valuable resources.(There is a easy to edit "Blacklist" for unwanted materials)

I like to let 2 run at the same time, then when they mine away, i check tunnels previously made and get anything they missed. (The script isn't perfect but it takes out 90% of the work)

Less Stupid: Refueler

Uses all consumable fuel in it's inventory to refuel.

Less Stupid: Planer

Removes all blocks within and above coordinates.

If you place a stack of blocks in the inventory, it will use them to create a flat floor.

Less Stupid: Module Builder

Creates modules for the Chopper script to use. Uses items in Top row.

Less Stupid: Chopper

After trees has been planted and grown the Chopper can harvest all of the wood for you.

Use Diorite bricks instead of cobble.

NOTES:

Known issues:

  • Sand and gravel f*cks up the turtles pathing algorithm*(might fix it in a complete revisit of the miner script)*

  • The Fuel required is way off.(Just give it a lot of fuel, the turtle keeps its fuel when picked up)

  • Chopper script may or may not only accept Cobble and/or Diorite Bricks.

36 Upvotes

9 comments sorted by

View all comments

6

u/Benzilla99 Jun 13 '21

If you want to fix the issue with sand and gravel, you can nest your dig command in a loop with "while turtle.detect() == true". I had the same issue and this solved it for me

9

u/Tjstretchalot Jun 13 '21

note that you have to be a bit careful because (rarely) when mining you'll break a block which causes gravel to fall more than a single block due to block updates and doing this

while turtle.detect() do turtle.dig() end
turtle.forward()

won't work because it'll break out of the loop while the gravel/sand is still falling. also you'll be vulnerable to mobs that happen to get in the way. easy technique adjustment that I think always works

while not turtle.forward() do turtle.dig() end

3

u/Benzilla99 Jun 13 '21

Ooh yeah that's a better method. Good call