27 posts
Posted 19 December 2012 - 01:06 PM
Hey, im a newbie at lua and i got a possible error because turtle didnt move
This is the code
function down()
if turtle.detectDown() ~= false then
turtle.down()
end
end
down()
2088 posts
Location
South Africa
Posted 19 December 2012 - 01:28 PM
Your turtle needs fuel. Add coal to slot one and in a code add turtle.refuel()
8543 posts
Posted 19 December 2012 - 02:02 PM
Also, make sure to call the function. If you declare it, but never call it, the turtle would obviously never be told to move.
27 posts
Posted 19 December 2012 - 02:03 PM
Your turtle needs fuel. Add coal to slot one and in a code add turtle.refuel()
No… I have got fuel but turtle just ignore the program
2088 posts
Location
South Africa
Posted 19 December 2012 - 02:07 PM
Is that all the code in the program you're trying to run?
27 posts
Posted 19 December 2012 - 02:31 PM
Is that all the code in the program you're trying to run?
yes… should it be:
if turtle.detectDown() == false then
turtle.down()
end
?
8543 posts
Posted 19 December 2012 - 02:38 PM
Either that, or just make sure to call the function. Which you seem to (now) do in your edited first post.
27 posts
Posted 19 December 2012 - 02:44 PM
Either that, or just make sure to call the function. Which you seem to (now) do in your edited first post.
I just forget to
put on this topic the call of the function
8543 posts
Posted 19 December 2012 - 02:46 PM
Oh, also, your original code would only have tried to move down if there were a block below it. Try this instead:
function down()
if not turtle.detectDown() then
turtle.down()
end
end
down()
392 posts
Posted 19 December 2012 - 02:55 PM
Yeah, like Lyqyd said, your program would make the turtle go down only if it DID detect a block.
You could use
if not turtle.detectDown() then
like he said, or
if turtle.detectDown() == false then
or
if turtle.detectDown() ~= true then
or maybe even
--Pretty Risky here, I honestly don't know if this would work
if not turtle.detectDown() == true then
27 posts
Posted 19 December 2012 - 03:06 PM
It work! Thanks alot guys
8543 posts
Posted 19 December 2012 - 06:04 PM
The second person's question in this topic has been moved to its
own topic.