WoW:ActionSlot: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(moved code for enumerating from the UnitName page)
m (Fixed reportActionButtons() example)
Line 29: Line 29:
This function will display the contents of each of the 120 action slots (skipping empty ones) in the default chat frame.  To use, type "/script reportActionButtions()".
This function will display the contents of each of the 120 action slots (skipping empty ones) in the default chat frame.  To use, type "/script reportActionButtions()".


function reportActionButtons()
<pre>
  for local lActionSlot = 1, 120 do
function reportActionButtons()
  local lActionText = GetActionText(lActionSlot)
local lActionSlot = 0;
  local lActionTexture = GetActionTexture(lActionSlot)
for lActionSlot = 1, 120 do
local lActionText = GetActionText(lActionSlot);
  if lActionTexture then
local lActionTexture = GetActionTexture(lActionSlot);
    local lMessage = "Slot " .. lActionSlot .. ": [" .. lActionTexture .. "]"
if lActionTexture then
local lMessage = "Slot " .. lActionSlot .. ": [" .. lActionTexture .. "]";
    if lActionText then lMessage = lMessage .. " \"" .. lActionText .. "\""
if lActionText then
lMessage = lMessage .. " \"" .. lActionText .. "\"";
    DEFAULT_CHAT_FRAME:AddMessage(lMessage)
end
  end
DEFAULT_CHAT_FRAME:AddMessage(lMessage);
  end
end
end
end
end
</pre>

Revision as of 17:04, 22 September 2006

API types

Action Slot IDs can vary for some classes and are completely arbitrary to the buttons they exist in. As of 1.11, World of Warcraft allows 120 Action Slot IDs, numbered from 1-120. The IDs 1-72 are used by the six default bars (see below for the button ranges). IDs 73-108 are used by the stance bars of some classes. IDs 109-120 have no default uses.

Default UI use of Action slot IDs

ActionBar page 1: slots 1 to 12 -- Note exceptions below for other classes
ActionBar page 2: slots 13 to 24

ActionBar page 3 (Right ActionBar): slots 25 to 36
ActionBar page 4 (Right ActionBar 2): slots 37 to 48

ActionBar page 5 (Bottom Right ActionBar): slots 49 to 60
ActionBar page 6 (Bottom Left ActionBar): slots 61 to 72

Warriors

ActionBar page 1 Battle Stance: slots 73 to 84
ActionBar page 1 Defensive Stance: slots 85 to 96
ActionBar page 1 Berserker Stance: slots 97 to 108

Druids

Rogues

ActionBar page 1 Stealth: slots 73 to 84

Example Code

This function will display the contents of each of the 120 action slots (skipping empty ones) in the default chat frame. To use, type "/script reportActionButtions()".

function reportActionButtons()
	local lActionSlot = 0;
	for lActionSlot = 1, 120 do
		local lActionText = GetActionText(lActionSlot);
		local lActionTexture = GetActionTexture(lActionSlot);
		if lActionTexture then
			local lMessage = "Slot " .. lActionSlot .. ": [" .. lActionTexture .. "]";
			if lActionText then
				lMessage = lMessage .. " \"" .. lActionText .. "\"";
			end
			DEFAULT_CHAT_FRAME:AddMessage(lMessage);
		end
	end
end