WoW:API GetAutoLootDefault: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(New page: {{wowapi}} __NOTOC__ <!-- Describe the purpose of the function, exhausting detail can be saved for a later section --> Returns the state of Auto Loot. If the checkbox in the interface con...)
 
Line 14: Line 14:
''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 SetCVar("scriptErrors",1); if GetAutoLootDefault() == 1 then SetAutoLootDefault(false); message("Auto Loot is off."); else SetAutoLootDefault(true); message("Auto Loot is on."); end
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>
<big>'''Result'''</big>
:Pops up a window informing the user of the state of Auto Loot. Very useful for toggling Auto Loot on the fly.
:Pops up a window informing the user of the state of Auto Loot. Very useful for toggling Auto Loot on the fly.

Revision as of 14:17, 19 September 2007

WoW API < GetAutoLootDefault

Returns the state of Auto Loot.

Returns

1
integer - if Auto Loot is enabled (checked).
nil
integer - if Auto Loot is disabled (unchecked).

Example

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

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())]..".");

Result

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