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

Variable Size Logger

Started by civilwargeeky, 17 January 2013 - 02:01 PM
civilwargeeky #1
Posted 17 January 2013 - 03:01 PM
Hello everyone. About a month ago, I made a logging program on a very basic server out of necessity. After about 6 hours of planning and coding, it turned into this. So what it is, is a configurable, and very reliable tree farm.

Features:
  • Any size of tree farm that you want. Only limited by what the turtle can hold and how much fuel you can pack in.
  • Automatic setup if desired
  • Can place wood in pickup chest
  • Automatically picks up saplings that are in it's path to improve self-sufficiency
  • Configurable space between saplings
  • While running, shows fuel usage when mining trees
  • When done, gives report on logs mined and ending fuel.
  • Now refuels itself! Place a furnace one to the right and one above, and it will automatically fill itself with charcoal!(after setting config)
  • More config options! Can now specify space between columns *and* individual trees instead of a generic variable.
  • More time and fuel efficient: Will now go through the trees instead of beside them
Coming Soon:
  • Any Suggestions?
Drawbacks:
  • None as far as I know
Use:
  • Mainly, see the video otherwise (in brackets are optional):
If initial:
FullLogger initial [rows] [columns] [space]
Otherwise:
FullLogger [rows] [columns] [space]
Also add the argument "fuel" or "refuel" anywhere to make it use the new refuel feature

Download:
http://pastebin.com/WdPWbBV1
Optional Startup Script:
http://pastebin.com/ng0vKdxr



Video:
[media]http://youtu.be/xd0rTuurXS0[/media]

Old Versions:
Spoilerhttp://pastebin.com/VMQCkDzn – Version 1.2.5
http://pastebin.com/bw4MJaG1 – Version 2.0
http://pastebin.com/YEebH5LP – Version 2.1 (small mistake stops initial fueling)
http://pastebin.com/LcZ6TFLh – Version 2.2.3
Edited on 12 November 2013 - 04:11 PM
DZCreeper #2
Posted 23 January 2013 - 06:05 PM
Cough, Cough.

Sorry, don't mind me. Just having some breathing issues with my turtles burning coal instead of wooden planks.

Perhaps, just maybe, you could have this program require a crafty mining turtle, that way it can craft wooden planks to fuel itself. Chests would be required as well, cause with crafty turtles, you have less space to hold stuff.
syko573 #3
Posted 24 January 2013 - 03:28 PM
Cough, Cough.

If you have MiscPeripherals you can go totally green.


Good work on the program ironically I made something similar to it yesterday but scrapped it and went with a single huge fir with figure less work. First time actually trying to program turtles instead of pulling files from others.
DZCreeper #4
Posted 24 January 2013 - 08:03 PM
I know about solar turtles, but those require solars. I think most people are using logging programs to get fuel till they get to that point.
civilwargeeky #5
Posted 26 January 2013 - 05:31 PM
Ok… I guess I could make it burn planks. It would probably be more efficient for it to make its own charcoal but whatever. However, if it made planks then it wouldn't be able to be called from rednet with a wireless turtle. But I said I'd code it if people asked, so I will probably get that done before next friday.
RabidCrab #6
Posted 27 January 2013 - 08:32 PM
Any size of spacing greater than 2 will cause the bot to return to the incorrect location X-wise. The Y and Z coordinates are correct though.
tdlab #7
Posted 28 January 2013 - 07:24 AM
No charcoal making and self fueling. (If people really want that, it wouldn't take that much to code)

Could you do that? It would be awesome :)/>
civilwargeeky #8
Posted 28 January 2013 - 08:17 AM
Any size of spacing greater than 2 will cause the bot to return to the incorrect location X-wise. The Y and Z coordinates are correct though.
Heh. Derp on my part. On line 316 change
for i=1, 3 do 
to
 for i=1, space+1 do
That should work. Sorry I can't change the pastebin atm.
civilwargeeky #9
Posted 28 January 2013 - 08:18 AM
No charcoal making and self fueling. (If people really want that, it wouldn't take that much to code)

Could you do that? It would be awesome :)/>/>
Sure. I'll try to do it before the end of the week. Whenever I get a chance to code, that will be the first thing I do.
tdlab #10
Posted 28 January 2013 - 11:01 AM
No charcoal making and self fueling. (If people really want that, it wouldn't take that much to code)

Could you do that? It would be awesome :)/>/>
Sure. I'll try to do it before the end of the week. Whenever I get a chance to code, that will be the first thing I do.

