User Interface Macros
Action Button ID
Mouseover a action bar button and use this macro to get the ID
/run local a=GetMouseFocus()message(ActionButton_GetPagedID(a))
This will print all the slot and texture names where abilities are placed
/run for i=1,72 do if GetActionTexture(i) then DEFAULT_CHAT_FRAME:AddMessage("Slot "..i..": "..GetActionTexture(i))end end
Here you can see where the actionID slots in your actionbars are:
ActionBar page 1: slots 1 to 12
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
Bag slot ID
Bags are numbered on the right, (4) (3) (2) (1) (0) Slots in bags are numbered like this: 1 2 3 4
5 6 7 8
9 10 .... etc
This macro prints the ID of the bag slot that is mouse focused
/run DEFAULT_CHAT_FRAME:AddMessage(GetMouseFocus():GetParent():GetID()..", "..GetMouseFocus():GetID())
Duration
Shows your buff/debuff durations in seconds.
/run for i=0,31 do local id,cancel = GetPlayerBuff(i,"HELPFUL|HARMFUL|PASSIVE"); if(id > -1) then local timeleft = GetPlayerBuffTimeLeft(id); DEFAULT_CHAT_FRAME:AddMessage(timeleft); end end
Actionbar Page
Switches between actionbar page 1 and 2
/run if (CURRENT_ACTIONBAR_PAGE == 1) then CURRENT_ACTIONBAR_PAGE = 2; else CURRENT_ACTIONBAR_PAGE = 1; end; ChangeActionBarPage();
Change Action Bar
/run if (CURRENT_ACTIONBAR_PAGE == 1) then CURRENT_ACTIONBAR_PAGE = 2; ChangeActionBarPage(); elseif(CURRENT_ACTIONBAR_PAGE == 2) then CURRENT_ACTIONBAR_PAGE = 1; ChangeActionBarPage(); end
Clear Action Bars
Clears all the buttons off of action bars
/run for i = 1,120 do PickupAction(i) ClearCursor() end
UI Errors Frame
This one toggles on and off melee skill spam
/run local f = UIErrorsFrame if f:IsVisible() then f:Hide() else f:Show() end
This one hides melee skill spam
/run UIErrorsFrame:Hide()
Events
This toggles on and off the ongoing events in the chat frame
/run if not f then f = CreateFrame('FRAME') end if f:GetScript('OnEvent') then f:UnregisterAllEvents()f:SetScript('OnEvent', nil) else f:RegisterAllEvents()f:SetScript('OnEvent', function()DEFAULT_CHAT_FRAME:AddMessage(event)end) end
This displays the ongoing events in the chat frame
/run f = CreateFrame('FRAME')f:RegisterAllEvents()f:SetScript('OnEvent', function()DEFAULT_CHAT_FRAME:AddMessage(event)end)
This hides the ongoing events in the chat frame
/run f:UnregisterAllEvents()f:SetScript('OnEvent', nil)
This hides some of the redundant chat events
/run EventUnregister = {"CHAT_MSG_ADDON", "CHAT_MSG_CHANNEL", "CHAT_MSG_CHANNEL_LEAVE", "CHAT_MSG_CHANNEL_JOIN", "CHAT_MSG_GUILD"} for i = 1, getn(EventUnregister) do f:UnregisterEvent(EventUnregister[i])end
Switch Mode
Full-screen to windowed mode
/run currentRes = GetCurrentResolution(); if (currentRes == 3) then SetScreenResolution(15); SetCVar("gxWindow", 0); SetMultisampleFormat(16);else SetCVar("gxWindow", 1); SetScreenResolution(3); SetMultisampleFormat(1); end;
Replace the 15 in SetScreenResolution with your selected high-res index, the 16 in SetMultisampleFormat with your selected colour depth/anti-aliasing, and the 3 in Set/GetScreenResolution with your preferred windowed res. To finish this one off, drop it into a popup button and go to key bindings, link in “alt-enter”. That way, alt-enter will alternate between windowed and full-screen. You can also work in any of the above Farclip etc calls to further alter the settings between windowed and full-screen, depending on how your machine behaves – experiment and see.
Cursor Position
This calculates and prints the coordinates of the cursor
/run local x,y=GetCursorPosition() local s=UIParent:GetEffectiveScale() x,y=floor(x/s),floor(y/s) DEFAULT_CHAT_FRAME:AddMessage(format("Cursor: %d, %d",x,y))
Get Pet Action Info
This prints name and number of pet skills
/run for i=1,100 do if GetPetActionInfo(i) then DEFAULT_CHAT_FRAME:AddMessage("Index "..i..": "..GetPetActionInfo(i)) end end
Buff / Debuff
This prints the texture names of any buffs and debuffs on the target
/run function m(s) DEFAULT_CHAT_FRAME:AddMessage(s); end for i=1,16 do s=UnitBuff("target", i); if(s) then m("B "..i..": "..s); end s=UnitDebuff("target", i); if(s) then m("D "..i..": "..s); end end
This prints the texture names of any of the buffs on you
/run i=1; while UnitBuff("player",i)~=nil do DEFAULT_CHAT_FRAME:AddMessage(UnitBuff("player",i)); i=i+1; end
Talent Info
This prints the name and texture name of talents
/run for page = 1,3 do for index = 1,25 do local name, icon = GetTalentInfo(page,index) if name and icon then DEFAULT_CHAT_FRAME:AddMessage(name .. ":" .. icon) end end end
This print all indexes in the talent trees with talent name
/run for page = 1,3 do for index = 1,25 do local name = GetTalentInfo(page,index) if name then DEFAULT_CHAT_FRAME:AddMessage(page .. "," .. index ..": ".. name) end end end
Tracking Texture
Use the script to get the current Tracking Texture
/run icon= GetTrackingTexture() DEFAULT_CHAT_FRAME:AddMessage(icon)
Action Bar Gryphons
Hide action bar gryphons
/run MainMenuBarLeftEndCap:Hide(); MainMenuBarRightEndCap:Hide()
Inventory
In the inventory, the slots are numbered like this:
1_______10
2_______6
3_______7
15______8
4_______11
5_______12
19______13
9_______14
16 17 18
This prints the name and slot of equipped items
/run for i=0,23 do if GetInventoryItemLink("player",i) then DEFAULT_CHAT_FRAME:AddMessage("Slot "..i..": "..GetInventoryItemLink("player",i)) end end
Open the main menu
/run ToggleGameMenu();
This Key-binds Esc to toggle the main menu
/run SetBinding("ESCAPE","TOGGLEGAMEMENU")SaveBindings(1)
MAX Graphics
More than MAX graphics settings can be applied to the Config.wtf file however, depending on your server's restrictions this may or may not have an effect.
/console groundEffectDensity 256
/console groundEffectDist 170
/console detailDoodadAlpha 100
/console farclip 777
/console horizonfarclip 6226
/console smallcull 0
/console maxLOD 3
/console SkyCloudLOD 3
/console characterAmbient 1
Toggle Mouselook
This toggle mouselook on or off
/run if IsMouselooking() then MouselookStop() else MouselookStart() end
Player Frame
This enable or disable moving for player frame
/run if not m then PlayerFrame:SetMovable(1)PlayerFrame:StartMoving()m=true else PlayerFrame:StopMovingOrSizing()PlayerFrame:SetMovable()m=false end
Move player unit frame
/run PlayerFrame:SetMovable(1)PlayerFrame:StartMoving()
Stop moving player unit frame
/script PlayerFrame:StopMovingOrSizing()PlayerFrame:SetMovable()
Use these scripts to move player and target frame. Adjust the coordinates to your liking.
/run PlayerFrame:ClearAllPoints() PlayerFrame:SetPoint("CENTER",UIParent,-150,-150)PlayerFrame:SetUserPlaced(true)
/run TargetFrame:ClearAllPoints() TargetFrame:SetPoint("CENTER",UIParent,150,-150)TargetFrame:SetUserPlaced(true)
Target Frame
This enable or disable moving for target frame
/run if not n then TargetFrame:SetMovable(1)TargetFrame:StartMoving()n=true else TargetFrame:StopMovingOrSizing()TargetFrame:SetMovable()n=false end
Move target unit frame
/run TargetFrame:SetMovable(1)TargetFrame:StartMoving()
Stop moving target unit frame
/run TargetFrame:StopMovingOrSizing()TargetFrame:SetMovable()
Minimap
This resizes the minimap scale to 1.5 and allows you to move it around by clicking and dragging with the mouse
/run local x,t=Minimap,true x:SetScale(1.5) x:EnableMouse(t) x:SetMovable(t) x:RegisterForDrag("LeftButton") x:SetScript("OnDragStart",function() x:StartMoving() end) x:SetScript("OnDragStop",function() x:StopMovingOrSizing() end)
Moving Minimap to farm mode (adjust the 0, 0 to the coordiantes you'd like to have it)
/run Minimap:SetWidth(500); Minimap:SetHeight(500); Minimap:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
Default size and position
/run Minimap:SetWidth(140); Minimap:SetHeight(140); Minimap:SetPoint("CENTER", UIParent, "CENTER", 755, 380)
UI Element
To discover the names of the UI elements, use this one
/script DEFAULT_CHAT_FRAME:AddMessage( GetMouseFocus():GetName() );
Spellbook
This prints the name and id of all the skills in your spellbook
/run local i=1;while true do local spellName,spellRank=GetSpellName(i,BOOKTYPE_SPELL);if not spellName then break;end;DEFAULT_CHAT_FRAME:AddMessage(i..": "..spellName..'('..spellRank..')');i=i+1;end
This prints the spellbook
/run local name,rank,i; for i=1,200,1 do name,rank=GetSpellName(i,BOOKTYPE_SPELL); if name then DEFAULT_CHAT_FRAME:AddMessage(i .. " = " .. name .. " / " .. rank); end; end
Toggle Action Bars
This hides or shows all the extra action bars
/run local s,t="SHOW_MULTI_ACTIONBAR_","HIDE_MULTI_ACTIONBAR_" local x=not getglobal(s.."1") for i=1,4 do setglobal(s..i,x) setglobal(t..i,not x) end MultiActionBar_Update()
This shows all the extra action bars
/run local x=not SHOW_MULTI_ACTIONBAR_1 SHOW_MULTI_ACTIONBAR_1=x SHOW_MULTI_ACTIONBAR_2=x SHOW_MULTI_ACTIONBAR_3=x SHOW_MULTI_ACTIONBAR_4=x UIOptionsFrame:Show() UIOptionsFrame:Hide() ToggleGameMenu();
Spell ID
Use this to find SpellBookID of a specific spell (replace SpellName in "SpellName")
/script for id = 1, 180, 1 do local spellName, subSpellName = GetSpellName(id, SpellBookFrame.bookType);if spellName and string.find(spellName, "SpellName", 1, true) then ChatFrame1:AddMessage("ID is "..id, 1.0, 1.0, 0.5); end; end;
Use this if you want to test you have the right spell. (replace X with the number you want to test)
/script DEFAULT_CHAT_FRAME:AddMessage(GetSpellName(X,0));
Name
Toggle on / off player names
/run if ( GetCVar("UnitNamePlayer") == "1" ) then SetCVar("UnitNamePlayer",0) else SetCVar("UnitNamePlayer",1) end
Toggle on / off NPC names
/run if ( GetCVar("UnitNameNPC") == "1" ) then SetCVar("UnitNameNPC",0) else SetCVar("UnitNameNPC",1) end
Toggle Pet name
/run if PetName then if PetName:IsVisible() then PetName:Hide() else PetName:Show() end end
Icon Names
Buffs in vanilla use interface names from the icon they have. That means you use the names of the icons to check instead of the actual buff name. Any more advanced checking wont fit inside a single macro. This is fairly confusing so in order to get the icon name you need to figure it out first. List all icon names of buffs of your target.
/run for i=1,40 do if UnitBuff("target",i) then DEFAULT_CHAT_FRAME:AddMessage(tostring(i.."="..UnitBuff("target",i)),0.4,1,1) end end
List all icon names of debuffs of your target.
/run for i=1,40 do if UnitDebuff("target",i) then DEFAULT_CHAT_FRAME:AddMessage(tostring(i.."="..UnitDebuff("target",i)),0.4,1,1) end end
Check if a target has a certain buff icon name
/run for i=1,40 do if(strfind(tostring(UnitBuff("target",i)),"MyBuffName")) then c="Yes" end end if not c="Yes" then c="No" end DEFAULT_CHAT_FRAME:AddMessage(c)
Check if a target has a certain debuff icon name
/run for i=1,40 do if(strfind(tostring(UnitDebuff("target",i)),"MyBuffName")) then c="Yes" end end if not c="Yes" then c="No" end DEFAULT_CHAT_FRAME:AddMessage(c)
There is another way to check proper buff names and buff descriptions by exploiting the tooltip information but it’s unwieldy and requires long bouts of code. This is very unsuitable to be used in macros. Here are some examples if you want to try anyway:
List all the buff names of your target:
/run g=GameTooltip g:SetOwner(WorldFrame) t=GameTooltipTextLeft1 for i=1,32 do g:SetUnitBuff("target",i) if t:GetText() then DEFAULT_CHAT_FRAME:AddMessage(i.."="..t:GetText(),0.4,1,1) g:ClearLines() end end g:Hide()
List all the buff descriptions of your target:
/run g=GameTooltip g:SetOwner(WorldFrame) t=GameTooltipTextLeft2 for i=1,32 do g:SetUnitBuff("target",i) if t:GetText() then DEFAULT_CHAT_FRAME:AddMessage(i.."="..t:GetText(),0.4,1,1) g:ClearLines() end end g:Hide()
List all player buff names:
/run g=GameTooltip g:SetOwner(WorldFrame) t=GameTooltipTextLeft1 for i=1,32 do g:SetPlayerBuff(i) if t:GetText() then DEFAULT_CHAT_FRAME:AddMessage(i.."="..t:GetText(),0.4,1,1) end end
List all player buff descriptions:
/run g=GameTooltip g:SetOwner(WorldFrame) t=GameTooltipTextLeft2 for i=1,32 do g:SetPlayerBuff(i) if t:GetText() then DEFAULT_CHAT_FRAME:AddMessage(i.."="..t:GetText(),0.4,1,1) end end