Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:CommandPet

From RoR Wiki
Revision as of 19:41, 16 October 2026 by Maintenance script (talk | contribs) (UI Lua API import (WAR 1.4.8))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

UI Lua API · Pet functions
Version: WAR 1.4.8

Sends a command (stance, attack, follow, release and so on) to the player's pet.

sent = CommandPet(command)

Arguments

command
number – One of the GameData.PetCommand values, for example GameData.PetCommand.AGGRESSIVE, .DEFENSIVE, .PASSIVE, .ATTACK, .STAY, .FOLLOW or .RELEASE.

Returns

sent
boolean – true if the command was sent to the server, false otherwise.

Details

  • Nothing is sent, and false is returned, if the player has no pet or the player object does not exist yet.
  • While one of the player's state flags is set, only command 7 is sent; all other commands return false.
  • true only means the request was sent. Whether the pet obeys is decided by the server; the stock pet window assumes a sent stance command works and updates its display at once.
  • The client does not check that command is a known value. It is cut to a value from 0 to 255.
  • Exactly one argument must be passed. With a wrong argument the function raises the Invalid Parameters message and still returns false.

Errors

None besides the generic Invalid Parameters message when the argument is missing or not a number.

Example

From default/ea_careerresourceswindow/source/petwindow.lua:

function PetStanceButton:OnLButtonUp (flags, x, y)
    local commandSent = CommandPet(self.m_StanceId)

    -- Pretend that a stance command will always work if it is sent
    -- short circuit the update
    local parentPetWindow = self:GetParent ()

    if(parentPetWindow and commandSent) then
        parentPetWindow:UpdatePetState (self.m_StanceId)

See also