Originally Posted by Dridzt
There's a couple issues with your code but before I get into those I'm going to jump to the end and say that even if you properly got what's on that Bartender4 button you can't call protected actions like that.
Can't simply run a /use or /cast as a script from addons.
|
Seems reasonable, I can setup a secure action for this later. I'm having more trouble just getting the information I need first unfortunately. I played with the following snippit in WowLua, and it actually works as intended: I get the spell name from the Bartender4 button. From addon:Initialization though the button appears to be nil, even after marking Bartender4 as a dependency
Code:
function ParseSpellName(spellId)
local spellName, spellSubName, _ = GetSpellInfo(spellId);
if spellSubName then
return string.format("%s(%s)", spellName, spellSubName)
else
return spellName
end
end
local button = _G["BT4Button73"]
local slot = button:GetAttribute('action');
local actionType, actionId, _ = GetActionInfo(slot);
if (actionType == 'spell') then
local command = string.format("/use [@mouseover]%s", ParseSpellName(actionId))
print(command);
end