http://pastebin.com/j48M7FN2
Alright here's more details..
The above is a sugar cane farming script, it harvests each rows then comes back to its start and drop off the canes.
It also keeps a glass cube to compare with that it is digging to prevent it from running away, since it has glass walls all around.
The farm itself is well covered by a chunk loader (max range chunk loader) and I even installed another one just for that farm in case something went wrong with the first one.
I also made sure nothing can sneak in my farm, no passives nor hostiles.
My turtles never run into anything else than sugar canes and empty blocks.
The problem is, it works great when i'm online, even if i'm very far away but the moment I log off, even though the server is still on, my turtles goes crazy and either corrupts its programming by changing its patterns or gets stuck in a loop and digs forever forward. Which is why I implemented the perimeter detection..
Now I know my script is just fine! It worked all day long (played for more than 12 hours without a problem) but the moment I logged off to go to sleep they stopped working correctly. (Running into walls; digging where it shouldn't)
There might be solutions when it comes to my script, like implementing a GPS system but at that point i'd rather just stay logged on instead..
I'll listen to all suggestions but I'd prefer the focus to not be on how to get around the problem but on what is causing it.
I was thinking, the excavate script works great, even when offline. So perhaps there's something i'm using in my script that causes that to happen. Anyhow, i'm really puzzled by this problem and hope I won't be the only one.
Code:
--8 rows
--23 blocks large
--42 blocks long
END=0
ib=0
function DetectGlass()
turtle.select(16)
if turtle.compare() then
error("Perimeter Detected")
end -- if not
end -- Detect Glass
function RowFront()
i=1
while i<42 do
DetectGlass()
turtle.dig()
while not turtle.forward() do
turtle.dig()
turtle.forward()
turtle.suckUp()
turtle.suckDown()
end -- Force Forward END
i=i+1
end -- while END
turtle.turnRight()
DetectGlass()
turtle.dig()
turtle.suckUp()
turtle.suckDown()
while not turtle.forward() do
turtle.dig()
turtle.forward()
turtle.suckUp()
turtle.suckDown()
end -- while END
turtle.turnRight()
end -- Row END
function RowBack()
ia=1
while ia<42 do
DetectGlass()
turtle.dig()
while not turtle.forward() do
turtle.dig()
turtle.forward()
turtle.suckUp()
turtle.suckDown()
end -- Force Forward END
ia=ia+1
end -- while END
turtle.turnLeft()
DetectGlass()
turtle.dig()
while not turtle.forward() do
turtle.dig()
turtle.forward()
turtle.suckUp()
turtle.suckDown()
end --while not
DetectGlass()
turtle.dig()
while not turtle.forward() do
turtle.dig()
turtle.forward()
turtle.suckUp()
turtle.suckDown()
end --while not
print(ib)
turtle.turnLeft()
end -- Row END
repeat
--Workflow
DetectGlass()
turtle.dig()
while not turtle.forward() do
turtle.dig()
turtle.forward()
turtle.suckUp()
turtle.suckDown()
end -- while not end
ib=0
while ib<8 do
ib=ib+1
RowFront()
RowBack()
end --while END
turtle.turnLeft()
turtle.turnLeft()
DetectGlass()
turtle.dig()
while not turtle.forward() do
turtle.dig()
turtle.forward()
end
turtle.turnRight()
ic=1
while ic<25 do
ic=ic+1
DetectGlass()
while not turtle.forward() do
turtle.dig()
turtle.forward()
end --while not END
end --while END
turtle.turnRight()
print("Unloading")
id=1
while id<15 do
id=id+1
turtle.select(id)
turtle.dropDown()
end
turtle.select(16)
until END==1
Alright here's more details..
The above is a sugar cane farming script, it harvests each rows then comes back to its start and drop off the canes.
It also keeps a glass cube to compare with that it is digging to prevent it from running away, since it has glass walls all around.
The farm itself is well covered by a chunk loader (max range chunk loader) and I even installed another one just for that farm in case something went wrong with the first one.
I also made sure nothing can sneak in my farm, no passives nor hostiles.
My turtles never run into anything else than sugar canes and empty blocks.
The problem is, it works great when i'm online, even if i'm very far away but the moment I log off, even though the server is still on, my turtles goes crazy and either corrupts its programming by changing its patterns or gets stuck in a loop and digs forever forward. Which is why I implemented the perimeter detection..
Now I know my script is just fine! It worked all day long (played for more than 12 hours without a problem) but the moment I logged off to go to sleep they stopped working correctly. (Running into walls; digging where it shouldn't)
There might be solutions when it comes to my script, like implementing a GPS system but at that point i'd rather just stay logged on instead..
I'll listen to all suggestions but I'd prefer the focus to not be on how to get around the problem but on what is causing it.
I was thinking, the excavate script works great, even when offline. So perhaps there's something i'm using in my script that causes that to happen. Anyhow, i'm really puzzled by this problem and hope I won't be the only one.