I’m looking for a way to add the read back cooldown to a macro, it would be the best if it would read back the cooldown from the skill used in this macro. I couldn’t find the strict macro, only some addons. I’ve already checked MacroCooldowns and ExtraActionBars but they don’t fulfill the task in this case. Macro has got conditions and even if it doesn’t use the skill it still counts the cooldown. nkXtdMacro worked the best here and it would be perfect but it’s got one big disadvantage: it causes micro lags while using skills and not only macros.
The addon itself is not long, so maybe I can find some programmer here, who can catch where the problem is and how to change it. All I know is that after clicking any skill the addon reacts to it and checks all 80 fields on action bars searching for ‘names’ and that causes the micro lags.
- nkXtdMacro = {};
- nkXtdMacro.AddonName = "nkXtdMacro";
- nkXtdMacro.AddonVersion = "v1.0.1";
- -- Hook standard function
- local orig_ActionButton_Update = ActionButton_Update;
- local orig_ActionButton_UpdateCooldown = ActionButton_UpdateCooldown;
- local orig_ActionButton_UpdateUsable = ActionButton_UpdateUsable;
- function ActionButton_Update(button)
- orig_ActionButton_Update(button);
- if button ~= nil then
- local texture, name, count, locked, wore, continued = GetActionInfo(ActionButton_GetButtonID(button));
- if (name ~= nil and name ~= "") then
- -- Macro oder Emote
- local skillIcon = nkXtdMacro.GetSkillTexture (name);
- if skillIcon ~= nil then
- local icon = getglobal(button:GetName().."Icon");
- icon:SetTexture(skillIcon);
- end;
- end;
- end;
- end;
- function ActionButton_UpdateCooldown(button)
- orig_ActionButton_UpdateCooldown(button);
- if button ~= nil then
- local texture, name, count, locked, wore, continued = GetActionInfo(ActionButton_GetButtonID(button));
- local skillIcon = nkXtdMacro.GetSkillTexture (name);
- if name ~= nil then
- -- Macro oder Emote
- duration, remaining = nkXtdMacro.GetSkillCooldown(name);
- if duration ~= nil and remaining ~= nil then
- CooldownFrame_SetTime(getglobal(button:GetName().."Cooldown"), duration, remaining);
- end;
- end;
- end;
- end
- function ActionButton_UpdateUsable(button)
- orig_ActionButton_UpdateUsable(button);
- if button ~= nil then
- local texture, name, count, locked, wore, continued = GetActionInfo(ActionButton_GetButtonID(button));
- if name ~= nil then
- -- Macro oder Emote
- local cooldown, remaining = nkXtdMacro.GetSkillCooldown (name);
- if remaining ~= nil then
- if ( remaining == 0 ) then
- getglobal(button:GetName().."Invalid"):Hide();
- else
- getglobal(button:GetName().."Invalid"):Show();
- end;
- end;
- end;
- end;
- end
- nkXtdMacro.GetSkillCooldown = function (name)
- for tabNum = 1, 5 do
- local numSkills = GetNumSkill(tabNum)
- if numSkills then
- for skillNum = 1, numSkills do
- local skillName, temp1, skillIcon, temp2, skillLVL , temp3, tpNextLvl, temp4, learned = GetSkillDetail(tabNum, skillNum);
- if skillName == name then
- local cooldown, remaining = GetSkillCooldown (tabNum, skillNum);
- return cooldown, remaining;
- end;
- end;
- end;
- end;
- return nil;
- end;
- nkXtdMacro.GetSkillTexture = function (name)
- for tabNum = 1, 5 do
- local numSkills = GetNumSkill(tabNum)
- if numSkills then
- for skillNum = 1, numSkills do
- local skillName, temp1, skillIcon, temp2, skillLVL , temp3, tpNextLvl, temp4, learned = GetSkillDetail(tabNum, skillNum);
- if skillName == name then
- return skillIcon;
- end;
- end;
- end;
- end;
- return nil;
- end;
And this is the exact macro that should show the cooldown: