Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Checkbox syntax

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 577

PostPosted: Thu Mar 07, 2013 7:47 am    Post subject: Checkbox syntax Reply with quote

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
View user's profile Send private message Yahoo Messenger
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25295
Location: The netherlands

PostPosted: Thu Mar 07, 2013 10:12 am    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Thu Mar 07, 2013 10:27 am    Post subject: Reply with quote

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

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 577

PostPosted: Thu Mar 07, 2013 10:32 am    Post subject: Reply with quote

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
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites