API:CommandPetToggleAbility
From RoR Wiki
UI Lua API · Pet functions
Version: WAR 1.4.8
Sends a "toggle ability" command for one of the pet's abilities to the server.
sent = CommandPetToggleAbility(abilityId)
Arguments
- abilityId
number– ID of the pet ability.
Returns
- sent
boolean–trueif the request was sent to the server,falseotherwise.
Details
- Sends a "toggle ability" pet command together with
abilityId. - Nothing is sent, and
falseis returned, if the player has no pet, the player object does not exist yet, or one of the player's state flags blocks pet commands (see CommandPet). - The client does not check that the pet has the ability.
- Exactly one argument must be passed. If the argument is missing or not a number, two errors are raised: the generic Invalid Parameters message and the message below.
Errors
LuaCommandPetToggleAbility: Paramater 1 should be ability id to toggle.
Example
Right-clicking a pet ability button, from default/ea_careerresourceswindow/source/petbutton.lua:
function PetButton:OnRButtonDown (flags, x, y)
local slot, actionType, actionId = self:GetActionData ()
if ((actionType == GameData.PlayerActions.COMMAND_PET_DO_ABILITY) and (actionId ~= 0))
then
CommandPetToggleAbility (actionId)
end
end
