-- Label events
local event = LABEL_ACTIONS[group] or _events[EVENT_LABEL][group]
if event then
event(unpack(label))
end
toggleCriticalMode(false)
end
function onErrorMessage(message)
if not _script.ready then return end
toggleCriticalMode(true)
checkEvents(EVENT_ERROR, message)
-- Snap back
if message == ERROR_NOT_POSSIBLE then
-- Only trigger in spawn
if _script.inSpawn then
local time = os.clock() * 1000
local pos = xeno.getSelfPosition()
-- It's been longer than 2 seconds, reset snapbacks
if time - _lastsnapback > 2000 then
_snapbacks = 0
-- Moved since the last snapback
elseif getDistanceBetween(_lastposition, pos) > 0 then
_snapbacks = 0
end
-- Save time and increment snapbacks by one
_lastsnapback = time
_lastposition = pos
_snapbacks = _snapbacks + 1
-- If snapbacks are at 5 or more, assume an invisible monster is blocking
if _snapbacks >= 5 then
-- TODO: free account alternative (wait for "You must learn this spell first" or "You need a premium account" error message)
if _script.vocation == 'Paladin' then
cast('exori san')
elseif _script.vocation == 'Knight' then
cast('exori')
else
cast('exori frigo')
end
_snapbacks = 0
end
end
end
toggleCriticalMode(false)
end