Main Menu

turtle stuck in loop

Started by Buzztham, Sep 15, 2020, 06:15 PM

Previous topic - Next topic

Buzztham

i wrote this program and my turtle gets stuck in a loop of placing a block up and breaking that block
sorry if i am supposed to put the code in a attachment but its not letting me do that every time i try it says
pokehole.txt Unable to create a new attachment directory. Your attachment or avatar cannot be saved. 0.6 KB

--[[while turtle.getFuelLevel() >= 8 do
 turtle.select(16)
 turtle.refuel(1)
end]]
turtle.select(1)
turtle.dig()
turtle.forward()
while not turtle.compareDown() do
turtle.digDown()
turtle.select(2)
turtle.placeDown()
if turtle.compareDown() == true then
break
end
end
turtle.digUp()
turtle.up()
while turtle.up() == false do
turtle.digUp()
turtle.attackUp()
end
turtle.select(1)
while not turtle.compareUp() do
turtle.select(2)
turtle.digUp()
turtle.placeUp()
if turtle.placeUp() == false then
turtle.digUp()
turtle.attackUp()
--turtle.select(2)
--if turtle.compareUp() == true then
--break
--end
end
end

Lupus590

Code tags are the prefered way to post code to the forums, you can either type them out or click the scroll icon with the <> on it.

Here's the manual tags, just remove the . from them

[.code]
[./code]

QuickMuffin8782

#2
The code is supposedly in a loop.
--[[while turtle.getFuelLevel() >= 8 do
 turtle.select(16)
 turtle.refuel(1)
end]]
turtle.select(1)
turtle.dig()
turtle.forward()
while not turtle.compareDown() do
turtle.digDown()
turtle.select(2)
turtle.placeDown()
if turtle.compareDown() == true then
break
end
end
turtle.digUp()
turtle.up()
while turtle.up() == false do
turtle.digUp()
turtle.attackUp()
end
turtle.select(1)
while not turtle.compareUp() do
turtle.select(2)
turtle.digUp()
turtle.placeUp()
if turtle.placeUp() == false then
turtle.digUp()
turtle.attackUp()
--turtle.select(2)
--if turtle.compareUp() == true then
--break
--end
end

Seems like you commented the break function. Try adding a specific expression for to run for, or add a way to tell if the function is done.

Like normal programs hold Ctrl+T when in the gui of the turtle.
"The Blue Blur" - Working on Net Star OS, a new frontier for Red Star OS 3.0
linktr.ee/quickmuffin8782