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 


Script Header to change child

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

Joined: 22 May 2019
Posts: 4

PostPosted: Wed May 22, 2019 7:12 pm    Post subject: Script Header to change child Reply with quote

Code:

[]Armor <Script>
     []Armor H Val: X
          [] Thing One Val: X
          [] Thing Two Val: X

So I have a script with a header in it and I want to use lua to change "ArmorH" to 1 on activation and 0 on deactivation. I currently have now clue how to target "ArmorH" through the script however since it has no address

Update:
I have tried a script but was unsuccessful
Code:
{$lua}
if sytaxcheck then return end

[ENABLE]
local list = getAddressList()
mem = list.getMemoryRecordByDescription('Armor')
mem.Value = 1

[DISABLE]
mem.Value = 0


Closer update:
Code:
{$lua}
if sytaxcheck then return end

[ENABLE]
local list = getAddressList()
mem = list.getMemoryRecordByDescription('Thing One')
mem.Value = 1

[DISABLE]
mem.Value = 0

Works fine, but when I add memT which is Thing Two to the mix, Thing Two will not turn into a 1. The only difference between them is their pointer but I can manually set the value
Back to top
View user's profile Send private message
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Wed May 22, 2019 10:13 pm    Post subject: Reply with quote

the variable memrec refers to the current memory record/script and memory records have a Child array property of their child records so from the Armor Script memrec.Child[0].Child[1] would refer to Thing Two. Do remember though that {$lua} is more of a meta-programming feature in AA scripts so it runs before the AA code has ie, before the script has fully enabled or disabled, you can use a timer with an arbitrary delay to wait until the script has been enabled (optionally with an actual check of the memory record if you expect an aobscan to take a long time).

But yeah, explicitly getting the memory record from the Address List using any of the three methods can also work Smile

_________________
https://github.com/FreeER/ has a few CE related repos
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