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

Automatic TreeFarm

Started by eggboy201, 25 September 2014 - 09:52 AM
eggboy201 #1
Posted 25 September 2014 - 11:52 AM
Hi guys, This i my first post here (and frankly, My first proper computercraft program, so tips are welcome to help me get better at coding).

The other day i was looking aroung for a turtle program to do automatic tree farming for me, but i could not find any that would work with bonemeal after the update that made it require multiple bonemeal, so i thought i might have a go at making my own program, Bear in mind that i only really started learning lua about a week ago so it was gonna be a big task. After spending many hours on a seemingly difficult program (probably dead simple for most of you) i finally got it to work the way i wanted it to.

All feedback welcome, and any tips to help me get better at lua (and programming in general) are encouraged.

if you would lke the program type pastebin get 7DdCS9nl <chosen name> or visit
http://pastebin.com/7DdCS9nL

Thanks,
Eggboy201.
:)/>
ProfessionalProcrastinator #2
Posted 11 January 2015 - 03:52 PM
This looks like a useful program, and simple enough that there shouldn't be any weird bugs. The only thing I see is that on lines 16, 21, and 31, you did something like this:


while turtle.compareUp() == true do

Replace "turtle.compareUp() == true" with "turtle.compareUp()", and replace "turtle.compareUp() == false" with "not turtle.compareUp()".
safetyscissors #3
Posted 14 January 2015 - 08:06 AM
Simple and does as expected. Is there a reason you didn't use your nice function?
It would be cool if you added a little to mine 2x2 wide trees. or refueled with the logs when it runs out.
Looking forward to your next program.
Edited on 14 January 2015 - 07:06 AM
civilwargeeky #4
Posted 14 January 2015 - 03:10 PM
Hey cool program! I actually made one similar to this but overcomplicated it and never released it :P/>

Since you asked for feedback, one thing that I noticed is you defined a "cutwood" function, but then just rewrote it in the code further down. You can replace your code in the main loop with "chopwood()" to cut down on lines and complexity. Either that or get rid of the "chopwood" function at the top. :)/>

Otherwise it looks really good (beside the not fueling itself bit).