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 


how to access variable created in a separate script

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

Joined: 05 Jul 2015
Posts: 7

PostPosted: Thu Oct 19, 2017 12:22 pm    Post subject: how to access variable created in a separate script Reply with quote

i want to write a auto assemble script [code injection] which increments a custom variable every time the modified code is run which i use for some logic operations.
if i write the code to create the variable in a separate script and reference the variable in the first it says it cant compile,
if i write the code in the same script before i reference the variable it compiles but i have no way of ensuring that the code to make the variable runs only once.
cant make a run once method without a variable, and the thing i want to run once is the code that creates the variable, its a catch 22
so i was wondering how do i get the address of the newly created variable? if i had that then i could use it instead of the variable name while using the first method with the separate script. if you have a better idea about how to do this please share
Back to top
View user's profile Send private message
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Thu Oct 19, 2017 2:49 pm    Post subject: Reply with quote

Not entirely sure what you want to do but maybe you can just use globalalloc? As long as you use the same name and don't unregister it then every script will use the same memory for that variable. If I recall correctly it'll be all 0s when first allocated so you can use that to tell whether the variable has been initialized or not.
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Thu Oct 19, 2017 4:38 pm    Post subject: Reply with quote

Each script would contain, for example, globalalloc( myvar, 8 )
CE will make sure it only gets allocated once and all scripts point to the same place.
Back to top
View user's profile Send private message
RichardG
How do I cheat?
Reputation: 0

Joined: 05 Jul 2015
Posts: 7

PostPosted: Thu Oct 19, 2017 10:41 pm    Post subject: Reply with quote

thanks for your help, it works fine now
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking 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