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 


Trying to 'check' certain checkboxes using script alone

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
justanotherperson
How do I cheat?
Reputation: 0

Joined: 16 Nov 2022
Posts: 4

PostPosted: Sat Nov 19, 2022 10:02 am    Post subject: Trying to 'check' certain checkboxes using script alone Reply with quote

I want to run a lua script after loading my table that finds certain checkboxes by name, sees if they are checked or not, and checks them if they are not already checked.

Additionally, after checking the appropriate boxes, I'd like to write certain values to the corresponding field for these checkboxes.

Is there a method to search for a checkbox by name? I see there is .State to get the state of the checkbox but how do I actually find the checkbox itself (by name) in order to change its state?

Edit: the only reason i need to find the checkbox first and not just the value itself is because the checkbox is actually a script that runs and then provides the values that need changing.

This is something along the lines of what I'd like to do (I know it's wrong):

Code:
local s = getSettings()
local box = s.getCheckboxByDescription('Player')
if box.State == 0 then
   box.State = 1
end
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Sat Nov 19, 2022 12:23 pm    Post subject: Reply with quote

What do you mean by checkbox? Are you talking about memory records (address list, bottom half of main window), or Is it an instance of the CheckBox class (e.g. something you created via `createCheckBox` or the custom form designer)?

Assuming you're talking about memory records, look at the Addresslist and MemoryRecord classes in celua.txt. Particularly the `getMemoryRecordByDescription` method and `Active` property of the respective class.
Code:
local memrec = assert(AddressList.getMemoryRecordByDescription'Player', 'Memrec "Player" does not exist')
if not memrec.Active then
  memrec.Active = true
end

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
justanotherperson
How do I cheat?
Reputation: 0

Joined: 16 Nov 2022
Posts: 4

PostPosted: Sat Nov 19, 2022 12:46 pm    Post subject: Reply with quote

It's in the bottom half of the main window, as if you would open a cheat table and there would be boxes on the left to check which would enable/disable a certain part of the table. It's a literal checkbox you can see in the lower half of the main ui, with a name and script next to it.

I guess what I'm trying to ask is, in the same way that you would do

local x = AddressList.getMemoryRecordByDescription('some string').Value
to "find" a value in your table based on the name of it
and then be able to do operations with/on that 'x' variable

is there a way to do that with checkboxes, so that i can find the checkbox on my table with a certain name, check it/enable it using lua, and then by extension have it run the script that normally runs by the user manually 'checking' / enabling that box?

The only methods I see listed for checkbox are getState, setState, and onChange, but how do i actually FIND the box and assign it to a variable so that I can use the methods on it? (check or uncheck the box)

And I did not use createCheckbox, this is someone else's table I'm trying to save a certain 'preset' for

*EDIT: I think I get what you're saying now, anything in that bottom half window in the main UI is part of the address list and can be assigned to a variable with getMemoryRecordByDescription, and Active would be to toggle it on.

** HEY THANKS I GOT IT WORKING ** Very Happy
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 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