Awesome! Thank you!
Gili710 #11
Posted 29 January 2013 - 11:05 AM
Looking at your video, couldn't you cut down a lot on fuel consumption during the 'initial' run by using placeDown() instead? Now it moves down and up an extra time for each sapling. You'd have to differentiate the code for placing and chopping but that's not a big deal since it's just a 1 block offset.

Same when it chops, it can save two moves per tree by chopping up first, then coming all the way down and placing the sappling as it cuts the bottom block. Or do it the way you're doing it now, but have it place a sappling as soon as it cuts the bottom block, then cut the rest of the tree.

Might not seem like a lot, but it adds up. On a five block high tree, it's a 10% efficiency increase :)/> Then again, actually checking for trees would probably save a lot more fuel and really wouldn't be very difficult to do with turtle.detect()

But nice work on the code :)/>
civilwargeeky #12
Posted 29 January 2013 - 12:15 PM
Looking at your video, couldn't you cut down a lot on fuel consumption during the 'initial' run by using placeDown() instead? Now it moves down and up an extra time for each sapling. You'd have to differentiate the code for placing and chopping but that's not a big deal since it's just a 1 block offset.

Same when it chops, it can save two moves per tree by chopping up first, then coming all the way down and placing the sappling as it cuts the bottom block. Or do it the way you're doing it now, but have it place a sappling as soon as it cuts the bottom block, then cut the rest of the tree.

Might not seem like a lot, but it adds up. On a five block high tree, it's a 10% efficiency increase :)/> Then again, actually checking for trees would probably save a lot more fuel and really wouldn't be very difficult to do with turtle.detect()

But nice work on the code :)/>
Ha. Yeah. If you *really* want to know, my longer term goal is to improve the program in both fuel efficiency and time by having it go over the sapling to detect for a tree instead of going to the side of it. This would also allow me to better implement move commands and I will probably make a spaceX and spaceY variable. But that would take more time than have these days, so it will probably get done by the end of next month (my quarry program restructure comes first).

You know, getting better at programming is a real hassle :)/>
civilwargeeky #13
Posted 30 January 2013 - 01:50 PM
New update out!

It now will self fuel (if so desired), and go through the trees instead of around them. Will be uploading a video later, but to use the furnace, place it one block to the right, and one block above the turtle, then change the config to say doRefuel = true (or something along those lines). It will take wood from slot 2, puts fuel in slot 16, and has a reserve to restart the furnace in slot 15. You can also specify that you are using an electric furnace, and it won't try to place fuel in the bottom. It works with Vanilla, UE, and IC2 furnaces (not RP2 though)
civilwargeeky #14
Posted 31 January 2013 - 03:03 PM
Small update. I got around to using the program myself in SSP, and realized that it didn't exactly start the whole refueling chain by itself, so now if it has more than 7 logs and no charcoal, then it will begin the self fueling process with a few logs. Also, don't forget that self-fueling is turned off by default, but can be turned on in the program's config, or with the argument "fuel" or "refuel" anywhere in the arguments
25hz #15
Posted 16 October 2013 - 06:50 PM
Very cool script, thanks for all the effort. Hopefully you are still reading this thread, as I have a question/suggestion.

Is it possible to put the script on a timer so that you can set it to auto-run every X amount of time(likely to time it in seconds, not minutes)? I looked at it and was going to try to splice in some timer code from another script, but I couldn't be sure where to put the code, so it didn't work at all.

Thanks
civilwargeeky #16
Posted 16 October 2013 - 07:36 PM
Very cool script, thanks for all the effort. Hopefully you are still reading this thread, as I have a question/suggestion.

Is it possible to put the script on a timer so that you can set it to auto-run every X amount of time(likely to time it in seconds, not minutes)? I looked at it and was going to try to splice in some timer code from another script, but I couldn't be sure where to put the code, so it didn't work at all.

Thanks
Yeah, sure. Just make another file, and say
sleep(amount of time in seconds)
shell.run("logger","initial if you want","dimensions maybe","they go here")
Also, I have an updated version of this for you to use. I will put it in the OP. It isn't really at the high standard I want for it now, but that will come later. This update allows it to work properly with post-1.4.7 furnaces.
Thank you for taking interest in this :D/>
Its been awhile.
25hz #17
Posted 17 October 2013 - 07:58 AM
Awesome! Very simple way to do it. I'm disappointed I didn't think about calling it from another script. Thanks again :)/>
25hz #18
Posted 19 October 2013 - 01:59 PM
Thanks for the suggestion, it works great. The little loader script was named startup, so that any time the turtle or chunk or server reloads/restarts/reboots, it automatically runs the script. It only runs once though and then exits, so I edited the script to run the following:

