5 posts
Posted 12 April 2013 - 11:00 PM
i just wrote this script and it doesn't work. it should go forward 3 cut down a tree then go back to the start point and drop the wood. it doesn't work for me can someone tell me if i"m doing something wrong.
***PLZ HELP***
the code V
function reFuel()
if turtle.getFuelLevel() < 20 then
for i=1,5
turtle.refuel()
end
end
end
function uTurn()
turtle.ternLeft()
turtle.turnLeft()
end
function toTree()
for i=1,3 do
turtle.forward()
end
end
function cutTree()
turtle.dig()
turtle.forward()
while turtle.detectUp() do
turtle.digUp()
turtle.up()
end
while not turtle.detectDown() do
turtle.down()
end
end
function toHome()
uTurn()
for i=1,3 do
turtle.forward()
end
turtle.select(2)
turtle.drop()
turtle.select(3)
turtle.drop()
turtle.select(1)
end
function replantTree
turtle.select(1)
turtle.place()
end
--main script--
while true do
reFuel()
toTree()
cutTree()
replantTree()
toHome()
sleep (300)
end
125 posts
Location
Denmark
Posted 12 April 2013 - 11:15 PM
Well…
Do you get an error or is the turtle just not doing what you want it to? If you get an error please post the error.
25 posts
Posted 12 April 2013 - 11:52 PM
Works fine for me once you fix the code. It's not the most efficient tree chopper ever made but it gets the job done.
http://pastebin.com/hqrPcBNPCode:
Spoiler
function reFuel()
if turtle.getFuelLevel() < 20 then
for i=1,5 do -- you were missing a 'do' here.
turtle.refuel()
end
end
end
function uTurn()
turtle.turnLeft() -- turtle.turnLeft() not ternLeft
turtle.turnLeft()
end
function toTree()
for i=1,3 do
turtle.forward()
end
end
function cutTree()
turtle.dig()
turtle.forward()
while turtle.detectUp() do
turtle.digUp()
turtle.up()
end
while not turtle.detectDown() do
turtle.down()
end
end
function toHome()
uTurn()
for i=1,3 do
turtle.forward()
end
turtle.select(2)
turtle.select(3)
turtle.drop()
turtle.select(1)
end
function replantTree() -- you were missing the'()' here.
turtle.select(1)
turtle.place()
end
--main script--
while true do
reFuel()
toTree()
cutTree()
replantTree()
toHome()
sleep (300)
end
11 posts
Location
Venice, Italy
Posted 12 April 2013 - 11:53 PM
You forgot to put brackets in the replantTree function.
function replantTree
should be
function replantTree()
Hope it helps :P/>
If this isn't the problem, give us the error message :P/>
5 posts
Posted 13 April 2013 - 03:27 AM
thx for the help Clueless your code it fixed it :)/>
5 posts
Posted 13 April 2013 - 03:40 AM
clueless can u show me a more efficient tree logging script. plz :D/>
758 posts
Location
Budapest, Hungary
Posted 13 April 2013 - 04:18 AM
clueless
Just to clarify :D/> His name is BlackMenthol, not clueless. The name can be found in
The blue field above the actual comment…If you take a look at your comments, there's "clueless" above your avatar as well.
The more posts you have (you have 3 atm) the higher rank you have. Eg. I'm a "Coder" because I have more than 200 posts already.
1688 posts
Location
'MURICA
Posted 13 April 2013 - 04:30 AM
clueless can u show me a more efficient tree logging script. plz :D/>/>
There's a nice one on the wiki. You can edit it to suit your needs.
Just to clarify :D/>/> His name is BlackMenthol, not clueless. The name can be found in
The blue field above the actual comment…
If you take a look at your comments, there's "clueless" above your avatar as well.
The more posts you have (you have 3 atm) the higher rank you have. Eg. I'm a "Coder" because I have more than 200 posts already.
And I'm The Doctor, nice to meet you!
758 posts
Location
Budapest, Hungary
Posted 13 April 2013 - 04:31 AM