9 posts
Posted 20 December 2012 - 03:24 AM
Hello, I'm new in the whole computercraft mod and like it a lot,
Can someone please post a program for a single tree logger turtle, that chops the tree and then places a new sapling, bonemeal it and chop it again, for a certain amount of time or for the amount of saplings available.
From there I think I can learn it myself a lot better and understand LUA.
Thanks in advance!
799 posts
Location
Land of Meh
Posted 20 December 2012 - 03:47 AM
I would suggest to look under the turtle section of the programs section of the forums. There are plenty of tree cutting programs there. Not too sure which one would be the best… I dont usually look under that section :P/>
9 posts
Posted 20 December 2012 - 04:12 AM
ok, yeah I checked there but those are all much more advanced..
So far I got this:
while turtle.detect() or turtle.detectUp() do
turtle.dig()
turtle.digUp()
turtle.up()
end
while not turtle.detect() and not turtle.detectDown() do
turtle.down()
turtle.select(1)
turtle.place()
turle.select(2)
turtle.place()
end
But how can I make it go 10 times in a row?
Thanks, Gr
9 posts
Posted 20 December 2012 - 04:20 AM
Got that working now :
for i=1, 10 do
while turtle.detect() or turtle.detectUp() do
turtle.dig()
turtle.digUp()
turtle.up()
end
while not turtle.detect() and not turtle.detectDown() do
turtle.down()
turtle.select(1)
turtle.place()
turle.select(2)
turtle.place()
end
end
But it only works if there is a tree, block in front of him, how can I make it work so it also works if there isn't yet a tree in front of him?
7508 posts
Location
Australia
Posted 20 December 2012 - 05:31 PM
Cosa, please from now on try to use code tags around your code to make it more readable, and if possible, when it is long code to use something like pastebin, another time to use pastebin is if you have say an error at line 145, dont make us count it out, because we wont, especially when pastebin has line numbers down the side.
NOTE: these are the code tags without the spaces of course
1054 posts
Posted 20 December 2012 - 05:36 PM
NOTE: these are the code tags without the spaces of course
Damn man, do you have that on your clipboard or something? :P/> You're spreading the knowledge of code tags around as fast as rabbits breed. :P/>
2005 posts
Posted 20 December 2012 - 06:08 PM
–snip–
But it only works if there is a tree, block in front of him, how can I make it work so it also works if there isn't yet a tree in front of him?
Try reversing the order so you attempt to plant/grow a tree first and then cut it down. You could add a detect to skip the plant/grow attempt, but since both those will simply fail anyway if there is already a tree there I don't think it's too necessary.
9 posts
Posted 20 December 2012 - 11:50 PM
Ok I'll do that next time, thanks for your help.
btw, would it be possible, with the upcomming fireworks update, to write a complete firework show?
That would be nice! :)/>
7508 posts
Location
Australia
Posted 20 December 2012 - 11:52 PM
NOTE: these are the code tags without the spaces of course
Damn man, do you have that on your clipboard or something? :P/> You're spreading the knowledge of code tags around as fast as rabbits breed. :P/>
No I didn't have it on my clipboard, but for the last hour I should have!!! :P/>
818 posts
Posted 21 December 2012 - 01:32 AM
Ok I'll do that next time, thanks for your help.
btw, would it be possible, with the upcomming fireworks update, to write a complete firework show?
That would be nice! :)/>
I don't know how they would work, but if it's like rightclicking them with flint and steel, or redstone signal that would fire them, then sure
7508 posts
Location
Australia
Posted 21 December 2012 - 01:40 AM
Ok I'll do that next time, thanks for your help.
btw, would it be possible, with the upcomming fireworks update, to write a complete firework show?
That would be nice! :)/>
I don't know how they would work, but if it's like rightclicking them with flint and steel, or redstone signal that would fire them, then sure
the easiest way to test is open up the 1.4.6 prerelease and get the new CC beta and test it :)/> I will tell you one thing though, it wont be able to read what each fireworks specific effect is (which would be awesome if it could!)