Jump to content




[CC 1.4] Lettuce's Advanced Mining Programs!

turtle

19 replies to this topic

#1 Lettuce

  • Members
  • 210 posts
  • LocationIn your fridge.

Posted 24 August 2012 - 07:38 PM

*edit: Now with pictures!

This is my latest project (projects?). I wanted to utilize dan200's recent additions to ComputerCraft, most notably the turtles' ability to place items in chests. The program pack comes with three modules, and two flavors of mineshaft. The "mine" program is the best I've ever made. You choose the x,y, AND z values to give greater flexibility/freedom. The turtle places torches in all three programs to keep the mines clear of zombies and skeletons and *BLAM(s)*
A brief explanation of all is available, as well as instructions, and most importantly: CODES!

What does it do?

Spoiler

How do I use it?

Spoiler

Most importantly, the CODE:

Spoiler

Information that may or may not be important

Spoiler

I'm out of ideas, by the way. If someone thinks of a good turtle program that they want me to try making, tell me. Bugs? Tell me all about it. Happy? I'd love to hear it. I hope you enjoy this program as much as I enjoyed making it for you. :D/>
--Lettuce

#2 Matrixmage

  • Members
  • 116 posts
  • LocationAt my Computer coding for the Computer in my Computer

Posted 29 August 2012 - 05:52 AM

Seems like some pretty good programs, I'll check them out and report any unknowen bugs I find (if any of course :)/> )

P.s. with your "mine" program mining too few many blocks, I think I read somewhere that it had something to do with a bug, but you should double check about that

#3 RoseRoar

  • New Members
  • 1 posts

Posted 29 August 2012 - 11:30 PM

First off, let's be clear here, I am brand new to ComputerCraft and Turtles. >.< Seems to be a bug in the mining program, and, honestly, I have no idea how to fix. Seems the program, or Turtle, fails at handling lava. I ran the Mining program and it zipped off, ran into the side of a lava pool, and vanished utterly. >.<

Which is Turtle #2 to vanish, the first I, thinking it wouldn't work so I typed it for fun, after giving it a stack of Coal Coke, Excavate 1024. Never saw that Turtle ever again, can't even figure out where it went. :)/>

But, back to the initial problem. Lava is an issue for any deep mine when one is hunting for diamonds, so if you can think of a way for it to handle lava, be really cool to see it coded to handle it.

#4 Lettuce

  • Members
  • 210 posts
  • LocationIn your fridge.

Posted 30 August 2012 - 12:43 AM

View PostMatrixmage, on 29 August 2012 - 05:52 AM, said:

Seems like some pretty good programs, I'll check them out and report any unknowen bugs I find (if any of course :)/> )

P.s. with your "mine" program mining too few many blocks, I think I read somewhere that it had something to do with a bug, but you should double check about that

View PostRoseRoar, on 29 August 2012 - 11:30 PM, said:

First off, let's be clear here, I am brand new to ComputerCraft and Turtles. >.< Seems to be a bug in the mining program, and, honestly, I have no idea how to fix. Seems the program, or Turtle, fails at handling lava. I ran the Mining program and it zipped off, ran into the side of a lava pool, and vanished utterly. >.<

Which is Turtle #2 to vanish, the first I, thinking it wouldn't work so I typed it for fun, after giving it a stack of Coal Coke, Excavate 1024. Never saw that Turtle ever again, can't even figure out where it went. B)/>

But, back to the initial problem. Lava is an issue for any deep mine when one is hunting for diamonds, so if you can think of a way for it to handle lava, be really cool to see it coded to handle it.

Matrixmage, I hope you like it, it was a lot of work. Please report anything you find, in PMs or this topic. I would really appreciate it. If I don't know about it, I can't fix it. I assume that "mine" has a variable issue, which is why it mines the very first row weird. After that though, it's fine. I wouldn't have posted it with two errors if I thought they were major unavoidable issues.

RoseRoar, technically that's not a bug, it was never designed specifically for lava. I don't know how I might go about fixing that, but I'll look around.
I did try to make a safeguard for that. You see, when the program runs its course, and mines the last block, it's supposed to return. It also returns (and stores items) when it gets full. So I did prepare somewhat for the inevitable fire and brimstone, as your turtle should rarely lose itself or your items.

What were your variables, do you remember? If it was completely crazy, the turtle: a.) left the chunk boundary (probably what happened with excavate 1024) or b.) more likely, it ran out of fuel and is just sitting there somewhere. You should have seen the turtle eventually otherwise. It is a known issue that turtles disappear when they leave the chunk boundary. That's a ComputerCraft bug. Oh! c.) if you turned off the game, it stopped. Another Computercraft bug. In which case, it's still in the mine.