while true do
sleep(180)
shell.run(fullLogger)
end

I set it for 3 minutes so that it could scoop up the saplings before they despawned. That code worked, but every time it would cycle through the script to the top again, it would offset the turtle's starting position by one block to the left. No idea why.

So, I changed it to this:
repeat
sleep(180)
shell.run(fullLogger)
end

This works fine and there is only a positional glitch if/when the chunk unloads from memory. When I come back, I can find the turtle anywhere in the area. I guess that's to be expected when chunks load and unload from memory. Not really a problem as I slightly modded a script from another guy that will sent a turtle back to a specific x,z,y coordinate from anywhere else. I still need to tweak that script so it prompts for the x, z, y and facing direction information, but I haven't learned how to do that yet, so I still have to quickly edit the script manually. I'd also like to be able to print out the wait timer to the turtle's UI screen so you can see how much time is left before it runs it's pattern, but I haven't learned how to do that yet (if it can even be done). I'd also like to add some extra code to the startup script so it could run a position check against where it should be, and then it could run the xzy script, reposition itself, and then run the tree farm script. I'm not sure if the turtle can tell what it's cords are without a gps setup though. Need to learn more about the gps too.

Also, unless the saplings were directly in the path of the turtle, they wouldn't get picked up. So I made a water collection system for the 20 tree grid and now there is no problem retrieving nearly 100% of the saplings. Anyway, great script - thanks for coding it :)/>
Expenox #19
Posted 19 October 2013 - 02:08 PM
This is really nice, I wish mine would have turned out like this! Keep up the great work!
Landstryder #20
Posted 28 October 2013 - 11:07 AM
nice program!

I've made some changes to this and would like to include it in a CC software package I'm developing. Of course I've left full credit to you for concepts. here is pastebin code to my first revision hpMgeeNG v0.9 and I'm nearly ready with 0.91 that will include 3 zones for planting spruce, rubber, and force trees (or what ever combo of trees you like)
civilwargeeky #21
Posted 28 October 2013 - 04:43 PM
nice program!

I've made some changes to this and would like to include it in a CC software package I'm developing. Of course I've left full credit to you for concepts. here is pastebin code to my first revision hpMgeeNG v0.9 and I'm nearly ready with 0.91 that will include 3 zones for planting spruce, rubber, and force trees (or what ever combo of trees you like)
Nice! Thanks for letting me know. I look forward to seeing where this will go :)/>
AliveGhost #22
Posted 29 October 2013 - 05:55 PM
Hey,

When I run the program (using the refuel function) I get attempt to concacenate string on line 428 - can I get some help?
Also, it doesn't want to seem to refuel using the refuel function.
Otherwise awesome program! :D/>

Cheers,
AG
civilwargeeky #23
Posted 29 October 2013 - 09:48 PM
Hey,

When I run the program (using the refuel function) I get attempt to concacenate string on line 428 - can I get some help?
Also, it doesn't want to seem to refuel using the refuel function.
Otherwise awesome program! :D/>

Cheers,
AG
Forgot to initialize a variable. Should work: http://pastebin.com/L15wm4ic
Also, what do you mean by "it doesn't seem to refuel using the refuel function" ? Like, it doesn't properly find a furnace, or it never refuels itself?
AliveGhost #24
Posted 30 October 2013 - 05:30 AM
It never refuels itself, the fuel is below 1000 and the furnace is placed but it simply doesn't use it.
civilwargeeky #25
Posted 30 October 2013 - 01:36 PM
It never refuels itself, the fuel is below 1000 and the furnace is placed but it simply doesn't use it.
Hmm.. Thats odd. It should always ask for fuel if it is below the specified amount. I'm pretty sure that it will also only use the furnace if its fuel is at the point where it would ask for fuel the next time. So make sure you are using the "refuel" parameter or changing the variable at the beginning, and also that your turtle is low on fuel. Otherwise it shouldn't try to refuel using a furnace.
Landstryder #26
Posted 05 November 2013 - 05:37 PM
ok not trying to hi-jack you post but you said you wanted to see where where my diversion of your programs goes… here is the pastebin.com/v1FeFNz5 for Super Tree Logger v0.91 based on your original program. Much of the flexability has been removed and some sorting and refueling changes have been made in adition to the fact it start at a base away from the actual tree farm. Sap's are piped back into the bot directly and he uses a chest kept in slot 15 to hold his place while he harvests. he dumps wood (and rubber and force nugets, etc..) into one chest sorts out extra saps into another and refuels from a third placed around him at his start point. He's been optimized to stay inside of the area kept active by a admin ancor if placed at the right location. He actualy works in tandom with a Super Farm Bot program that was my first solo program (pm me if you want hte pastebin for that) and I ended up making a fuel helper to sort the crops, logs, etc.. and keep fuel in the chest for the other 2.

