3 posts
Posted 13 June 2013 - 07:31 PM
So i made a tree chopping program and it sorta works i havent finished the tree planting part but i need help on the part where my turtle goes back to his original postion
http://pastebin.com/uGb3g1YNany help would be appriciated.
8543 posts
Posted 13 June 2013 - 08:05 PM
Split into new topic.
3 posts
Posted 13 June 2013 - 11:40 PM
Is bumping allowed
?
7508 posts
Location
Australia
Posted 14 June 2013 - 12:04 AM
In order to have your turtle move back to the "home" position you will need to track how far it has moved.
Is bumping allowed
Have a read.
7083 posts
Location
Tasmania (AU)
Posted 14 June 2013 - 04:26 AM
Funny feeling of deja vu here. You may find this thread worth a read.
http://forum.feed-the-beast.com/threads/turtle-script-problem.19631/
7508 posts
Location
Australia
Posted 14 June 2013 - 04:29 AM
Funny feeling of deja vu here. You may find this thread worth a read.
http://forum.feed-th...-problem.19631/
Why would people ask about problems with ComputerCraft on the FTB forums… especially when there are these awesome forums… some people leave me perplexed…
6 posts
Posted 15 June 2013 - 04:00 PM
First off, don't use turtle.compareUp() and turtle.compareDown() if all you want to do is see if there is a block in that direction.Use turtle.detectUp() and turtle.detectDown() instead. Also, you do not have to put the "== true" and "== false" in there as a while loop defaults to checking if the condition is true. Putting "not" in front of what you are checking will have it run while the condition is false.
Here is a simpler version of the code that should leave the turtle in the place where it started, waiting for another sapling to grow.
-- turtle digs in front and moves forward
turtle.dig()
turtle.forward()
-- turtle checks to see if there is a block above. he stops when there is nothing above him
while turtle.detectUp() do
turtle.digUp()
turtle.up()
end
-- turtle checks to see if there is a block below. he stops when there is a block below him
while not turtle.detectDown() do
turtle.down()
end
turtle.back()