API:CancelSpell
From RoR Wiki
UI Lua API · Ability functions
Version: WAR 1.4.8
Cancels the ability the player is currently using or placing, and reports whether there was one.
cancelled = CancelSpell()
Arguments
None.
Returns
- cancelled
boolean–trueif something was cancelled,falseif there was nothing to cancel.
Details
- If the player has picked an ability that is still waiting for its target to be placed (for example a ground-targeted ability showing its targeting circle), that ability is dropped and
trueis returned. - Otherwise the client tries to cancel the ability currently being cast and returns
trueif that worked. - Returns
falseif the player object does not exist yet. - Arguments are not checked; anything passed is ignored.
Errors
None.
Example
The stock UI wraps it in Player.CancelSpell (default/easystem_utils/source/player.lua):
function Player.CancelSpell ()
local wasUsingAnAbility = CancelSpell ()
return wasUsingAnAbility
end
The Escape key handler uses that first, from default/easystem_windowutils/source/windowutils.lua:
-- (1) Cancel the active ability, returns false if there was nothing to cancel
if( Player.CancelSpell() )
then
return;
end
