Posted 14 November 2016 - 10:30 PM
I have just started fooling around with turtles and i have been having a blast! I have made a couple of basic programs, but i have had some trouble with this one. the idea is to build a huge platform in the sky.
The issue i am having is that the slot variable seems to increment regardless of what turtle.place() returns
What I would like is for the code to check if the inventory slot is empty, and if so move to the next slot.
What is happening is for every block placed it moves to the next inventory slot regardless and the loop terminates.
Thank you for your time! :D/>
The issue i am having is that the slot variable seems to increment regardless of what turtle.place() returns
What I would like is for the code to check if the inventory slot is empty, and if so move to the next slot.
What is happening is for every block placed it moves to the next inventory slot regardless and the loop terminates.
Thank you for your time! :D/>
blockPlaceLimit = 21
rednet.open("right")
function go()
local counter = 0
local slot = 1
turtle.select(1)
while counter < blockPlaceLimit and slot < 16 do
turtle.place() -------------------
if turtle.place() == false then Trouble Area
slot = slot + 1 <-------
turtle.select(slot) ---------------------
end
turtle.back()
counter = counter + 1
rednet.send(12, "=======================")
rednet.send(12, counter)
rednet.send(12,"========================")
rednet.send(12,"========================")
rednet.send(12, slot)
rednet.send(12,"========================")
end
end
go()