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

[WIP] Optimized Mining Turtle (OMT)

Started by Viproz, 17 November 2012 - 04:59 AM
Viproz #1
Posted 17 November 2012 - 05:59 AM
Progression list :
- Doing the program
- Fix bugs
- Optimization of the code

Feature :
- Mine 1*1 tunnel and mining ore veins
- Go back when full
- Refuel (I want to do a refuel with lava but we can't detect lava with compareDown() and a lava bucket)



I post it here because I have a bug strange, I think the line 358 is not working all time, sometimes the turtle just go down and up and etc…

So here is the code on pastebin !
http://pastebin.com/x92LfbQQ

To test the code ingame just write that : pastebin get x92LfbQQ mining

You need to put cobblestone, gravel, stone and dirt in the fist 4 slots (you can check more slots modifying the nbSlotVerif var)



If you have any suggestions, tell me !


Edit :

I worked a little bit more on the bug, this is very strange, with my eyes i can find the pos but gsub or string.find() don't find it !

Console output : http://i.imgur.com/y0ip0.png

Please don't take the code, modifying it and after say it's yours.
Lyqyd #2
Posted 17 November 2012 - 06:36 AM
Can you provide any steps to reproduce the bug? Just saying it "sometimes doesn't work" won't really help us track down an intermittent bug.
Viproz #3
Posted 17 November 2012 - 06:38 AM
No, I realy don't understand when it's doing, place randoms blocks adjacent to another block adjacent to the turtle and you will see…
Viproz #4
Posted 17 November 2012 - 11:20 PM
Added a image of my bug, change the code to see the vars on output.


Edit : Bug found, don't use "-" with gsub func !
Viproz #5
Posted 18 November 2012 - 04:34 AM
New big problem, I've fixed the last one with changing the 0 with the var zero who is 1000, so when it's go left it's 999 instead of -1 BUT if I place a block on the left it will go right !

Go line 258, i put
print(width.." < "..blockAMiner[3])
It's the loop condition !
Ingame it says "1000 < 999" !

I think it's because blockAMiner[3] is a string…
But how can i change that ?
(int)blockAMiner[3] is a java line not Lua…


Please help me :)/>/>

Edit : Ho sorry, I am very stupid, tonumber() is here for that
Queso2469 #6
Posted 19 November 2012 - 02:46 PM
There seems to be an issue where it continuously tries to mine bedrock.
Viproz #7
Posted 21 November 2012 - 07:18 AM
Yes, i don't know how to fix that, mabe a blacklist of positions blocks
Queso2469 #8
Posted 25 November 2012 - 09:52 AM
Well perhaps a way of pretending that the block is just a stone block if the dig function returns false.
Viproz #9
Posted 25 November 2012 - 01:04 PM
I had installed apertune science addon on my server so i am doing the mining program with that
ChunLing #10
Posted 26 November 2012 - 07:57 AM
You can just use an empty bucket and, if true, try to refuel with it. If false, that would mean that the bucket is full of water.

If you detect something and cannot dig it, it is bedrock (or some other unbreakable block).