By default it will exit and return false after 15 seconds so your script can fix the issue.
Code: Select all
function isZoneChanged(_maxWaitTime)
-- delay is the max waiting time bot will wait for loading screen to appear, 15 sec by default
local _maxWaitTime = _maxWaitTime or 15
-- wait for loading screen to appear
if memoryReadBytePtr(getProc(), addresses.loadingScreenPtr, addresses.loadingScreen_offset) == 0 then
repeat
yrest(1000)
_maxWaitTime = _maxWaitTime - 1
until _maxWaitTime == 0 or memoryReadBytePtr(getProc(), addresses.loadingScreenPtr, addresses.loadingScreen_offset) == 1
end
if _maxWaitTime == 0 then
-- Loading screen didn't appear, we return false so waypoint file can try to trigger zone change again or exit with an error
cprintf(cli.yellow,"Couldn't detect zone change...\n")
return false
end
-- wait until loading screen is gone
repeat
yrest(1000)
until memoryReadBytePtr(getProc(),addresses.loadingScreenPtr, addresses.loadingScreen_offset) == 0
yrest(2000)
player:update()
return true
end
Code: Select all
repeat
keyboardPress(key.VK_SPACE);
until isZoneChanged()