You should post the code, otherwise it will be quite difficult to help you. You could add an infinity check to your MoveTo function:
Code:
function Lib_MoveTo(x, y)
MoveTo(x, y)
loopFixer = 0
while (TargetDistance(x, y) > 100) do
Sleep(100)
loopFixer = loopFixer + 1
if (loopFixer == 300) then --wait 30 seconds for infinity check
if (PlayerXMovementSpeed() == 0) then
return 1
end
end
end
return 0
end
This would abort the Lib_MoveTo command if your character still stands still after 30 seconds. Just check if Lib_MoveTo returns 0 (success) or 1 (fail) and add a routine that travels back to town and restarts the run or something like that. Not very "clean" but simple and should do the trick most of the time.