#5 Cloudy

    Ex-Developer

  • Members
  • 2,543 posts

Posted 30 August 2012 - 10:18 AM

View PostLettuce, on 30 August 2012 - 12:43 AM, said:

b.) It is a known issue that turtles disappear when they leave the chunk boundary. That's a ComputerCraft bug. Oh! c.) if you turned off the game, it stopped. Another Computercraft bug. In which case, it's still in the mine.

b.) That was fixed in ComputerCraft 1.4 as far as I know. I couldn't reproduce it after putting in a fix. By all means if you can reliably reproduce it with instructions let me know, and I'll fix it if it does exist.

c.) Not a bug - it's just how it works. We are looking to change that for future versions though.

#6 Luanub

    Lua Nub

  • Members
  • 1,135 posts
  • LocationPortland OR

Posted 19 September 2012 - 10:35 AM

View PostRoseRoar, on 29 August 2012 - 11:30 PM, said:

But, back to the initial problem. Lava is an issue for any deep mine when one is hunting for diamonds, so if you can think of a way for it to handle lava, be really cool to see it coded to handle it.

Lava should not be an issue. Turtles are not affected by liquids, they will move through lava like it isn't there.

#7 slango20

  • Members
  • 43 posts

Posted 07 October 2012 - 12:41 PM

Put the code in code tags please, it is hard on my eyes to see code that's not color rendered
[code]
[/code]

#8 Lettuce

  • Members
  • 210 posts
  • LocationIn your fridge.

Posted 07 October 2012 - 11:35 PM

This post was made when I was relatively new to the forums. I forgot/didn't know about code tags at the time. I'll be re-posting this at a later point in time, for undisclosed reasons. I'm sorry it hurts your eyes. I've now posted 160 - some times at time of writing, so I know about them, I just never looked to see if I code tagged this.

I still stand by this program though, and I use it myself every time I play ComputerCraft.

#9 peteleeb44

  • New Members
  • 1 posts

Posted 13 October 2012 - 12:33 PM

Hi all. I read you were concerned with lava. If you keep your mine shaft a reasonable size, i don't go over a 9x9 block, then place a water block somewhere. No lava and chances are you will get some obsidian out of it too.

Just sayin.

#10 ChunLing

  • Members
  • 2,027 posts

Posted 13 October 2012 - 02:59 PM

It also obviates the need for autoplacement of ladders (and obviates the utility of placing torches). For best results, place the water block on the top of a flat layer that the turtle will mine away, and the water stream will fill pretty much the entire shaft.

I've found that the[Turtle] Replacement for `go` utility posted bytele_iz_dva4a can handle these kinds of basic tasks. My own version is better suited to my needs (and can be activated and run remotely).

A note on code, the function:
function moveForward()
repeat
turtle.dig()
until turtle.forward()
end
is serviceable in most cases, but it is a little inefficient and has a serious flaw when encountering bedrock or a mob. First, you should use a while turtle.forward() test so that it tries to move the turtle first, and only digs if it can't move. Second, you need some kind of check to prevent an infinite loop if it hits something that blocks movement but can't be mined. Third, you need a startup program that lets you control your turtle remotely, so you can recover it if it ends up stuck against bedrock at the bottom of a pool of lava :)/>

#11 Lettuce

  • Members
  • 210 posts
  • LocationIn your fridge.

Posted 13 October 2012 - 03:58 PM

peteleeb44, ChunLing, thank you for trying to help everyone avoid lava. Your methods clearly work, and I don't know how to make the turtle avoid it, so some player intervention is needed, I suppose.

ChunLing, thanks for teaching me a new word. I had to look that up in a dictionary to know what you meant. Obviate essentially means "to circumvent danger" which is fitting in a discussion about lava, but why are ladders and torches dangerous? Both help. One prevents a nasty fall, the other prevents a nasty explosion.

While and repeat will do basically the same thing, in fact repeat is probably about a tenth of a second faster, because it breaks before checking if it can move, since there's probably stone in front of it. If a mob steps in front of it, it will probably move eventually, and the turtle would continue like nothing happened. I advise digging at least one block above the bedrock layer though. You still get your diamonds, and that deep down lava is surprisingly rare. I have a mine 11 blocks wide, 5 blocks high, and probably 200 blocks deep by now, and only encountered one lava flow, which was easily fixed.

It sounds like you have some good ideas for this program though, and I'd like to read them. Please PM me, if I use any of your ideas in the big bugfix I have planned, I'll credit you.

--Lettuce

#12 ChunLing

  • Members
  • 2,027 posts

Posted 13 October 2012 - 05:45 PM

