aTunnel

by: andrenoel

5 Votes15 Comments1 File (17,879 bytes)

A much better than the default "tunnel" command. The original allows "tunnel <length>". This allows "at <length> <height> <torches-every-n-blocks>" and the last 2 parameters are optional, with defaults of 3 and 8 respectively. More features mentioned below examples. Great for mining with single or multiple turtles at the same time.

examples:

> at 80
This will tunnel 80 forward, 3 high, 3 wide, and place torches every 8 blocks.

> at 200 4
This will tunnel 200 forward, 4 high, 3 wide, and place torches every 8 blocks.

> at 24 4 6
This will tunnel 24 forward, 4 high, 3 wide, and place torches every 6 blocks.

> at 24 -5 7
This will NOT seal off the ceiling because the height is a negative number.
This will tunnel 24 forward, 5 high, 3 wide, and place torches every 7 blocks.

MORE OPTIONS: (available as of version 2.0.0)

A minus sign usually reverses the option you chose. The option key words are show below. However if you are like me and forget the exact word, do not worry, guess! I have coded a good number of alternate key words for meaning the same thing as the ones listed here. For example the key word to build a wall at the end of the turnnel is "end" but you can also use these: end theend back theback thebackend backwall thebackwall wallback and walltheback. So take a guess if you dont remember or just type 'at' without parameters and press enter to see the main list of keywords.

Wall options allow creating or supressing the turtle making an outer wall/ceiling/floor/end
They are: left right top bottom end front all walls
Example: > at top left right end 50 6 8
This would tunnel 50 forward, 6 high, placing torches every 8 block, and would create a solid ceiling and walls and an end wall when it gets to the end.

Efficiency options are for supressing unnecessary actions such as filling every space once to remove any lava or other liquid source blocks. Also not placing torches when you dont feel the need. What if you are wearing a helmet with night vision and you are immune to lava with your power suit etc...
They are: -torches -antilava
Example: > at -turches -antilava 50 5
This would tunnel 50 forward, 5 high, 3 wide, make a ceiling (by default). It would not place torches, and would not forcably remove every block for liquid sources.

The width is always 3 wide for fuel efficeincy. I like to use 6 to 9 turtles in a row with 2 block spaces between each one. Then use the same parameters on each of them. It is very efficient at clearing an undergound room or even a wide and semi-tall mining tunnel. For example running them at level 11 with a height of 5 tends to get diamonds. > at 200 5
I would suggest that your left most turtle have the wall options 'left' and 'end' and the right most one have the options 'right' and 'end'. This will prevent liquids (lava/water) from coming in from the sides.

FEATURE: (minecraft-bug) I have observed that minecraft does not allow the turtle to place its blocks every time. just 99% of the time. Therefore occasionally there will be a hole in your ceiling, which can be very suprising when water comes flowing in.

There are a number of subtle features that I find helpful as well. By default it not only places a strip of flooring like the original but it also seals the ceiling 3 wide even when mining into the bottom a lake. It also occupies or fills and removes in all 3 wide block spaces which clears any water source blocks and lava source blocks there. Against lava this is very effective. Against large amouts of water, infinite water sources still get left behind. It attacks mobs in the way not just digs there. It rechecks for fallen gravel, removing it before moving on. It places torches with your spacing.

Whenever it stops RIGHT CLICK it to see its computer display and inventory. When its inventory is almost full it stops and requests clearly that room be made. When out of torches it stops and asks for more. When out of filler blocks it stops and asks for more. It will ask for more fuel if needed. It continues after refills etc. When done it returns to its start location. If you use cobblestone for fill it usually fills itself while mining. It will automatically use fuel such as coal or wood that was mined along the way. This aTunnel program has been tested at length in game.

In theory you could lay a straight track by putting train track in the torch slot then specify torches every 1 block. Or perhaps lay cables or wire... Remember that for the moment tunnel width is still 3. This is as yet untested and would probably be better with a custom script for laying such.

REMEMBER to do a "label set turtlename1" or your turtle will not remember its script when broken down for transport. Only turtles with labels can keep their files.

Feedback and refinement suggestions are very welcome.

BUG FIXED: Where it used to lap at water or lava and not move, is now fixed and tested. =) Thanks for the feedback. November 14, 2013

old version 1.0.4 available at http://pastebin.com/X9m4gQih


Premium Project Turtle Mining Turtle

Key Filename Size Options
#gjdhav at 17,879 bytes Download View/Install
Feature Matrix:
Feature Required Optional Unused
Advanced Computer Unused
Advanced Monitor Unused
Computer Unused
Monitor Unused
Disk Drive Unused
Turtle Required
Digging Turtle Unused
Felling Turtle Unused
Mining Turtle Required
Wireless Turtle Unused
RedPower Support:
Feature Required Optional Unused
Bundled Cable Unused
ccSensors Support:
Feature Required Optional Unused
ccSensors Unused
MiscPeripherals Support:
Feature Required Optional Unused
Feeding Turtle Unused
Chunk Loader Turtle Unused
Laser Turtle Unused
Resupply Turtle Unused
Solar Turtle Unused
Shearing Turtle Unused
Compass Turtle Unused
Wrench Turtle Unused
Treetap Turtle Unused
Alchemist Turtle Unused
Sign Reader Turtle Unused
REther Turtle Unused
Tank Turtle Unused
Inventory Turtle Unused
Thaum Scanner Turtle Unused
MFFS Turtle Unused
RTG Turtle Unused
Charge Station Unused
Iron Note Block Unused
Resupply Station Unused
Interactive Sorter Unused
Gate Reader Unused
Rail Reader Unused
Nuclear Information Reader Unused
Turtle Teleporter Unused
Player Detector Unused
Computer Controlled Crafter Unused
Tree Analyzer Unused

User Comments 15 Comments

This program works fantastic! Thank you SO much!

by RedFury06/19/2013 10:45:51 pm


very nice i like this mining turtle the only question or suggestion would it be to hard to modify the script to allow them to deposit into chests when they are full? Just outa curiousity o.o

by laelith43006/25/2013 01:49:52 pm


Nice job Andre, I like the fact that you use the attack command and not just assume there will be no mobs in the way. I am going to have a bit of a play with this code, I like using an ender chest to empty my turtles... If I get an elegant bit of code together, I will give it to you for inclusion.
Just on a side note I am new to Lua, but have been programming in other languages for years. I like simple to read code, and yours is quite well written.

by diligaf07/08/2013 08:17:45 pm


Maybe this is what laelith430 is looking for?

--[[ Place an EnderChest into slot 2
This code replaces the "if not freespaces then" on line 68 - 78
Removes the need for the Operator to Check if the Turtle needs to be
emptied... Haven't quite worked out how to resupply torches]]--

if not freespaces then
turtle.select(2) -- select EnderChest
turtle.placeDown() -- put down EnderChest
for i = 3 to 15
if not turtle.refuel(i) then -- check slot is not fuel
turtle.select(i)
turtle.placeDown() -- Put it in the chest
end

end
turtle.select(2)
turtle.digDown() --recover the EnderChest

end

by diligaf07/08/2013 08:38:19 pm


I'm having an issue, the script works great up and till it finds water. The turtle will get stuck mining and/or attacking water it doesn't even have to be a source block. This causes the turtle to just sit there in a loop. Please any help would be appreciated.

by turtle_addict07/21/2013 11:37:19 pm


Is there a way to make the turtle clear its inventory by itself? Maybe it could put anything other than the items in slot 1 and 16 in a chest you placed? Im a noob in lua so I dont know if thats possible or not but Its just a request. :)

by aaronthel08/28/2013 06:37:00 pm


Oops i should read all the comments before i post, tried to add the strings 68-78 from diligaf but it doesnt work, errer message: string 72 "do" expected.. any help? i tried implementing a "do" but didnt work out

by aaronthel08/28/2013 07:02:01 pm


Yes there is a water and lava issue where the turtle thinks its fighting a mob. I have thought of a solution and need to write it.

Also, yes it could put things into chest(s) for you. it would be a fairly easy addon to do that. I may yet get to that. The lava/water issue will be first.

=) Thanks.

by andrenoel11/12/2013 05:32:42 pm


Ender Chest -- the code would be easy to write to put the chest down, put things in it, and pick it back up. BUT there is a fuel issue. It uses fuel from any slot 2 to 15 and never knows where the fuel is and it also used fuel collected along the way. If you put all the fuel into the Ender Chest it would probably run out of fuel very soon. Perhaps have it keep fueled with extra in hopes of finding more on the way. Just some thoughts. feedback welcome! =)

by andrenoel11/14/2013 02:38:40 am


Water lapping loop is fixed in version 2.0.0

by andrenoel01/31/2014 03:28:47 pm


Hello andrenoel,

did i understand the turtle script correct or not?

I use a mining turtle for mining a (for example) 1000 long mine. For example i used this command:

at left right top 1000 -5

If the turtle come to lava, the lava will flood the mine, but i think i read out of your description of this script that the turtle will put (e.g. cobblestone) to "left right top" if there is lava?

by Oberlump02/06/2014 11:20:54 am


Reply to above:

> at left right top 1000 -5
would tunnel 5 tall, make left and right walls, but the parameter top is overridden by your minus sign on the -5 height so no top.
3 wide and a 1 wide strip floor are also default unless you specify otherwise.

if you do this
> at left right top 5
This would REMOVE and BLOCK ALL LAVA and put walls on the left right top and a 1 wide strip down the middle. You may see lava below on the left and right of the floor strip or at the end.

I suggest you add the parameter "end" to put an end wall on as well.
> at left right top end 1000 5

It is almost easier to do this:
> at all 1000 5
This wold put full walls on EVERY side and tunnel 1000 long and 5 high. It does leave a "door way" opening where you started that is 2 high and 1 side on the front wall.

At this length (1000) if you go away from keyboard while it is mining (afk) once the turtle gets out of active block range, something like 128 blocks away from all players, it will go inactive and stop. BUT if you stay near it then it will continue to work untill it needs serviced for fuel or inventory. I like to bring some chests with me and store things along the tunnel as I go. Or use an ender pouch/pack to send things back to my home where a computer storage system empties the ender chest there to storage.

Also I can happily manage the servicing of 9 turtles lined up side by side but leave 2 spaces between them. I prepare them all with filler, torches, and fuel then start them all in a row. Then its a matter of babysitting them as they clear a large swath. I make the left most one have a left wall and the right most one have a right wall. I make them all have an "end" wall at the far end.

If you have a mod with a trash can, it is handy to bring along for excess cobble or whatever. Or you just throw excess away from you in a pile.

by andrenoel02/17/2014 12:44:54 pm


oops "at left right top 5" should be "at left right top 1000 5" (this website doesnt allow editing for corections of comments)

by andrenoel02/17/2014 12:46:42 pm


Hey, nice program.
Is it possible to make only 1 wide tunnels? Didn't found the parameter for that.

by Steven_McWayne04/11/2014 03:29:02 pm


No width available so far. It can be done,

Resoning: Turtles use fuel only when changing location not when turning or digging. From one position it can dig to both sides of it making it 3 wide without using any more fuel. Well that was the original thought in not supporting any different widths. But clearly a width parameter of any odd number would be appropriate for this. At this time the code is only for 3 wide. I'll look into this later. Thank you.

by andrenoel06/04/2014 03:44:31 am


Leave a comment:
You must be logged in to add a comment.