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

[Program] Advanced tunneler

Started by Telokis, 04 April 2013 - 11:53 PM
Telokis #1
Posted 05 April 2013 - 01:53 AM
Hi everybody !

Here is a big program I've made.
First, it was to train myself using ComputerCraft but I expanded it a lot and, I think, it can be very usefull so I share it !

I'll post more screenshots later but you already can see what it does !

On the following picture, you can see the default program (without any config, it does a 3x3x10 tunnel and fills all walls. It also come back to start when it needs to empty itself and when it need more filling blocks.
If you want it to empty itself, you have to put a chest behind its start position.

Screenshots :
SpoilerA tunnel !



Bridge :



My config for building a stone room !



There also is a progress bar !!


Current options are :

- Tunnel width : Tunnel width !
- Tunnel height : Tunnel height !
- Tunnel length : Tunnel length !

- Run in dig only mode ? : If 'y', it won't care about walls, ceiling and floor. It'll only dig !
–> Fill left wall ? : If 'y', it will put blocks on the left wall.
–> Fill right wall ? : Same but right wall
–> Fill back wall ? : Same but back wall
–> Fill ceiling ? : Same but ceiling
–> Fill floor ? : Same but floor
–> Go back when I need filling blocks ? If there are less than 5 filling blocks, must it go back to start and wait for you to give it more blocks ?
–> How many slots must I keep for filling blocks ? : It will try (as possible) to keep that number of slots for filling blocks. (Example, if you put cobble and it digs cobble, it will be able to re-use it. Moreover, if it is full of cobble and you put 4 slots to keep, it will empty the 12 in the chest.

- Should I empty myself when I'm full ? : If 'y', the turtle will go back to start and empty itself in the chest. (Chest must be behind it at launching !)
- Should I send infos on rednet ? : If 'y', turtle will send these messages "Need empty", "Empty done", "Need block", "Going back to work", "Launching" and "Done".

("–>" Means dependancy : If you say "Dig only", it won't ask you everything)

If you look at the turtle screen while it is running, you can also see a progress bar to tell you about its… Progress !

I did it in 3 days so sorry if it need more options. If you have any idea of improvement, tell me ! I'll do it as quick as possible ! ;)/>/>

TODO list :
Spoiler- Place torches !!!!
- Refuel itself.
- I don't really know so tell me ! :D/>/>

Links :
Spoilerv2.2.2 : http://pastebin.com/HPyPaNkL
- Fixed bug : When the turtle returns from start to work, it uses a better path.

v2.2.1 : http://pastebin.com/CA08dhhG
- Fixed bug : When there is gravel and it has to replace it. It failed.

v2.2 : http://pastebin.com/H6KhC9Wn
- Fixed some bugs.

v2.1 : http://pastebin.com/At8WF41E
- Fixed bug when dig only. It tried to find blocks
- Fixed message "Fill walls ?" -> "Dig only ?"

v2 : http://pastebin.com/YFMGerc8

I hope it will be usefull !
(By the way, if you find any bug, tell me !)

Edit :

———————————
Added in TODO list :

- Place torches !!!!
- Refuel itself.
———————————
More screenshots !!
———————————
Edited on 25 August 2015 - 05:18 PM
theoriginalbit #2
Posted 05 April 2013 - 01:58 AM
Looks good :)/>

I think the ability to place torches would be nice :)/>
Aptik #3
Posted 05 April 2013 - 02:19 AM
Why there are no turtle.refuel in your program?
Telokis #4
Posted 05 April 2013 - 02:27 AM
Looks good :)/>

I think the ability to place torches would be nice :)/>

Thanks ! I forgot it !


Why there are no turtle.refuel in your program?

Because I don't use fuel on my server. But I think it would be usefull to add this feature so thank you, I wrote it in my TODO list ! ;)/>

If there are other ideas, tell me ! :)/>
And thanks for your feedback !
Telokis #5
Posted 05 April 2013 - 02:44 AM
v2.1 : http://pastebin.com/At8WF41E
- Fixed bug when dig only. It tried to find blocks
- Fixed message "Fill walls ?" -> "Dig only ?"

Added screenshot:

Spoiler
(You also can build bridges if you only fill the floor !)
Engineer #6
Posted 05 April 2013 - 10:48 AM
Make the config say true or false instead of y and n
Telokis #7
Posted 05 April 2013 - 11:13 AM
Make the config say true or false instead of y and n

Why should I do so ? You think it is more explicite ?
Engineer #8
Posted 05 April 2013 - 11:17 AM
Make the config say true or false instead of y and n

Why should I do so ? You think it is more explicite ?
It makes more sense
Telokis #9
Posted 05 April 2013 - 11:57 AM
Make the config say true or false instead of y and n
Why should I do so ? You think it is more explicite ?
It makes more sense