working on v0.92 now :)/>
Nujugi #27
Posted 12 November 2013 - 08:22 AM
Can you make it loop with a interval?
civilwargeeky #28
Posted 12 November 2013 - 05:10 PM
ok not trying to hi-jack you post but you said you wanted to see where where my diversion of your programs goes… here is the pastebin.com/v1FeFNz5 for Super Tree Logger v0.91 based on your original program. Much of the flexability has been removed and some sorting and refueling changes have been made in adition to the fact it start at a base away from the actual tree farm. Sap's are piped back into the bot directly and he uses a chest kept in slot 15 to hold his place while he harvests. he dumps wood (and rubber and force nugets, etc..) into one chest sorts out extra saps into another and refuels from a third placed around him at his start point. He's been optimized to stay inside of the area kept active by a admin ancor if placed at the right location. He actualy works in tandom with a Super Farm Bot program that was my first solo program (pm me if you want hte pastebin for that) and I ended up making a fuel helper to sort the crops, logs, etc.. and keep fuel in the chest for the other 2.

working on v0.92 now :)/>
Oops, just realized I forgot to reply to you! I'm glad to hear that you are working on it. I also looked at your forum thread and think that your plan is really interesting. If you want, I could test out your programs and give you some feedback.

Can you make it loop with a interval?
Certainly. I took the liberty of making one for you. Just change the variables at the top to what you want. http://pastebin.com/ng0vKdxr.
If you name it startup, it will run every time the server turns on or its chunk is loaded. I'll put this in the op as well.
Nujugi #29
Posted 13 November 2013 - 07:48 AM
Thanks civilwargeeky :D/>
Nujugi #30
Posted 13 November 2013 - 08:51 AM
I had a problem:
When it getting sapling with the startup, it filled the inv full.
So no rom for logs.

So I edit in this instead:
for i = 1, 2 do –Pull 128 saplings out of the chest
turtle.suck() end
turtle.select(3)
turtle.drop()
turtle.select(4)
turtle.drop()
turtle.select(1)

Then it always start with 128 saplings.
Edited on 13 November 2013 - 08:23 AM
Nujugi #31
Posted 13 November 2013 - 09:42 AM
The biggest problem now is that it don't pick up enough saplings.

So maybe it should look for sapling in them rows where the are no trees?
civilwargeeky #32
Posted 13 November 2013 - 08:10 PM
The biggest problem now is that it don't pick up enough saplings.

So maybe it should look for sapling in them rows where the are no trees?
If you wanted it to pick up as many saplings as possible by going over them, you could just set "spaceX" to "space" and "spaceZ" to "0" This will make it go over every row. The only thing is that you won't be able to use "initial" with this
robottthing #33
Posted 15 January 2014 - 09:15 PM
Personally I think they should put a death lazer so the turtle so it doesn't have to move :)/> ;0 X(
TilionDC #34
Posted 20 February 2014 - 06:03 PM
why didn't you use the read() function to make it easier to costumize rows? You can ealisy use tonumber() function to make the string from read() to an interger
civilwargeeky #35
Posted 21 February 2014 - 09:23 PM
why didn't you use the read() function to make it easier to costumize rows? You can ealisy use tonumber() function to make the string from read() to an interger
You mean like a gui when you start? Yeah, I could do that.
We'll see if I do it when I next get around to coding. Added to to-do
Zoidy #36
Posted 25 April 2014 - 02:41 AM
I's love to see a farming variation of this program for like carrots, potatoes, wheat and cotton. Maybe pumpkins and melons too. Cant seem to find a decent turtle farm program =/
civilwargeeky #37
Posted 25 April 2014 - 03:10 AM
I's love to see a farming variation of this program for like carrots, potatoes, wheat and cotton. Maybe pumpkins and melons too. Cant seem to find a decent turtle farm program =/
Hmm. That sounds cool. You'd think that there would be a good one out there, considering there is a "farming turtle"
I know that this really doesn't guarantee quick completion, but I will certainly try to do a cool farming program. Right now I'm going to focus on my quarry when I finally get time to code again.
I have a lot of things that I am planning on doing right now…
https://github.com/civilwargeeky/Civils_Progs/blob/master/ToDo%20and%20Ideas.txt