|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
jgoemat Master Cheater Reputation: 22
Joined: 25 Sep 2011 Posts: 252
|
Posted: Wed Jan 08, 2020 11:06 pm Post subject: Autoregister? |
|
|
I was thinking how it can be a pain in a large script to label, register, and unregister everything and thought something like this would be nice that would handle all three, and work with multiple names on a single line:
Code: | autoregister(pPlayer, bEnableGodMode, bEnableOneHitKill, bEnableFly) |
That would in effect add this to the [enable] section:
Code: |
label(pPlayer)
label(bEnableGodMode)
label(bEnableOneHitKill)
label(bEnableFly)
registersymbol(pPlayer)
registersymbol(bEnableGodMode)
registersymbol(bEnableOneHitKill)
registersymbol(bEnableFly)
|
and this to the [disable] section:
Code: |
unregistersymbol(pPlayer)
unregistersymbol(bEnableGodMode)
unregistersymbol(bEnableOneHitKill)
unregistersymbol(bEnableFly)
|
Would anyone else find this useful? I thought I might be able to do it easy in getScript(), but I'm getting caught up on something, I don't understand:
Code: |
newscript.AddObject(code[i], code.Objects[i]);
|
code is TStrings, I thought it would just be basically an array of the lines. When I try to add my own lines with just Add() it doesn't work, and when I try AddObject(s, s) it says AnsiString is not TObject....
When I add watches to a normal script to that line, it looks like code is TSTRINGS and code[i] is TSTRINGS also (not string?), but code.Objects[i] says Error: Type TSTRINGS has no component named OBJECTS[0]...
With my code and I try to save the script with an autoregister I get 'Not all code is injectable. (Error in line 0(label()) :label is not defined in the script)'
Stepping through my code it looks like I'm adding the correct strings using newScript.Add(), but I'm guessing I need to use AddObject like the existing code but don't know how to convert AnsiString to TObject...
I'm not very handy with lazarus, I can't figure out how to see anything useful from an instance of TStringList usingi the debugger watch or evaluate, except maybe the count of elements...
My WIP is in a pull request to my own repo on github at JasonGoemaat/cheat-engine-1/pull/1/files
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25295 Location: The netherlands
|
Posted: Thu Jan 09, 2020 2:12 am Post subject: |
|
|
Or just remove the label lines and only leave registersymbol
for example, this code is valid:
Code: |
alloc(bla,1024)
registersymbol(somelabel)
bla:
nop
nop
nop
somelabel:
nop
nop
nop
|
the code.objects[] thing is just my way of keeping track of the original line numbering, for inserted lines it has no meaning, except that you should look up for the line that inserted it for error messages
but perhaps instead of making it insert new lines, we could update registerSymbol and/or label to accept a comma separated input instead of just one, and no need to inject extra lines
Edit:
Just changed the code so scripts like this work now:
Code: |
alloc(bla,1024)
registersymbol(xxx,yyy,zzz)
bla:
nop
xxx:
nop
yyy:
nop
zzz:
|
_________________
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 |
|
|
|
|
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
|
|