12.07.2015 Views

Wiley-World.of.Warcraft.Programming.A.Guide.and.Reference.for.Creating.WoW.Addons

Wiley-World.of.Warcraft.Programming.A.Guide.and.Reference.for.Creating.WoW.Addons

Wiley-World.of.Warcraft.Programming.A.Guide.and.Reference.for.Creating.WoW.Addons

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 27 ■ API <strong>Reference</strong> 975Arguments:unit—A unit to query (string, unitID)name—The name <strong>of</strong> a unit to query; only valid <strong>for</strong> party/raid members <strong>and</strong> theirpets (string)Returns:inRange—1 if the unit is close enough to the player to (likely) be in range <strong>for</strong>helpful spells; otherwise nil (1nil)UnitInVehicleReturns whether a unit is in a vehicle.inVehicle = UnitInVehicle(“unit“) or UnitInVehicle(“name“)A unit can be riding in a vehicle without controlling it: to test whether a unit iscontrolling a vehicle, use UnitControllingVehicle or UnitHasVehicleUI.Note: multi-passenger mounts appear as vehicles <strong>for</strong> passengers but not <strong>for</strong> theowner.Arguments:unit—A unit to query (string, unitID)name—The name <strong>of</strong> a unit to query; only valid <strong>for</strong> player, pet, <strong>and</strong> party/raidmembers (string)Returns:inVehicle—1 if the unit is in a vehicle; otherwise nil (1nil)UnitInVehicleControlSeatReturns whether a unit controls a vehicle.isInControl = UnitInVehicleControlSeat()Returns:isInControl—True if the unit controls a vehicle (boolean)UnitIsAFKReturns whether a unit is marked AFK (Away From Keyboard).isAFK = UnitIsAFK(“unit“) or UnitIsAFK(“name“)Arguments:unit—A unit to query (string, unitID)name—The name <strong>of</strong> a unit to query; only valid <strong>for</strong> player, pet, <strong>and</strong> party/raidmembers (string)Returns:isAFK—1 if the unit is AFK; otherwise nil (1nil)UnitIsCharmedReturns whether a unit is currently charmed.isCharmed = UnitIsCharmed(“unit“)A charmed unit is affected by Mind Control (or a similar effect) <strong>and</strong> thushostile to units which are normally his or her allies.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!