Quantcast Check boxes - WoWInterface
Thread Tools Display Modes
03-20-06, 11:56 AM   #1
A Deviate Faerie Dragon
Join Date: Feb 2006
Posts: 10
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

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);

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.
  Reply With Quote
03-20-06, 04:26 PM   #2
A Cobalt Mageweaver
Nulkris's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2005
Posts: 214

There are these functions you can use:
state = checkbox:GetChecked()
to handle the state of the checkbox.

You could use the OnClick script of the checkbox to update your saved variable, and just reference your saved variable within the code.
<OnClick>dead_SV.Enabled = MyFormHRFChkOndeath:GetChecked();</OnClick>
if(event == "PLAYER_DEAD" and deadpc == playerid and dead_SV.Enabled) then
elseif(event == "VARIABLES_LOADED") then
	if(dead_SV == nil) then dead_SV = {}; end
	if(dead_SV.Enabled == nil) then dead_SV.Enabled = true; end
Nulkris - A80 Rogue - Proudmoore
(Also Drukris, Hamkris on Proudmoore; Hulkris on Jubei'Thos & Khaz Modan)
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Check boxes

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off