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 


For loop to clear all check boxes

 
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: Fri Feb 24, 2023 5:07 pm    Post subject: For loop to clear all check boxes Reply with quote

I'm trying to write a bit of code to check if any of the boxes to the left of each record are checked and if so then unchecked it. I'm having difficulty. The code is exectuded when a button is pressed
Code:

clear_all_check_boxes.onClick = function (sender)
                              AL = getAddressList();
                              for i = 1, AL.count do
                                  mr = AL.CheckedStatus
                                  if mr.CheckedStatus = 'true' then
                                     mr.CheckedStatus = 'false';
                                  end;--if mr(i).CheckedStatus = true then
                              end;--for i = 1, AL.count do
                              end;--function (sender)
Back to top
View user's profile Send private message Yahoo Messenger
Dark Byte
Site Admin
Reputation: 457

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

PostPosted: Fri Feb 24, 2023 5:17 pm    Post subject: Reply with quote

are you sure you don't want to do AddressList.disableAllWithoutExecute() ?

anyhow, best do a reverse loop
Code:

for i=AddressList.Count-1,0,-1 do
  AddressList[i].Active=false
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
Back to top
View user's profile Send private message MSN Messenger
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 577

PostPosted: Fri Feb 24, 2023 6:37 pm    Post subject: Reply with quote

Dark Byte wrote:
are you sure you don't want to do AddressList.disableAllWithoutExecute() ?

anyhow, best do a reverse loop
Code:

for i=AddressList.Count-1,0,-1 do
  AddressList[i].Active=false
end


Why the reverse loop? If the "AddressList.disableAllWithoutExecute()" would work without the for loop then that would be good. I'll try that first. Thanks

ETA: AddressList.disableAllWithoutExecute() didn't work, but the the other one did work.
If I had a memory record that had been set from code such as
dn_class_points4_address and If I wanted to make that record "active", would the code be
dn_class_points4_address.Active=true?
Back to top
View user's profile Send private message Yahoo Messenger
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1053
Location: 0x90

PostPosted: Sat Feb 25, 2023 1:08 am    Post subject: Reply with quote

bknight2602 wrote:

...
If I had a memory record that had been set from code such as
dn_class_points4_address and If I wanted to make that record "active", would the code be
dn_class_points4_address.Active=true?


You can activate the memory record like so:
Code:

AddressList['dn_class_points4_address'].Active = true
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

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

PostPosted: Sat Feb 25, 2023 3:14 am    Post subject: Reply with quote

reverse so all children get deactivated before the parent, so any autodeactivating cide or destruction of records won't affect the index
_________________
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
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 577

PostPosted: Sat Feb 25, 2023 7:43 am    Post subject: Reply with quote

Ok, sounds reasonable.
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