DCheckBoxLabel help.

Hello FP.
Need a hand with a piece of code for a derma panel i was making. It uses a CheckBox which well ticked is meant to set a string to “her” and well unticked is meant to set the string to “his”. But for a reason unknown to me it sticks using “her” no matter if it is ticked or unticked. There is not much documentation on gmod wiki for .DoClick with tickboxxes though im wondering if im doing something wrong.

[lua]local CheckBoxThing = vgui.Create( “DCheckBoxLabel”, DermaPanel )
CheckBoxThing:SetPos( 180,5 )
CheckBoxThing:SetText( “Female?” )
CheckBoxThing:SetValue( 1 )
CheckBoxThing:SizeToContents()
CheckBoxThing.DoClick=function()
MF=1
end

if MF==1 then
HisHer=“her”
end

if MF==0 then
HisHer=“his”
end [/lua]

^ Thats my code there and i know i should use

[lua]if MF==1 then
HisHer=“her”
else
HisHer=“his”
end[/lua]

but im just usign 2 ifs for the sake of debugging

Use [lua] tags

[editline]27th October 2010[/editline]

Just a tip

If by that you mean [lua][/lua] on my code then yea sure i just edited that in

Can’t you do something like

[lua]local CheckBoxThing = vgui.Create( “DCheckBoxLabel”, DermaPanel )
CheckBoxThing:SetPos( 180,5 )
CheckBoxThing:SetText( “Female?” )
CheckBoxThing:SetValue( 1 )
CheckBoxThing:SizeToContents()
CheckBoxThing.DoClick=function( self )
if( self:GetValue() == 1 ) then
HisHer = “her”;
else
HisHer = “his”;
end
end
[/lua]

Nope that doesnt work…

A. Doclick returns a boolean (to it would be == true not ==1)

B. It just doesnt work for some reason unknown to me because it doesnt assign a string to the HisHer var

Also could you explain to me the semi colons after the HisHer ="…"; dont think ive seen that