It makes more sense for a coder but I think it is not the case for a random user.
Engineer #10
Posted 05 April 2013 - 12:07 PM
Make the config say true or false instead of y and n
Why should I do so ? You think it is more explicite ?
It makes more sense

It makes more sense for a coder but I think it is not the case for a random user.

Well lets say somebody just wants the code and didnt read the thread. I know you should read it, but hey, those people exist!
For those, 'y' makes no sense. Because they dont know what it means, they can guess but that is not reliable.

If it is the keyword true or false, almost everyone knows it. Just look at configs files of mods. They use 0 or 1, or true and false.
For the 0 and 1 part, it is binary that makes also sense if you know that.

But since its such a minor change, I am not going to even worry about it anymore.
Telokis #11
Posted 05 April 2013 - 12:25 PM
Are you talking about my example screenshot ?
I see what you mean !
I put 'y' and 'n' because, during config mode, my programs asks like this:

"Should I go back to start when I need filling blocks ? (y/n) "
It is a question directly asked to the user.

The screenshot shows the "recap" step. It's when the programs wants the user to confirm all is good. Do you see what I mean ?
Engineer #12
Posted 05 April 2013 - 12:47 PM
Are you talking about my example screenshot ?
I see what you mean !
I put 'y' and 'n' because, during config mode, my programs asks like this:

"Should I go back to start when I need filling blocks ? (y/n) "
It is a question directly asked to the user.

The screenshot shows the "recap" step. It's when the programs wants the user to confirm all is good. Do you see what I mean ?
Wow, I really need to give myself a facepalm. Im sorry, I take back all my words I've said.
I would edit it out, but it is a little awkward to say at every post: edited out.

And Its a good program, dont get me wrong here :)/>
Telokis #13
Posted 05 April 2013 - 01:02 PM
Are you talking about my example screenshot ? I see what you mean ! I put 'y' and 'n' because, during config mode, my programs asks like this: "Should I go back to start when I need filling blocks ? (y/n) " It is a question directly asked to the user. The screenshot shows the "recap" step. It's when the programs wants the user to confirm all is good. Do you see what I mean ?
Wow, I really need to give myself a facepalm. Im sorry, I take back all my words I've said. I would edit it out, but it is a little awkward to say at every post: edited out. And Its a good program, dont get me wrong here :)/>/>

Ok it's fine !
I now know my screen is a bit confusing ! ;)/>
Aptik #14
Posted 05 April 2013 - 09:29 PM
What about resume building after server restart/chunk load?
Telokis #15
Posted 06 April 2013 - 02:09 AM
What about resume building after server restart/chunk load?

I think such a feature would need me to change a huge part of code because I didn't think it to work this way. =/
Telokis #16
Posted 08 April 2013 - 07:58 AM
Hum… What would you think about a "Fill holes" mode ?
Instead of filling each wall with the defined block, it will only fill holes ! (I think it will also fill lava/water)
keegras #17
Posted 11 April 2013 - 02:37 AM
I really like the program and used it quite a bit yesterday. There's a bug in it though, and that's when it comes to mining and there's gravel dropping infront of it. It will just stay immobilized until I go there and manually remove the gravel with a shovel. After that the turtle will go on with the digging. Same goes for when you use the option to fill the walls/ceiling if there's some gravel above the last block in walls/ceilings. It destroys the top/sides last block, and if gravel then drops in from above, it can't place the wall blocks and it will be stuck there until I manually remove the gravel.

This bug prevents the option to let the program run and come back later, as you need to supervise it incase of gravel drops. I guess sand or any other falling block will create the same problem, but I have not tested it.


Other suggested improvements:

- The possibility to enter a negative height number (or option) for the turtle to dig down instead of only up. (And stopping/returning incase bedrock has been reached)

- When the turtle is done with the job and returns to the initial starting position with the chest, it does not empty itself. It only emties itself when it's full at the moment.

- A "fill holes only" mode woud be nice

- Keegras
Ryusho #18
Posted 05 July 2013 - 10:49 AM
I have seen the bug mentioned in the previous post, and I know this is a older thread, but I actually am looking to try to see if I can figure out a simple way to set a detect and dig untill block is indeed clear then place the new block setup for incase that happens, even though I have minimal Turtle programing experience, I can understand how it works, I just need to figure out the loops he has done and figure out a fix.


Well I mean, I know the basic logic to probably fix it.. I just need…to try to wrap my head around where I need to place it, ..I noticed his comment lines are in french and that…doesn't help me much since I am only an english speaker, at least I assume the comment lines are in french….*also asks a pro*
Telokis #19
Posted 05 July 2013 - 12:37 PM
Hi,

here is another version.
I discovered several bugs so I modified them.

http://pastebin.com/H6KhC9Wn

