WoW:API GetAutoLootDefault: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
m (Move page script moved page API GetAutoLootDefault to API GetAutoLootDefault without leaving a redirect)
 
(4 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{wowapi}} __NOTOC__
{{wowapi|removed=3.0|replace=Behavior now controlled by the {{api|autoLootDefault|t=c}} CVar. Use {{api|GetCVar}}}}


<!-- Describe the purpose of the function, exhausting detail can be saved for a later section -->
Returns the state of Auto Loot.
Returns the state of Auto Loot.


== Returns ==
local state = GetAutoLootDefault()
<!-- List each return value, together with its type -->


:;1 : integer - if Auto Loot is enabled (checked).
== Parameters ==
:;nil : integer - if Auto Loot is disabled (unchecked).
=== Returns ===
* state (onenil) - 1 if auto loot is enabled, nil if disabled.


== Example ==
== Example ==
<!-- If it helps, include an example here, though it's not required if the usage is self-explanatory -->
This toggles Auto Loot on and off when used in a macro spot.
''This toggles Auto Loot on and off when used in a macro spot.''
 
:/script SetCVar("scriptErrors",1); if GetAutoLootDefault() == 1 then SetAutoLootDefault(false); message("Auto Loot is off."); else SetAutoLootDefault(true); message("Auto Loot is on."); end
/script if (GetAutoLootDefault()) then SetAutoLootDefault(false); message("Auto Loot is off."); else SetAutoLootDefault(true); print("Auto Loot is on."); end;
 
or (easier to change if the need arises)
or (easier to change if the need arises)
:/script SetCVar("scriptErrors",1); local onOff = {["1"] = "on",["nil"] = "off"}; SetAutoLootDefault(not GetAutoLootDefault()); message("Auto Loot is "..onOff[tostring(GetAutoLootDefault())]..".");


<big>'''Result'''</big>
/script local onOff = {["1"] = "on",["nil"] = "off"}; SetAutoLootDefault(not GetAutoLootDefault()); print("Auto Loot is "..onOff[tostring(GetAutoLootDefault())]..".");
:Pops up a window informing the user of the state of Auto Loot. Very useful for toggling Auto Loot on the fly.
 
;Result
Pops up a window informing the user of the state of Auto Loot. Very useful for toggling Auto Loot on the fly.
 
== Notes ==
* Removed in patch 3.0. Use {{api|autoLootDefault|t=c}}

Latest revision as of 04:45, 15 August 2023

WoW API < GetAutoLootDefault

Returns the state of Auto Loot.

local state = GetAutoLootDefault()

Parameters[edit]

Returns[edit]

  • state (onenil) - 1 if auto loot is enabled, nil if disabled.

Example[edit]

This toggles Auto Loot on and off when used in a macro spot.

/script if (GetAutoLootDefault()) then SetAutoLootDefault(false); message("Auto Loot is off."); else SetAutoLootDefault(true); print("Auto Loot is on."); end;

or (easier to change if the need arises)

/script local onOff = {["1"] = "on",["nil"] = "off"}; SetAutoLootDefault(not GetAutoLootDefault()); print("Auto Loot is "..onOff[tostring(GetAutoLootDefault())]..".");
Result

Pops up a window informing the user of the state of Auto Loot. Very useful for toggling Auto Loot on the fly.

Notes[edit]