8 posts
Posted 22 December 2012 - 09:15 AM
Any help is appreciated! :)/>
term.clear()
term.setCursorPos(1,1)
turtle.select(1)
function newslot()
x = x + 1
turtle.select(x)
end
function checkslot()
if turtle.getItemCount() < 1 then
newslot()
end
print("How Far:")
input = read("*")
for d = 1, input, 1 do
if turtle.detectDown() then
turtle.forward()
else
for s = 1, 9, 1 do
checkslot()
end
turtle.placeDown()
end
end
436 posts
Posted 22 December 2012 - 09:40 AM
The only problem I see is that you never close the checkslot function.
Also, why are you checkslotting nine times in a row? It will always choose the same slot,
Checkslot would be better this way:
function checkslot()
for i = 1, 16 do
if turtle.getItemCount(i) > 1
turtle.select(i)
print("Got new slot.")
return true
end
end
return false
end
And then work to make it so if false, the program stops.
2005 posts
Posted 22 December 2012 - 12:21 PM
Post your error messages. Also, what you're trying to accomplish, and what happens instead.
You never initialize x. Thus "x = x + 1" is an error.
8 posts
Posted 22 December 2012 - 07:33 PM
Post your error messages. Also, what you're trying to accomplish, and what happens instead.
You never initialize x. Thus "x = x + 1" is an error.
How do you initialize x?
2005 posts
Posted 22 December 2012 - 07:53 PM
You assign it a value that is not itself based on x. Like: x = 0
In this particular case, you should just use Pixeltoast's function, since that eliminates the need for the newslot function which was causing an error.
If you have other errors after fixing this one, please post the error message and describe any undesired behavior.
8 posts
Posted 23 December 2012 - 04:39 AM
You assign it a value that is not itself based on x. Like: x = 0
In this particular case, you should just use Pixeltoast's function, since that eliminates the need for the newslot function which was causing an error.
If you have other errors after fixing this one, please post the error message and describe any undesired behavior.
One more question. How do you make an if statement activate when turtle.detect() is not true.
818 posts
Posted 23 December 2012 - 05:31 AM
if not turtle.detect() then