|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
justa_dude Grandmaster Cheater Reputation: 23
Joined: 29 Jun 2010 Posts: 891
|
Posted: Thu Jul 08, 2010 5:23 pm Post subject: What's the scope on labels in autoassembly scripts? |
|
|
Stupid question, but what scope do labels have when used in the auto-assembler? Are they part of the global symbol table, meaning that no two simultaneously running scripts should have labels using the same name unless they are to be referring to the same address? If I use the templates more than once in a table, do I need to change the exit/returnhere/etc labels?
How about alloc? Do I need to make sure not to use the "newmem" default more than once?
It's silly, I know, that I've been playing with this thing for a couple of weeks now and am still clueless.
Thanks,
adude
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 465
Joined: 09 May 2003 Posts: 25570 Location: The netherlands
|
Posted: Thu Jul 08, 2010 7:02 pm Post subject: |
|
|
labels and allocs are only valid in the script they are in. More specifically, in the [enable] [disable] (or both)
So you can safely run two scripts with the same labels
As for using the template twice in the same script, ce will deal with this for you (it adds a number after the label names)
To use a label outside the scope of the current script, you must use the "registersymbol" command so that other scripts (and the rest of ce, like tables) can understand what you mean with the specific label name
As for alloc there is a special variant for this:
GlobalAlloc(name,size)
If you use GlobalAlloc it will be registered as a symbol so it's usable by the rest of CE, AND any new call to GlobalAlloc won't allocate the memory again but just gives the already allocated block(But make sure the sizes you give in all scripts are the same, a re-alloc because the size is bigger means that some of the old data will be gone)
---
Of course, most likely you'll be fine with the normal alloc in enable and dealloc in disable, there's usually not that much need for multiple scripts to allocate the same block of memory. Only useful when some scripts need to make use of the same allocated memory, and you're not sure which one will get executed first by the user
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
justa_dude Grandmaster Cheater Reputation: 23
Joined: 29 Jun 2010 Posts: 891
|
Posted: Thu Jul 08, 2010 11:58 pm Post subject: |
|
|
Wow, that's awesome! I've been manually appending digits to my labels out of ignorance - a mundane task that is rather prone to error. And I never even thought to try adding a second template - I've been copying and pasting!
With regard to globalalloc, I suppose the advantage versus using a normal alloc combined with a registered symbol is in the case where you're not sure which block is going to be run first?
Man, CE is just chock full of neat stuff. Thanks for the tool and thank you for the awesome support.
Sincerely,
adude
|
|
Back to top |
|
|
|
|
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
|
|