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 


check if a specific item in a checklistbox is checked

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

Joined: 29 Mar 2021
Posts: 64

PostPosted: Sat Sep 11, 2021 1:04 am    Post subject: check if a specific item in a checklistbox is checked Reply with quote

how do i check if a specific item in a checklistbox is checked or not?
Back to top
View user's profile Send private message
Birdi
Expert Cheater
Reputation: 0

Joined: 08 Jun 2020
Posts: 122
Location: Migrating

PostPosted: Sun Sep 12, 2021 3:31 am    Post subject: Reply with quote

Check its .State
Code:

0=Unchecked, 1=Checked, 2=Gray

_________________
Trying to learn!

Add me on Discord if you want hands-on help: Birdi#0007
Back to top
View user's profile Send private message Visit poster's website
HexaG0n
Advanced Cheater
Reputation: 0

Joined: 29 Mar 2021
Posts: 64

PostPosted: Sun Sep 12, 2021 5:11 am    Post subject: Reply with quote

I tried using state before but it just kept giving me an error or nil. Or its that I don't know how to use it, can you give an example?


Screenshot_1.png
 Description:
 Filesize:  11.68 KB
 Viewed:  2117 Time(s)

Screenshot_1.png


Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Sun Sep 12, 2021 6:27 am    Post subject: Reply with quote

Using primitive ways :

Code:
local form = createForm( true );

local checkBoxes = {};
checkBoxes[1] = createCheckBox( form );
checkBoxes[2] = createCheckBox( form );
checkBoxes[3] = createCheckBox( form );
checkBoxes[4] = createCheckBox( form );
checkBoxes[5] = createCheckBox( form );

for x = 1, #checkBoxes do
    checkBoxes[x].Caption="This is checkbox " .. tostring( x )
    checkBoxes[x].setPosition(10, x * 20)
end

function check_checked()
for x = 1,5 do
if checkBoxes[x].Checked then
   print "true"
else
   print "false"
end
end
end

checkBoxes[1].onChange =check_checked
checkBoxes[2].onChange =check_checked
checkBoxes[3].onChange =check_checked
checkBoxes[4].onChange =check_checked
checkBoxes[5].onChange =check_checked


I think same way for check list box

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
HexaG0n
Advanced Cheater
Reputation: 0

Joined: 29 Mar 2021
Posts: 64

PostPosted: Thu Sep 16, 2021 4:18 am    Post subject: Reply with quote

Corroder wrote:
Using primitive ways :

Code:
local form = createForm( true );

local checkBoxes = {};
checkBoxes[1] = createCheckBox( form );
checkBoxes[2] = createCheckBox( form );
checkBoxes[3] = createCheckBox( form );
checkBoxes[4] = createCheckBox( form );
checkBoxes[5] = createCheckBox( form );

for x = 1, #checkBoxes do
    checkBoxes[x].Caption="This is checkbox " .. tostring( x )
    checkBoxes[x].setPosition(10, x * 20)
end

function check_checked()
for x = 1,5 do
if checkBoxes[x].Checked then
   print "true"
else
   print "false"
end
end
end

checkBoxes[1].onChange =check_checked
checkBoxes[2].onChange =check_checked
checkBoxes[3].onChange =check_checked
checkBoxes[4].onChange =check_checked
checkBoxes[5].onChange =check_checked


I think same way for check list box


is there a way to add scrollbars to this?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Thu Sep 16, 2021 4:54 am    Post subject: Reply with quote

to answer the first question, use the Selected property

Code:

for i=0,clb.Items.Count-1
if clb.Selected[i] then
  printf("%d is selected", i)
end

_________________
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


Last edited by Dark Byte on Thu Sep 16, 2021 7:14 am; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
HexaG0n
Advanced Cheater
Reputation: 0

Joined: 29 Mar 2021
Posts: 64

PostPosted: Thu Sep 16, 2021 6:30 am    Post subject: Reply with quote

Dark Byte wrote:
to answer the first question, use the Selected property

Code:

for i=0,clb.Items.Count
if clb.Selected[i] then
  printf("%d is selected", i)
end


Thank you so much DB!, I finally got it working.
Back to top
View user's profile Send private message
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