The need for ladders is what is dangerous (i.e. a long fall). But the other usage, "obviating the utility/benefit/beauty/truth/etc." is slightly ironic, there merely to provide poetic balance. Though, in truth, water also obviates the need for torches, since hostile mobs can't spawn in water.

I also generally prefer repeat until to while do end, but in the case of a general movement function (as opposed to a specialized mining function), it makes sense to test for movement before attempting to break, particularly as when movement fails I detect to see if there is a block before breaking it, so that I can tell the difference between a gravel fall that can be overcome with a few more tries, bedrock which cannot be mined no matter what, and a mob that must be attacked (or out-waited) rather than mined.

I don't have a specialized mining function or program, I just use my general movement/building functions (particularly gox, based on tele_iz_dva4a's advanced go replacement program). You can find the full code of my basic turtle control program in the post User Friendly Program combining several useful functions.

#13 Lettuce

  • Members
  • 210 posts
  • LocationIn your fridge.

Posted 13 October 2012 - 06:22 PM

I'd prefer to keep my programs working for "out of the box" ComputerCraft, and not to use API's that players may not have, just to spare myself some frustration.

I think moveForward() is efficient enough, and I'd rather the turtle be perfectly harmless even if the player or his/her precious, precious pig steps in front of it. I don't know how to detect bedrock, or lava. But thank you for trying to help.

--Lettuce

#14 ChunLing

  • Members
  • 2,027 posts

Posted 13 October 2012 - 06:54 PM

The programs I posted there have that exact goal in mind, being fully functional without needing any additional API's or knowledge of the system. Using GoX properly requires an understanding of loops (well, you can use it without the loops but the loops are the best part of the program), but only at the simplest level. I further designed them to run without command line parameters, but changed the turtle package to allow them so that you can have a turtle always enter remote control mode on startup.

#15 Czarified

  • Members
  • 45 posts

Posted 18 October 2012 - 02:08 AM

Hello. Your program's seem like exactly what I'm looking for. I installed them on my server, but when I try and run them (inputting the commands and values correctly and placing objects where they're supposed to go), my turtle doesn't do anything.

The command window says
mine:34: Attempt to compare number
with string expected. got number

However after that it just sits there. What am I doing wrong?

Could this have something to do with the check.fuel() function? I have fuel disabled on my server.

#16 Lettuce

  • Members
  • 210 posts
  • LocationIn your fridge.

Posted 18 October 2012 - 02:24 AM

Czarified, I received a PM from someone else a while ago, who was having trouble with something completely different, as a result of copy/pasting wrong. He accidentally cut off a small portion of the code. Please copy the code again, and if you are still having trouble, PM me. I'll be glad to help.

#17 ahbeef

  • New Members
  • 2 posts

Posted 19 October 2012 - 03:50 AM

getting an error on line 9 saying "stairshaft:9: attempt to call nil"
what do i do?
also: where are slots 14, 15, and 16? I am very confused about where to put the coal, torches, and cobble.

#18 ahbeef

  • New Members
  • 2 posts

Posted 19 October 2012 - 03:54 AM

P.S. i did not copy and paste, because copying and pasting was giving me issues, so i copied it by hand and triple checked for spelling errors.
P.P.S. this is about the stairshaft one, sorry for not mentioning that earlier.
Also, is there a way to activate this using a wireless mining turtle and a computer with a wireless modem attached to it from the computer? if so, please tell me i would love to do that!
Thanks for the help!

#19 ChunLing

  • Members
  • 2,027 posts

Posted 19 October 2012 - 07:03 AM

Well, attempt to call nil errors are almost always from a typo, I bet the line is turtle.getFuelLevel(). You probably didn't capitalize the F or the L. Lua is case sensitive, but often our "proofing" eyes are not.

I'm thinking of adding a "shell.run("input line")" command to my remote turtle. Or rather someone else thought of it and I don't object. But I find it simpler to just use the gox command system for most things, and remote support for that is already built in. The gox system (totes props to tele_iz_dva4a, the original author) is very flexible even though the command strings are somewhat limited.

#20 Lettuce

  • Members
  • 210 posts
  • LocationIn your fridge.

Posted 19 October 2012 - 06:12 PM

ahbeef, because you said you didn't know where slots 14, 15, or 16 were, I'm assuming you use CC 1.3, this code is meant for 1.4, where fuel came into play. Otherwise, the program simply doesn't work. If you are playing on tekkit, your version is 1.3. If you are not on 1.3, however, I welcome you to PM me.

No, I have not added wireless capabilities, but that is a very good idea, and I might add that at some point in time. Thank you for your inadvertent suggestion.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users