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

[turtle] Advancend turtle digging

Started by Maarten551, 26 May 2012 - 05:55 PM
Maarten551 #1
Posted 26 May 2012 - 07:55 PM
Hello people,

Yes, I know there are already alot of digging programs, but I just wanted to show my version.

Introduction

2 Weeks ago, I found the mod "Computercraft" and it's just amazing, it completes the game from me.
So I looked into the API's and writed my own code.
It began very basic, my first version only digged vertical and didn't have much other features.
Along the time, the program became more advancend and bugless, see the "Features" section for more information about the features.

About 2 days ago, I found this forum and thought : "This can be a nice place to learn more about LUA and release my code", so here I'm.


What does it do

With this program, you can simple enter information into the turtle such as : Height, Width, Length, vertical or horizontal and auto-building ON or OFF, and the turtle will execute it.

See the video for an example.

[media]http://www.youtube.com/watch?v=FwZwClzofwA&feature=g-upl[/media]
To bad I'm to shy to talk in my videos, so you need to do it with just text and this is not the newest version.

Features
  • Editable sizes (Height, Width, Lenght)
  • Auto drop when any space in the turtle reach 64 blocks, so it won't drop any single block when all the spots are full(except the first and the second spot, because these are used in other features).
  • You can see how far the turtle is with digging.
  • Choose from Vertical(just a hole) and horizontal(tunnel) digging.
  • Gravel detection(This uses slot 1, so put gravel in this spot, this is pretty important)
  • You can choose from auto-build or not(This doesn't work yet in vertical digging, simple what this does is build on spots where blocks are missing(See the video for more information))
  • My WIP menu API is already implanted, for now it's pretty basic but it does support key movement(more information in the file or see this youtube video for more information)
Notes (Important read these before digging)
  • Always put gravel in SLOT 1 (doesn't matter how many)
  • The auto-build feature uses SLOT 2, it doesn't matter what is in the slot, the turtle will just place SLOT 2, so keep this in mind!
  • Please report any bug to me, because I really like to fix them.
  • Don't stand in front of the turtle while it's digging.
  • Horizontal digging is from the left to the right.
  • Vertical digging is from the right to the left.
How does the menu work(WIP)
  • Move arround with the arrow keys.
  • Hit enter to select an option.
  • when "-" surround the options, it means you'r on that option.
  • when "(" and ")" surround the option, it means that, that option is selected
  • To exit, press enter on the "Leave and send" option, what is on the bottom of the options.
Download

Mediafire link : http://www.mediafire...t3p4fo692l3hd93
Pastebin : http://pastebin.com/KUDfsWSm


Installation
  1. Download the file from mediafire.
  2. Goto in-game and go to the console of your turtle/terminal and enter the following : "ID"
  3. This will return your computer ID, what you will you need in an one of the next steps.
  4. go to this derictory "%appdata%.minecraftsaves[Your world]computer[The computer ID]" and place the file you downloaded from mediafire.
  5. Now go to your turtle/terminal and enter this code "dir", you will see that "mineshaft" is now in the list.
  6. Enter "mineshaft" to start to program.

To do
  • Torch placement
  • Auto-build feature on vertical digging
  • more features in the WIP menu API (for example : free input, and not only options)
Conclusion

I hope you guys will have joy with this program and I like to hear your opinions, so don't be afraid to post it.
And I like to say that I'm sorry for my English, it's a foreign language for me.
Mtdj2 #2
Posted 17 June 2012 - 07:26 PM
Suggestion: Instead of detecting the gravel, use the repeat turtle.dig() until not turtle.detect() for the gravel.

Edit: Use pastebin, makes it possible for http API to download the file.
Maarten551 #3
Posted 19 June 2012 - 08:03 PM
Suggestion: Instead of detecting the gravel, use the repeat turtle.dig() until not turtle.detect() for the gravel.

Edit: Use pastebin, makes it possible for http API to download the file.

If I don't use turtle.detect() how can I know when to stop?

And I will try to upload the code to pastebin.
kazagistar #4
Posted 19 June 2012 - 09:50 PM
You are clearly solving a problem whose existence we do not understand. Why is gravel detection useful? I only see a few possible cases, but I am not sure which is the case, because I am not experienced in this area.

1) When you dig out a gravel, you detect the falling gravel: No problem, just detect if ANY block in front, if there is, assume it is gravel, wait until it falls, and repeat. Either we can't dig it (and we know there is a mob or something) or we manage to dig it all out, and can proceed.

2) When you dig out a gravel, you don’t detect the falling gravel, try to move forward, and fail: No problem, just detect when you failed to move, assume it is gravel, wait until it falls, and repeat.

3) When you dig out gravel, you don't detect the falling gravel, try to move forward, and are TOLD that you succeeded, but actually failed (or just, this glitches and breaks the turtle or something): This IS a problem, because it interferes with navigation, however, gravel detection does not actually help, because the problem causing gravel might be above the block you would be detecting.

4) When you dig out gravel, you can successfully move forward, and once you move out, the gravel falls in behind you: This is a problem, and detection of gravel solves it (unless you have sand to deal with). Is this the case? I agree with your solution, maybe, but I am not convinced that having a dedicated slot is the best solution.

After all, if you start at the top layer, and work your way down, you can simply detect up. For any layer except the top one, anything above indicates gravel, and you can just sit there and dig it off your head until it is gone.

Edit: Am I overthinking it? Is there just some silly bug with turtle.detect that requires a block for some reason? I thought I tested this…