View Single Post
06-04-07, 03:08 PM   #4
Shirik
Blasphemer!
Premium Member
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2007
Posts: 818
Originally Posted by darkra
local HIC = CreateFrame("Frame","HIC_Frame");
HIC:RegisterEvent("PLAYER_REGEN_ENABLED");
HIC:RegisterEvent("PLAYER_REGEN_DISABLED");
HIC:SetScript("OnEvent", function() HelmInCombat() end);

function HelmInCombat()
if(event=="PLAYER_REGEN_DISABLED") then
ShowHelm();
elseif(event=="PLAYER_REGEN_ENABLED") then
ShowHelm('false');
end
end

Works like a charm mate, thanks a lot
For efficiency purposes (globals are evil):

change
Code:
HIC:SetScript("OnEvent", function() HelmInCombat() end);
to
Code:
HIC:SetScript("OnEvent", HelmInCombat)
and
Code:
function HelmInCombat()
to
Code:
function HelmInCombat(self, event)
Get in the habit of doing this, otherwise you're going to see your mods start breaking when they take out the event/arg1 globals in a future patch (they are already deprecated)
__________________
たしかにひとつのじだいがおわるのお
ぼくはこのめでみたよ
だけどつぎがじぶんおばんだってことわ
しりたくなかったんだ
It's my turn next.

Shakespeare liked regexes too!
/(bb|[^b]{2})/
  Reply With Quote