View previous topic :: View next topic |
Author |
Message |
bknight2602 Grandmaster Cheater Reputation: 0
Joined: 08 Oct 2012 Posts: 577
|
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?
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25295 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 |
|
Back to top |
|
|
DaSpamer Grandmaster Cheater Supreme Reputation: 52
Joined: 13 Sep 2011 Posts: 1578
|
Posted: Thu Mar 07, 2013 10:27 am Post subject: |
|
|
Code: | 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 |
_________________
|
|
Back to top |
|
|
bknight2602 Grandmaster Cheater Reputation: 0
Joined: 08 Oct 2012 Posts: 577
|
Posted: Thu Mar 07, 2013 10:32 am Post subject: |
|
|
OK, this is what I was what I was looking at to define the code
getState(checkbox): Returns a state for the checkbox. (cbUnchecked, cbChecked, cbGrayed)
So I got it that the check box object itself is with in the parentheses.
Thanks
|
|
Back to top |
|
|
|