View previous topic :: View next topic |
Author |
Message |
RichardG How do I cheat? Reputation: 0
Joined: 05 Jul 2015 Posts: 7
|
Posted: Thu Oct 19, 2017 12:22 pm Post subject: how to access variable created in a separate script |
|
|
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 |
|
|
FreeER Grandmaster Cheater Supreme Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Thu Oct 19, 2017 2:49 pm Post subject: |
|
|
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 |
|
|
Zanzer I post too much Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Thu Oct 19, 2017 4:38 pm Post subject: |
|
|
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 |
|
|
RichardG How do I cheat? Reputation: 0
Joined: 05 Jul 2015 Posts: 7
|
Posted: Thu Oct 19, 2017 10:41 pm Post subject: |
|
|
thanks for your help, it works fine now |
|
Back to top |
|
|
|