Check boxes
Im wokring on my addon and here is one of the features I want.
On Death I want a message to be sent to a preset channel
So I know I have to do this much
register the event
myaddon.xml
<OnLoad>
this:RegisterEvent("PLAYER_DEAD");
</OnLoad>
<OnEvent>
MyAddon_OnEvent();
</OnEvent>
here is where im not sure what to do
On my frame I have a checkbox I have named $parentHRFChkOnDeath
Heres my function so far
function MyAddon_Onevent()
idplayer = UnitName("player");
if (event == "PLAYER_DEAD" and deadpc == idplayer) then
DEFAULT_CHAT_FRAME:AddMessage("YOUR DEAD!!!.", 1, 1, 1);
SendChatMessage("I'M DEAD!!!", "channel", "common", mychan);
end
end
So i want the check box ($parentHRFCheckOnDeath) to act like a toggle, to turn this feature off an on.
I thought something like
if (event == "PLAYER_DEAD" and deadpc == idplayer and MyFormHRFChkOndeath:True) then
Might do it but I really not sure.
Can anyone assist here?
please and thank you.
|