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

Help with my Tree Chopping program

Started by Skrymir, 13 June 2013 - 05:31 PM
Skrymir #1
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/uGb3g1YN
any help would be appriciated.
Lyqyd #2
Posted 13 June 2013 - 08:05 PM
Split into new topic.
Skrymir #3
Posted 13 June 2013 - 11:40 PM
Is bumping allowed
?
theoriginalbit #4
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.
Bomb Bloke #5
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/
theoriginalbit #6
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…
AquatikJustice #7
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()