Sorry if I don't speak a lot, I have a lot of work to do. (In Real Life)
Ryusho #20
Posted 05 July 2013 - 03:57 PM
Hi,

here is another version.
I discovered several bugs so I modified them.

http://pastebin.com/H6KhC9Wn

Sorry if I don't speak a lot, I have a lot of work to do. (In Real Life)

Alright, Well, i see the wall gravel bug is still there, so I am going to have my friend look it over when he gets home, and when it is, I will add the repaired wall–ggravel bug that there is, as it is the current major issue for my own personal use.
Telokis #21
Posted 05 July 2013 - 04:29 PM
Hi,

here is another version.
I discovered several bugs so I modified them.

http://pastebin.com/H6KhC9Wn

Sorry if I don't speak a lot, I have a lot of work to do. (In Real Life)

Alright, Well, i see the wall gravel bug is still there, so I am going to have my friend look it over when he gets home, and when it is, I will add the repaired wall–ggravel bug that there is, as it is the current major issue for my own personal use.

I can't reproduce the bug. Could you detail me precisely how it happens, please ?
Ryusho #22
Posted 05 July 2013 - 09:19 PM
Hi,

here is another version.
I discovered several bugs so I modified them.

http://pastebin.com/H6KhC9Wn

Sorry if I don't speak a lot, I have a lot of work to do. (In Real Life)

Alright, Well, i see the wall gravel bug is still there, so I am going to have my friend look it over when he gets home, and when it is, I will add the repaired wall–ggravel bug that there is, as it is the current major issue for my own personal use.

I can't reproduce the bug. Could you detail me precisely how it happens, please ?

of course, I set the tunnel program to dig a 3 wide, 3 tall, and I will just say 100 long tunnel, It will work flawlessly, digging gravel out of the way of the 3x3 area it is told, in length, but if it is told to build walls/floor/ceiling what happens, is it will dig a block, and if gravel falls into the spot it dug, to place a wall block, it will stop working untill someone manually removes the gravel preventing it from placing the wall block.
Ryusho #23
Posted 05 July 2013 - 09:35 PM
My friend just was workign with it *he is a actual programmer for a game* and he went and did a lot of work so it checks for gravel and other types of blocks, makes sure to dig it out, also double checks to make sure the block type is already there before it moves on and the like it seems….from what he has said, he went and..overhauled it from my understanding, I will be testing it in a minute
Ryusho #24
Posted 05 July 2013 - 11:09 PM
My friend finished his work on the code, and this is his result if you want to use it,

http://pastebin.com/wjwkARRY
Telokis #25
Posted 06 July 2013 - 06:21 AM
Ok, thank you.

I just fixed it. Sorry for your friend but he just had to change 0.4 to 0.5 in the dig function.
Time for gravel falling is about 0.4s but it doesn't work. With 0.5s, it works perfectly (It seems, I mean).

http://pastebin.com/CA08dhhG
kyoshi #26
Posted 14 August 2013 - 12:36 AM
Sorry for bump this 1 month topic.
Did you plan to update /finish this to include torch placement ? And refuel?
Is this a dead thread ?

And i want to ask a very basic thing. How do you receive rednet on monitor ?
Sorry for this very basic question, i only install CC for 3 days, still have to learn a lot.
bluefoxy #27
Posted 30 October 2013 - 03:08 AM
so im on Midcrack 8.3.2, and its just stays at Launching !
and thats it, nothign happens. this seems like the best turtle program ever but its jsut lke hanging there…
Computercraft Version (1.5) maby its a combality issue? a fix please :D/>?
deFENCE_ #28
Posted 31 October 2013 - 03:45 AM
Nice! This is like a horizontal version of my quarry :)/>
Nice work, dude!
Telokis #29
Posted 10 April 2014 - 09:00 PM
so im on Midcrack 8.3.2, and its just stays at Launching !
and thats it, nothign happens. this seems like the best turtle program ever but its jsut lke hanging there…
Computercraft Version (1.5) maby its a combality issue? a fix please :D/>?

I think you should consider refuel manually the turtle. It is not a feature. It has to be done by yourself ! =/
Agoldfish #30
Posted 10 April 2014 - 09:30 PM
so im on Midcrack 8.3.2, and its just stays at Launching !
and thats it, nothign happens. this seems like the best turtle program ever but its jsut lke hanging there…
Computercraft Version (1.5) maby its a combality issue? a fix please :D/>?

I think you should consider refuel manually the turtle. It is not a feature. It has to be done by yourself ! =/
Is necroing allowed if you made the topic? :P/>
TommieIV #31
Posted 14 August 2014 - 08:36 PM
- I don't really know so tell me ! :D/>/>

Why dont you copy the program and make a new one that will fill a tunnel.