Reset function

07/04/2020 04:09 snowflavored#1
Hey I've recently been working on a script for a particular run and I've noticed it seems to be getting stuck in certain places and not resetting itself. I don't have a reset function, and I was wondering if there was one I could add? I could fix the path where it goes in each of these spots, but I figured having a part in the code for it to just reset back to the beginning if it's been sitting for like 5 minutes would help a lot more. Thanks in advance if anybody has any ideas!
07/04/2020 06:12 Term!nX#2
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.