View previous topic :: View next topic |
Author |
Message |
rcgldr How do I cheat?
Reputation: 0
Joined: 22 Jan 2010 Posts: 7
|
Posted: Mon Feb 07, 2022 6:06 pm Post subject: simple script to disable table memory record check box |
|
|
I'm using a basic script, cheat table framework code with just enable and disable, each followed by addresses and db to inject code.
I would like one of the checkboxes to uncheck another checkbox (and vice versa), but I'm either using the wrong type of script, or I'm not getting the syntax correct. I don' t know how to identify a checkbox (the number), but there are only 8, so I can find it by trial and error:
I'm trying to do something like this:
[enable]
abcdef:
db 01 23
CETrainer.CECheckBox3=false
[disable]
abcdef:
db 45 67
Last edited by rcgldr on Tue Feb 08, 2022 5:36 am; edited 1 time in total |
|
Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 37
Joined: 16 Feb 2017 Posts: 1525
|
Posted: Mon Feb 07, 2022 8:21 pm Post subject: |
|
|
Code: | [ENABLE]
abcdef:
db 01 23
{$lua}
CETrainer.CECheckBox3=false
{$asm}
[DISABLE]
abcdef:
db 45 67
{$lua}
CETrainer.CECheckBox3=true |
_________________
|
|
Back to top |
|
 |
rcgldr How do I cheat?
Reputation: 0
Joined: 22 Jan 2010 Posts: 7
|
Posted: Mon Feb 07, 2022 9:30 pm Post subject: |
|
|
AylinCE wrote: |
[ENABLE]
{$lua}
CETrainer.CECheckBox3=false
{$asm}
|
I get an error: "Attempt to index a nill value (global CETrainer)"
|
|
Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 37
Joined: 16 Feb 2017 Posts: 1525
|
Posted: Tue Feb 08, 2022 12:48 am Post subject: |
|
|
1) Probably Trainer name is not "CETrainer" but what?
UDF1 ?
Trainer Generator "CETrainer" ?
The second option is;
You must open the trainer in form editing at least once.
1) Click Trainer Genarator >> Click > Go back to generated designer.
2) Close Trainer designer.
3) CE >> Main menu >> Table >> (Click) CETrainer >> Edit
4) Now look over there, if there is no "Checkbox" on the form, put one there.
5) Close the designer and run the following code in the address list.
Code: | [ENABLE]
//abcdef:
//db 01 23
{$lua}
if syntaxcheck then return end
CETrainer.CECheckbox3.checked=false
{$asm}
[DISABLE]
//abcdef:
//db 45 67
{$lua}
CETrainer.CECheckbox3.checked=true |
CETrainer.CECheckbox1 ? 3 ?
_________________
|
|
Back to top |
|
 |
rcgldr How do I cheat?
Reputation: 0
Joined: 22 Jan 2010 Posts: 7
|
Posted: Tue Feb 08, 2022 5:09 am Post subject: |
|
|
AylinCE wrote: | 1) Probably Trainer name is not "CETrainer" but what?
UDF1 ? |
I'm not creating a trainer, just creating a .CT file with scripts that is loaded and run from the main Cheat Engine table window. What is the syntax | names for the items you add to the main table?
Note - each script does the "other" scripts disable before doing its own enable, so unmarking the "other" check box is just for the visual. What I'm trying to do visually is clear a table memory record check box. I updated the thread title to make this clear. I didn't know it was called memory record when I started this thread.
Sorry for the confusing title. This was the first time I tried this. I got it to work using this change to my scripts:
Code: |
enable:
{$lua}
local al = getAddressList()
local mr = al.getMemoryRecordByDescription('other')
mr.Active = False
{$asm}
|
|
|
Back to top |
|
 |
LeFiXER Grandmaster Cheater Supreme
Reputation: 20
Joined: 02 Sep 2011 Posts: 1069 Location: 0x90
|
Posted: Tue Feb 08, 2022 6:22 am Post subject: |
|
|
rcgldr wrote: |
I'm not creating a trainer, just creating a .CT file with scripts that is loaded and run from the main Cheat Engine table window. What is the syntax | names for the items you add to the main table?
Note - each script does the "other" scripts disable before doing its own enable, so unmarking the "other" check box is just for the visual. What I'm trying to do visually is clear a table memory record check box. I updated the thread title to make this clear. I didn't know it was called memory record when I started this thread.
Sorry for the confusing title. This was the first time I tried this. I got it to work using this change to my scripts:
Code: |
enable:
{$lua}
local al = getAddressList()
local mr = al.getMemoryRecordByDescription('other')
mr.Active = False
{$asm}
|
|
You can also use a function like this to toggle the script within the cheat table:
Code: |
function getMemRec(desc)
local al = getAddressList()
local mr = al.getMemoryRecordByDescription(desc)
-- Check if the entry exists
if mr ~= nil then
return mr
else
return nil
end
function toggle(desc)
local m = getMemRec(desc)
m.active = not m.active
end
-- Usage:
[ENABLE]
{$LUA}
toggle('description of entry')
{$ASM}
[DISABLE]
{$LUA}
toggle('description of entry')
|
I realise that you have found the solution, I just thought I would point out another method to how this can be achieved.
|
|
Back to top |
|
 |
rcgldr How do I cheat?
Reputation: 0
Joined: 22 Jan 2010 Posts: 7
|
Posted: Tue Feb 08, 2022 8:11 am Post subject: |
|
|
LeFiXER wrote: | I realise that you have found the solution, I just thought I would point out another method to how this can be achieved. | In this case, I'm trying to emulate a pair of radio buttons. When one is activated, the other is deactivated (no need to check it if was active or not before deactivating it).
I don' t know if deactivating a memory record triggers its disable script, but it doesn't matter. The sequence for each memory record activation is to set the other memory record active state to false (to clear the check box), then in the script, do the other script disable, then do the current script enable.
|
|
Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4704
|
Posted: Tue Feb 08, 2022 11:41 am Post subject: |
|
|
The simplest way is pretty much this:
Code: | // script1
[ENABLE]
{$lua}
if syntaxcheck then return end
local mr = AddressList.getMemoryRecordByDescription'script2'
if mr.Active then
mr.Active = false
end
{$asm}
[DISABLE] |
Code: | // script2
[ENABLE]
{$lua}
if syntaxcheck then return end
local mr = AddressList.getMemoryRecordByDescription'script1'
if mr.Active then
mr.Active = false
end
{$asm}
[DISABLE] | Setting a memory record's Active state to false will run the [DISABLE] section for scripts.
I'm not sure if CE's AA is reentrant in general, but this seems to work in simple cases.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
 |
rcgldr How do I cheat?
Reputation: 0
Joined: 22 Jan 2010 Posts: 7
|
Posted: Tue Feb 08, 2022 5:19 pm Post subject: |
|
|
ParkourPenguin wrote: | Setting a memory record's Active state to false will run the [DISABLE] section for scripts. | I updated my script to include the if then end stuff, which may not be needed now, but it's there as a reference for me if I make another cheat table. Thanks for the help.
|
|
Back to top |
|
 |
|