[HELP] Change Group value using Script

Anything Cheat Engine related, bugs, suggestions, helping others, etc..
Post Reply
Mopzilla
Noobzor
Noobzor
Posts: 7
Joined: Tue May 26, 2020 4:37 am
Reputation: 0

[HELP] Change Group value using Script

Post by Mopzilla »

I have managed to create a header/group using the assembly so I can script it.



I want this group to enable all children and set their values to 1 when it is selected.



I can do this easier by just enabling the options for the group where if it is selected then so are the children, and the children have the same value as the group.



The part I am stuck on is changing the value of the group the script is on, when it is enabled.



[ENABLE]

change value to 1



[DISABLE]

change value to 0

User avatar
happyTugs
Table Makers
Table Makers
Posts: 127
Joined: Mon Apr 20, 2020 1:01 am
Reputation: 146

[HELP] Change Group value using Script

Post by happyTugs »

One way using lua.[CODE=cea]{$LUA}

if syntaxcheck then return end

[ENABLE]

getAddressList().getMemoryRecordByDescription('nameOfHeader').value = 1



[DISABLE]

getAddressList().getMemoryRecordByDescription('nameOfHeader').value = 0

[/CODE]The script itself will be used as the header.

I am also assuming that the 'Setting a value to this entry sets same value to children' has been ticked.
Last edited by happyTugs on Tue May 26, 2020 5:38 am, edited 4 times in total.

TimFun13
Expert Cheater
Expert Cheater
Posts: 1354
Joined: Fri Mar 03, 2017 12:31 am
Reputation: 6

[HELP] Change Group value using Script

Post by TimFun13 »

Make the header a script and use something like this:

[CODE=cea]{$lua}

if syntaxcheck then return end

for i = 0, memrec.Count - 1 do

if memrec.Active then

memrec[i].Value = '0'

else

memrec[i].Value = '1'

end

end

------------------------------ ENABLE ------------------------------

[ENABLE]

------------------------------ DISABLE ------------------------------

[DISABLE]

[/CODE]

Mopzilla
Noobzor
Noobzor
Posts: 7
Joined: Tue May 26, 2020 4:37 am
Reputation: 0

[HELP] Change Group value using Script

Post by Mopzilla »

[QUOTE="happyTugs, post: 136902, member: 39952"]

One way using lua.[CODE=cea]{$LUA}

if syntaxcheck then return end

[ENABLE]

getAddressList().getMemoryRecordByDescription('nameOfHeader').value = 1



[DISABLE]

getAddressList().getMemoryRecordByDescription('nameOfHeader').value = 0

[/CODE]The script itself will be used as the header.

I am also assuming that the 'Setting a value to this entry sets same value to children' has been ticked.

[/QUOTE]

This is perfect, I am just curious. What do the first 2 lines do?

User avatar
happyTugs
Table Makers
Table Makers
Posts: 127
Joined: Mon Apr 20, 2020 1:01 am
Reputation: 146

[HELP] Change Group value using Script

Post by happyTugs »

[CODE]{$LUA} :: lets CE know that Lua syntax is being used

if syntaxcheck then return end :: stop CE from executing lua code if it's performing a syntaxcheck

getAdressList() :: returns the cheat table 'Addresslist' UserData object

getMemoryRecordByDescription(description) :: returns a 'MemoryRecord' object based on it's description

value :: member variable of the object/class

[/CODE]
Last edited by happyTugs on Thu Jan 01, 1970 12:00 am, edited 2 times in total.

Mopzilla
Noobzor
Noobzor
Posts: 7
Joined: Tue May 26, 2020 4:37 am
Reputation: 0

[HELP] Change Group value using Script

Post by Mopzilla »

[QUOTE="happyTugs, post: 136966, member: 39952"]

[CODE]{$LUA} :: lets CE know that Lua syntax is being used

if syntaxcheck then return end :: stop CE from executing lua code if it's performing a syntaxcheck

getAdressList() :: returns the cheat table 'Addresslist' UserData object

getMemoryRecordByDescription(description) :: returns a 'MemoryRecord' object based on it's description

value :: member variable of the object/class

[/CODE]

[/QUOTE]

Thank you, you wouldn't know how to add a script just like this one to an existing record? As far as I currently know I can only use this script if I create a new record/group, but I want to attach it to an existing record.

