Posted 01 November 2019 - 06:25 AM
I've been playing around on the Fabric 1.14.4 port for a while, and wrote a few turtle programs that so far have worked great. However, when I loaded up my 1.12.2 modpack and downloaded my programs, I'm running into a problem when the turtle hits bedrock. The "move forward" function is supposed to set a global variable "stuck" to "true" and exit the function. However, it doesn't exit the function and instead keeps looping through the "Unbreakable block detected" loop and ignoring the "return" command, and did the same thing when I changed it to use "break" instead. I checked to make sure I had the most recent version, and found out yes I do, but it's an alpha. >< Does anyone know a workaround for this?
Here's a bit of my code:
Here's a bit of my code:
function fwd(n)
local x,a,b
for x=1, n or 1 do
refuel()
stuck = false
while not turtle.forward() do
a,b = turtle.dig()
if b == "Unbreakable block detected" then
print(B)/>/> --This prints weird on the forum for some reason
stuck = true
print(stuck)
return
print(stuck)
end
end
if not stuck then
update("fwd")
end
end
end
When it hits bedrock, it prints out "Unbreakable block detected", "true", "true" over and over, showing the "return" command is ignored.