121 posts
Posted 06 December 2014 - 02:03 AM
Hi,
I have made my first "Complex" mining program, its not that complex really. I plan on adding allot more so i can call it a complex program :D/>.
pastebin:
Spoiler
Version 1.0.1 LvHiVELx, http://pastebin.com/LvHiVELx
- Added safty guard so if you enter a string for the tunnel length it will ask to reenter (Same for the y/n question) (Thanks to valithor for pointing this error out)
Version 1.0: x10kDL6E, http://pastebin.com/x10kDL6EVideo of my program:
https://www.youtube....f2j9orcOjYVIk4QThis is Version 1.0, I plan on releasing more updates in a couple of days.
Things to do:
- Puts Down chest when inventory is full.
- Puts torchs down.
- Says the percentage down.
- Sends rednet message to computer and works on monitor
Test my program, make suggestions and have fun!
Thanks,
-The_Cat
Edited on 06 December 2014 - 10:26 AM
1023 posts
Posted 06 December 2014 - 03:51 AM
-snip
I have not actually tested it, but after reading over it I noticed that it would likely error on line 93 for number expected received string. The read() function returns a string, so if you wish to enter a number you need to do var = tonumber(read()). That will convert what is entered to a number if it can be converted, otherwise it will return nil
edit: If it does not error, then I am sorry posted this on like 4 hours of sleep.
Edited on 06 December 2014 - 02:55 AM
121 posts
Posted 06 December 2014 - 10:23 AM
-snip
I have not actually tested it, but after reading over it I noticed that it would likely error on line 93 for number expected received string. The read() function returns a string, so if you wish to enter a number you need to do var = tonumber(read()). That will convert what is entered to a number if it can be converted, otherwise it will return nil
edit: If it does not error, then I am sorry posted this on like 4 hours of sleep.
Yes, your right it does throw back a 93 error i will try and fix that today :)/> (Love weekends :D/>)
392 posts
Posted 09 December 2014 - 12:44 AM
Also your video is private…
121 posts
Posted 11 December 2014 - 08:11 PM
Also your video is private…
Fixed now. Thanks.
1080 posts
Location
In the Matrix
Posted 11 December 2014 - 08:38 PM
Yes, your right it does throw back a 93 error i will try and fix that today :)/> (Love weekends :D/>)
The error you received was not a 93 error. It was an error on line 93. The error was, number expected got string.
40 posts
Location
Philippines
Posted 14 December 2014 - 03:27 PM
I can give bit code that may help you in Puts Down chest when inventory is full.
if turtle.getItemCount(16)>0 then -- if there is item on 16 slot then it will run this
turtle.select(2) -- slot be your slot with chest
turtle.digDown() -- dig hole where you can put your chest
turtle.placeDown() -- place the chest
for slot = 5, 16 do -- You need select slot
turtle.select(slot) -- select slot
turtle.dropDown() -- drop of item into chest
sleep(0.8) -- small fix for slow pc
end -- end for loop
end -- end if statement
and torch: just make code that count from start from mine let say 10 block then turtle turn around and select torch slot then place torch and turn around aging done
121 posts
Posted 15 December 2014 - 08:19 PM
I can give bit code that may help you in Puts Down chest when inventory is full.
if turtle.getItemCount(16)>0 then -- if there is item on 16 slot then it will run this
turtle.select(2) -- slot be your slot with chest
turtle.digDown() -- dig hole where you can put your chest
turtle.placeDown() -- place the chest
for slot = 5, 16 do -- You need select slot
turtle.select(slot) -- select slot
turtle.dropDown() -- drop of item into chest
sleep(0.8) -- small fix for slow pc
end -- end for loop
end -- end if statement
and torch: just make code that count from start from mine let say 10 block then turtle turn around and select torch slot then place torch and turn around aging done
Thanks for the code, but i changed it my self doing this:
function placeChest() -- Functions to place chest
turnAround()
for i = 1, currentLength do -- Loops to the start of the mine
tryFor()
end
turtle.select(3)
turtle.place()
for slotToDrop = 4, 16 do
turtle.select(slotToDrop)
turtle.drop()
end
turtle.select(1)
turnAround()
for i = 1, currentLength do
tryFor()
end
end
So basically this returns to the start of the mine and places a chest, this means i only need 1 chest but this can make it longer to for the turtle to mine as it has to return every time the inventory is full. Or maybe i could make it an option for the user… uhhmmmmm… :s
Edited on 15 December 2014 - 07:21 PM
29 posts
Posted 29 December 2014 - 12:59 PM
Hmm. It just mines one block below and then turns a few times and stops. I've entered a length of 10 and no stripmining.
3057 posts
Location
United States of America
Posted 29 December 2014 - 01:48 PM
Hmm. It just mines one block below and then turns a few times and stops. I've entered a length of 10 and no stripmining.
Sounds to me like you have no fuel in the turtle.
29 posts
Posted 29 December 2014 - 05:01 PM
Sounds to me like you have no fuel in the turtle.
For testing purpose fuel consumption is disabled in the computercraft.cfg
40 posts
Location
Philippines
Posted 29 December 2014 - 06:55 PM
Sounds to me like you have no fuel in the turtle.
For testing purpose fuel consumption is disabled in the computercraft.cfg
weird since i when i look at pastebin code there is not fuel checking code so if fuel disable in computercraft config it should just work
29 posts
Posted 29 December 2014 - 07:20 PM
Strange. Thanks. I'll add fuel and test again.
29 posts
Posted 30 December 2014 - 10:49 AM
Ok. Thanks. I've edited the config file in the wrong minecraft installation. Forgot I've copied it to the SSD. Sorry.
I've notice a couple of things:
- It creates the main shaft first and then starts to stripmine. I would begin the stripmining immediately to reduce the chance to run into a mob or the player while driving back and forth. This also makes a clear starting point when the program has to terminate unexpectedly.
- Then there is no inventory handling. As long you don't have a return-to-chest-and-unload or drop-chest-and-fill part in your program the bot should pause until its inventory is cleared and wait for a keystroke to continue.
- The strips are too narrow. Have two blocks between each shaft instead of one. This way you can see all the ores.
Edited on 30 December 2014 - 09:52 AM