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

Safetunnel, a tunneling program that protects you

Started by Justinjah91, 25 March 2015 - 03:53 AM
Justinjah91 #1
Posted 25 March 2015 - 04:53 AM
Hello all,

I've created a program that is similar to the default tunneling program on the turtles, except that it mines a 3x3 instead of a 2x3. When the default tunneling program mines through lava and other hazardous locations, it does not block off the sides of the tunnel. Instead, any lava, water or mobs that wish to enter the tunnel are free to do so. My program will mine out a 3x3 tunnel, but will also block off any openings that would allow nasty liquid or undead fiends to enter the tunnel. In addition, it will also mine any exposed ore out of the walls of your tunnel.

Setup:
In slot 1 (top left), place whatever material you want the turtle to check the walls for. If mining underground, smooth stone is a great choice here. If you choose smooth stone for slot 1, the turtle will check each piece of wall, ceiling and floor to see if it is smooth stone. If it is, then the turtle will leave it alone. If not, the turtle will replace the non smooth stone block with whatever you put in slot two (row 1, column 2).

In slot 2 (row 1, column 2), you should place whatever material with which the turtle should fill in holes. Cobblestone is my personal favorite, as I rarely have to refill the turtle's stocks while mining underground. Anywhere that the turtle finds ore, lava, water, or just open space will be replaced with whatever is in this slot. For example, if you used smooth stone in slot 1, and cobblestone in slot 2, you would end up with a 3x3 tunnel with walls, ceiling, and floor made of ONLY smooth stone and cobblestone.

In slot 16 (bottom right), place torches. The turtle is programmed to place down a torch every now and then to prevent mobs from spawning in the tunnel. Once the turtle is finished, every other torch may be removed and the tunnel will remain safe. I have the turtle place more torches than necessary to ensure that mobs do no spawn while it is mining.



This program is capable of handling gravel, sand, water, lava, and mobs, but not bedrock, so don't take it below level 6. The only thing that may cause it to mess up is if it runs out of material in slot 2. If the turtle runs out of material at the same time as it picks up a different type of material, it will use that different type of material to fill in holes. If it simply runs out of material, it will stop and wait for you to load more.

Disclaimer: I am by no means an expert programmer. I have only just begun learning programming, so if you have any tips regarding optimization of my code, then please share them with me. I am currently working on a program that will allow the user to specify dimensions for a room to excavate, but am currently stuck on that. Any suggestions would be greatly appreciated.


https://www.dropbox.com/s/d3qr5d8861dmcxi/Safetunnel?dl=0
Edited on 25 March 2015 - 06:34 PM
Picksme #2
Posted 13 April 2015 - 01:45 AM
Looks useful! Very nice.
Nextactus #3
Posted 27 April 2015 - 06:00 AM
decent program. It a nice set and forget tunneler. i normally run multiple tunnelers at once and it nice to not have to wade through lava or water that comes into the tunnel. My 2 cents worth of feedbakk is to upload the program to pastebin and post it here, so we can just get it directly in game.
HPWebcamAble #4
Posted 28 April 2015 - 12:14 AM
Like Nextactus said, you should upload this to pastebin

Then, in game, anyone can run this command to download it:

pastebin get <CODE> <name>
CODE is the code after the pastebin url (www.pastebin.com/CODE)
name can be what ever you want
Ulyeney #5
Posted 07 May 2015 - 03:56 AM
http://pastebin.com/0AYRpF7m
buzztham1 #6
Posted 13 May 2015 - 11:16 PM
Hello all,

I've created a program that is similar to the default tunneling program on the turtles, except that it mines a 3x3 instead of a 2x3. When the default tunneling program mines through lava and other hazardous locations, it does not block off the sides of the tunnel. Instead, any lava, water or mobs that wish to enter the tunnel are free to do so. My program will mine out a 3x3 tunnel, but will also block off any openings that would allow nasty liquid or undead fiends to enter the tunnel. In addition, it will also mine any exposed ore out of the walls of your tunnel.

Setup:
In slot 1 (top left), place whatever material you want the turtle to check the walls for. If mining underground, smooth stone is a great choice here. If you choose smooth stone for slot 1, the turtle will check each piece of wall, ceiling and floor to see if it is smooth stone. If it is, then the turtle will leave it alone. If not, the turtle will replace the non smooth stone block with whatever you put in slot two (row 1, column 2).

In slot 2 (row 1, column 2), you should place whatever material with which the turtle should fill in holes. Cobblestone is my personal favorite, as I rarely have to refill the turtle's stocks while mining underground. Anywhere that the turtle finds ore, lava, water, or just open space will be replaced with whatever is in this slot. For example, if you used smooth stone in slot 1, and cobblestone in slot 2, you would end up with a 3x3 tunnel with walls, ceiling, and floor made of ONLY smooth stone and cobblestone.

In slot 16 (bottom right), place torches. The turtle is programmed to place down a torch every now and then to prevent mobs from spawning in the tunnel. Once the turtle is finished, every other torch may be removed and the tunnel will remain safe. I have the turtle place more torches than necessary to ensure that mobs do no spawn while it is mining.



This program is capable of handling gravel, sand, water, lava, and mobs, but not bedrock, so don't take it below level 6. The only thing that may cause it to mess up is if it runs out of material in slot 2. If the turtle runs out of material at the same time as it picks up a different type of material, it will use that different type of material to fill in holes. If it simply runs out of material, it will stop and wait for you to load more.

Disclaimer: I am by no means an expert programmer. I have only just begun learning programming, so if you have any tips regarding optimization of my code, then please share them with me. I am currently working on a program that will allow the user to specify dimensions for a room to excavate, but am currently stuck on that. Any suggestions would be greatly appreciated.


https://www.dropbox....Safetunnel?dl=0
nice program only thing that would be nice to have added to it is a return to start point to put stuff in a chest
ShoeLace1291 #7
Posted 16 January 2020 - 11:40 PM
I went to try this script but it just mines one block and then stops.