User avatar
happyTugs
Table Makers
Table Makers
Posts: 127
Joined: Mon Apr 20, 2020 1:01 am
Reputation: 146

[HELP] Change Group value using Script

Post by happyTugs »

[QUOTE]The script itself will be used as the header. [/QUOTE]Make the script the header and supply the given name
Last edited by happyTugs on Thu Jan 01, 1970 12:00 am, edited 1 time in total.

Mopzilla
Noobzor
Noobzor
Posts: 7
Joined: Tue May 26, 2020 4:37 am
Reputation: 0

[HELP] Change Group value using Script

Post by Mopzilla »

[QUOTE="happyTugs, post: 136968, member: 39952"]

Make the script the header and supply the given name

[/QUOTE]

Is this the only way? Is it not possible to attach a script to an existing record?

User avatar
happyTugs
Table Makers
Table Makers
Posts: 127
Joined: Mon Apr 20, 2020 1:01 am
Reputation: 146

[HELP] Change Group value using Script

Post by happyTugs »

Did you even look at the example?

If the 'existing record' is a header, then no.

The header is not a script; therefore, you make a script, give it a name, put that name into the script, and use that as the header.

Is that too difficult to do?
Last edited by happyTugs on Thu Jan 01, 1970 12:00 am, edited 3 times in total.

Mopzilla
Noobzor
Noobzor
Posts: 7
Joined: Tue May 26, 2020 4:37 am
Reputation: 0

[HELP] Change Group value using Script

Post by Mopzilla »

[QUOTE="happyTugs, post: 136973, member: 39952"]

Did you even look at the example?

If the 'existing record' is a header, then no.

The header is not a script; therefore, you make a script, give it a name, put that name into the script, and use that as the header.

Is that too difficult to do?

[/QUOTE]

I did look at the example, from what I gathered you created the header using the auto assembly so it has a script attached, and then dragged other records and put them as children.



I don't really get what you mean.

User avatar
happyTugs
Table Makers
Table Makers
Posts: 127
Joined: Mon Apr 20, 2020 1:01 am
Reputation: 146

[HELP] Change Group value using Script

Post by happyTugs »

[QUOTE]Is it not possible to attach a script to an existing record? [/QUOTE]If the 'existing record' is a script, then simply append it to the script itself.

[CODE=lua][ENABLE]

{$LUA}

if not syntaxcheck then

getAddressList().getMemoryRecordByDescription('nameOfHeader').value = 1

-- if you have some more lua scripting, add them here

end

{$ASM}

// paste your assembly code in the enable section here



[DISABLE]

{$LUA}

if not syntaxcheck then

getAddressList().getMemoryRecordByDescription('nameOfHeader').value = 0

-- if you have some more lua scripting, add them here

end

{$ASM}

// paste your assembly code in the disable section here[/CODE]
Last edited by happyTugs on Thu Jan 01, 1970 12:00 am, edited 3 times in total.

Mopzilla
Noobzor
Noobzor
Posts: 7
Joined: Tue May 26, 2020 4:37 am
Reputation: 0

[HELP] Change Group value using Script

Post by Mopzilla »

[QUOTE="happyTugs, post: 136975, member: 39952"]

If the 'existing record' is a script, then simply append it to the script itself.

[CODE=lua][ENABLE]

{$LUA}

if not syntaxcheck then

getAddressList().getMemoryRecordByDescription('nameOfHeader').value = 1

-- if you have some more lua scripting, add them here

end

{$ASM}

// paste your assembly code in the enable section here



[DISABLE]

{$LUA}

if not syntaxcheck then

getAddressList().getMemoryRecordByDescription('nameOfHeader').value = 0

-- if you have some more lua scripting, add them here

end

{$ASM}

// paste your assembly code in the disable section here[/CODE]

[/QUOTE]

The existing record is not a script. I can just create a parent and have it be a child like the thing I was posting about. It would just look nicer if the script could be attached to the existing record.

TimFun13
Expert Cheater
Expert Cheater
Posts: 1354
Joined: Fri Mar 03, 2017 12:31 am
Reputation: 6

[HELP] Change Group value using Script

Post by TimFun13 »

Make the script then select and drag the child records you want to the script to make then children belonging to the script. Then the script will act like a group header.
Last edited by TimFun13 on Thu Jan 01, 1970 12:00 am, edited 1 time in total.

Post Reply

Who is online

Users browsing this forum: No registered users