Posted: Thu Mar 07, 2013 7:47 am Post subject: Checkbox syntax
I've added a checkbox to one of my CheatPanel's
Code:
function CECheckbox1Click(sender)
boxstate = CECheckbox1_getState
if boxstate == cbChecked then
timer_setEnabled(t, true)
else
timer_setEnabled(t, false)
end
end
The timer was not enabled when checked
So I changed the code
Code:
function CECheckbox1Click(sender)
boxstate = CECheckbox1_getState
if boxstate == true then
timer_setEnabled(t, true)
else
timer_setEnabled(t, false)
end
end
The timer was not enabled when checked
So what syntax am I missing?
EDIT:
Can the debug print and/or the script window be called to open when the table is loaded? If so what are their names?
Joined: 09 May 2003 Posts: 25796 Location: The netherlands
Posted: Thu Mar 07, 2013 10:12 am Post subject:
CECheckbox1_getState returns either nil or a Checkbox object if you named your form CECheckbox1 and the checkbox "getState" (which I doubt)
I am assuming you use ce 6.2 (and not 6.2+)
To get the state you need to call the function : "checkbox_getState" and provide it as parameter the Checkbox object
If your checkbox is on a form named "MyTrainer" and your checkbox is named "CECheckbox1" then the name of the checkbox object to lua is:
MyTrainer_CECheckbox1
In that case, to get the state of the checkbox call
boxstate = checkbox_getState(MyTrainer_CECheckbox1)
the debug print window will show as soon as the first print()command is excuted.
If your table has a print("") it will show as well _________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping
function CECheckbox1Click(sender)
boxstate = checkbox_getState(CheatPanel_CECheckbox1) --your checkbox
if boxstate == cbChecked then
timer_setEnabled(t, true)
elseif boxstate == cbUnhecked then
timer_setEnabled(t, false)
elseif boxstate ~= cbUnhecked and boxstate ~= cbChecked then -- or just do "elseif boxstate == cbGrayed"
print("its grayed out...")
end
end
_________________
I'm rusty and getting older, help me re-learn lua.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum