View previous topic :: View next topic |
Author |
Message |
Astaroth4256 Advanced Cheater
Reputation: 0
Joined: 25 May 2014 Posts: 59
|
Posted: Mon Apr 27, 2020 6:58 pm Post subject: Strings in cheat table |
|
|
I googled a little and didn't found anything so I have another autistic question of the day.
Is there a way to efficiently add string addresses to cheat table?
Like, if string length is less than 16 then the address value is the string itself, but if it's longer then it turns into a pointer. Having two addresses in cheat table per string makes it kinda ugly so is there a way to fix that? |
|
Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4702
|
Posted: Mon Apr 27, 2020 7:55 pm Post subject: |
|
|
I can't think of any easy way of doing that with custom value types.
You could use Lua and have a timer periodically check and update the memory record if it changes.
Setting OnGetDisplayValue per memory record might be better, but I'm not sure if it's safe to change the memory record's type in that function. (if not, use the new "createTimer(delay, function(...),...)" added in 7.1) _________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
 |
Astaroth4256 Advanced Cheater
Reputation: 0
Joined: 25 May 2014 Posts: 59
|
Posted: Mon Apr 27, 2020 8:32 pm Post subject: |
|
|
Sounds complicated. I don't know any of the CE scripting so I was hoping for a quick solution. Thanks anyway. |
|
Back to top |
|
 |
panraven Grandmaster Cheater
Reputation: 62
Joined: 01 Oct 2008 Posts: 958
|
Posted: Mon Apr 27, 2020 10:42 pm Post subject: |
|
|
May make a custom symbol lookup.
The following make a custom symbol lookup with the spec:
(MustHave '.')(MustHave 'Lua Global Variable Name')(optional '#' 'hex offset')
the single quote is the parts of valid symbol format.
eg. .ShortAddr#11 =>
Lua Variable = ShortAddr, hex offset = 11
then if there is a ShortAddr lua global variable and have value 'SleepEx'
the .ShortAddr#11 will parse as address value SleepEx+11
Code: | if dotSymbolAliasLookup then
dotSymbolAliasLookup=nil,unregisterSymbolLookupCallback(dotSymbolAliasLookup)
end
dotSymbolAliasLookup = registerSymbolLookupCallback(function(sym)
if #sym<2 or sym:sub(1,1)~='.'then return end
local var, ofs = sym:match'^%.([_%a][_%w]*)#(%x+)$'
if not ofs then var,ofs = sym:sub(2),0 else ofs=tonumber(ofs,16)end
local val = _G[var]
local adr = type(val)=='string' and GetAddressSafe(val)or
type(val)=='number' and math.tointeger(val)
return adr and adr + ofs
end,slNotSymbol) |
so the long complex normal address string can be hold by a lua var with shorter naming.
oops: I may mistaken the autistic requirement tho ~_~ _________________
- Retarded. |
|
Back to top |
|
 |
Astaroth4256 Advanced Cheater
Reputation: 0
Joined: 25 May 2014 Posts: 59
|
Posted: Tue Apr 28, 2020 2:45 am Post subject: |
|
|
panraven wrote: | May make a custom symbol lookup.
The following make a custom symbol lookup with the spec:
(MustHave '.')(MustHave 'Lua Global Variable Name')(optional '#' 'hex offset')
the single quote is the parts of valid symbol format.
eg. .ShortAddr#11 =>
Lua Variable = ShortAddr, hex offset = 11
then if there is a ShortAddr lua global variable and have value 'SleepEx'
the .ShortAddr#11 will parse as address value SleepEx+11
Code: | if dotSymbolAliasLookup then
dotSymbolAliasLookup=nil,unregisterSymbolLookupCallback(dotSymbolAliasLookup)
end
dotSymbolAliasLookup = registerSymbolLookupCallback(function(sym)
if #sym<2 or sym:sub(1,1)~='.'then return end
local var, ofs = sym:match'^%.([_%a][_%w]*)#(%x+)$'
if not ofs then var,ofs = sym:sub(2),0 else ofs=tonumber(ofs,16)end
local val = _G[var]
local adr = type(val)=='string' and GetAddressSafe(val)or
type(val)=='number' and math.tointeger(val)
return adr and adr + ofs
end,slNotSymbol) |
so the long complex normal address string can be hold by a lua var with shorter naming.
oops: I may mistaken the autistic requirement tho ~_~ |
Thank you kind sir but I spent a good ~30 minutes trying to understand what to do with this and I failed. What am I supposed to do with the lua variables? |
|
Back to top |
|
 |
panraven Grandmaster Cheater
Reputation: 62
Joined: 01 Oct 2008 Posts: 958
|
Posted: Tue Apr 28, 2020 3:15 am Post subject: |
|
|
If you have a symbol address like
[[[GAME.EXE+123456]+110]+1f0]+224]+48
You can set a Lua variable like
XYZ = "[[[GAME.EXE+123456]+110]+1f0]+224]+48"
(in Lua script MENU/Table/Show Cheat Table Lua Script,
or in memory record script type {$lua}...{$asm} block)
then use another symbol address
.XYZ to means the address [[[GAME.EXE+123456]+110]+1f0]+224]+48
or
.XYZ#10 to means the address [[[GAME.EXE+123456]+110]+1f0]+224]+48+10
Sorry if this still not clear enough. _________________
- Retarded. |
|
Back to top |
|
 |
Astaroth4256 Advanced Cheater
Reputation: 0
Joined: 25 May 2014 Posts: 59
|
Posted: Tue Apr 28, 2020 3:39 am Post subject: |
|
|
I get it now, thanks. |
|
Back to top |
|
 |
|