Skip to content

Return of Reckoning

Wiki

RoR Wiki

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 – true if something was cancelled, false if 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 true is returned.
  • Otherwise the client tries to cancel the ability currently being cast and returns true if that worked.
  • Returns false if 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

See also