|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
mg_01 Cheater Reputation: 0
Joined: 28 Jan 2018 Posts: 41
|
Posted: Fri May 22, 2020 3:03 am Post subject: Optimizing a CE-Lua-AHK Workflow? (xpost) |
|
|
hi -- sorry to XPOST this from the other subforum, but i am not sure where it goes 'cause it's a weird topic:
I recently made a video of a workflow I've been using for Marvel vs. Capcom 2 & Cheat Engine.
https://www.youtube.com/watch?v=IJqZkdeSgVA&list=PLBeCkTheRU1IlvRmIdTLgvcEG85wRVne9&index=2
That video shows a macro that launches stuff. I'm using Autohotkey to sort the Cheat Engine table to prepare it for an AHK-image search which uses Lua-scripted AOB searches to recalculate subgroups of addresses.
Honestly, I am just wondering if there was a way to make any of it faster. Like I said, I'm not sure where to post something like this, sorry.
It's mostly the parts involving Cheat Engine & Autohotkey, particularly the scans that find the 3D and 2D Pointers. I was wondering it here was a way to automate that or have it execute automatically.
Sorry again!
|
|
Back to top |
|
|
panraven Grandmaster Cheater Reputation: 55
Joined: 01 Oct 2008 Posts: 942
|
Posted: Fri May 22, 2020 4:35 am Post subject: |
|
|
Tell me if I'm mistaken your ahk workflow.
There is a main CE instance with many entries, let said it MAIN.
And there is multiple other CE instances just for AOBScan, let said them SUBs
The ahk workflow is like:
1. reset MAIN's layout ( kind of preparation ocr-ing in 3? )
2. launch multiple SUBs, do the scan and Ahk copy the result 1 by 1,
3. with each result, ahk identify the respective MAIN entry by ocr, and paste the result into the entry.
that's it?
If so, CE have the ability to done all within MAIN, by using registered symbols, a AA script, and possible reformat other address entries with the scanned symbol.
To do so,
1. replace your explicit numerical address in the entries with a meaning naming, like ASSIST, COMBO, LIFEBAR etc.
2. make an AA script with format like (since the aobscan only need 1 result):
Code: |
aobscan(ASSIST, aob-for-asist)
registersymbol(ASSIST)
aobscan(COMBO, aob-for-combo)
registersymbol(COMBO)
aobscan(LIFEBAR, aob-for-lifebar)
registersymbol(LIFEBAR)
...
|
3.reformat address entries:
find out those address entries that depend of the scanned address, said if address entry '01_Assist_OK' is the scanned address ASSIST, and address entry 'Assist OK 02' is depend on it, then find the difference (relative offset, +18 (in hex, it is 24 in decimal base number) from video), then replace address of 'Assist OK 02' by ASSIST+18.
Then the ahk is not need, and recalculate address will be automatic.
_________________
- Retarded. |
|
Back to top |
|
|
mg_01 Cheater Reputation: 0
Joined: 28 Jan 2018 Posts: 41
|
Posted: Fri May 22, 2020 6:54 am Post subject: |
|
|
Yes, I think that's accurate
I've heard of doing it in AA as a script that you can launch. The only problem is I have hundreds of addresses that depend on the result.
Does your instruction mean I have to find the offset of all the children-addresses manually and input their difference in HEX as part of the AA script?
If that's the case, then I think AHK is probably faster than finding the offset for hundreds of addresses.
Edit: I just remembered that AA lets you use LUA inside, right? So I could re-create my AOB scan process and have that run one by one using AA scripts inside of the main table, then have the copy-pasting stuff happen just the same.
I'd be saving time because I wouldn't have to launch the 6 SUB windows for each AOB scan -- they would all be accessible inside of the main table, I believe. That's if AA lets me do the whole process of scanning and copying it every time I execute the AA Script.
?
|
|
Back to top |
|
|
panraven Grandmaster Cheater Reputation: 55
Joined: 01 Oct 2008 Posts: 942
|
Posted: Fri May 22, 2020 11:57 am Post subject: |
|
|
Lua may help to batch convert those numerical address to symbolic equivalent.
To start, it may be helpful to look at your structure of address in the entries.
There are relation between 2 address most likely because they are members in the same memory structure/class. So related address should be group together.
BACKUP ORIGINAL TABLE.
The following code should sort the address in your table with respective description, see if they group with each others
Code: |
local r={}
for i=1,AddressList.Count do
local mr = AddressList[i-1]
if mr.Address and #mr.Address>0 then r[1+#r]={mr.Address, mr.Description}end
end
local function GetAddr(a) return getAddressSafe(a) or a end
table.sort(r,function(a,b)
a,b = GetAddr(a[1]),GetAddr(b[1])
if not a or not b then
return false
elseif type(a)~=type(b)then
return type(a)<type(b)
else
return a<b
end
end)
for i=1,#r do
print(string.format('%20s : %s',table.unpack(r[i],1,2)))
end
|
Then if they do show grouping, try find a respective proper offset range , then setup following bases.
The following script should batch convert numerical address to symbolic.
Code: |
-- setup bases SYMBOL = {desc=target-base-description, range=offset-range-for-grouping}
local bases = {-- address_symbol = memory record description
XXXX = {desc='x1234',range=0x1024},
YYYY = {desc='y1234',range=0x1024},
}
-- setup bases end
function validAddr(addr)
return type(addr)=='string' and addr:match'^%x+$' and GetAddressSafe(addr)
end
for symbol,data in pairs(bases) do
local baseMr, baseAddr
for i=1,AddressList.Count do
local mr = AddressList[i-1]
if mr.Description == data.desc then
baseMr = mr
baseAddr = validAddr(mr.Address)
break
end
end
if not baseMr then
print('no memory record with description: '..data.desc)
elseif baseMr.Adddress == symbol then
print('symbol done:'..symbol)
elseif not baseAddr then
print('Invalid address :'..baseMr.Address..' for '..baseMr.Description)
else
for i=1,AddressList.Count do
local mr = AddressList[i-1]
local addy = validAddr(mr.Address)
if mr~=baseMr and addy then
if baseAddr<addy+data.range and baseAddr>=addy-data.range then
local offset = addy - baseAddr
mr.Address = offset<0 and string.format("%s-%X",symbol,-offset) or
string.format("%s+%X",symbol,offset)
end
end
end
baseMr.Address = symbol
end
end
|
_________________
- Retarded. |
|
Back to top |
|
|
mg_01 Cheater Reputation: 0
Joined: 28 Jan 2018 Posts: 41
|
Posted: Sat May 23, 2020 8:03 pm Post subject: |
|
|
Sorry, I don't know enough to follow the second half of your post. I'm not sure what I'm supposed to be looking for in the print out of the address table (which i uploaded here: https://pastebin.com/6czr1cNL)
beyond the few pointer addresses I have, everything else was added the standard way that requires offsetting.
I get the feeling I'm in way over my head with this.
|
|
Back to top |
|
|
panraven Grandmaster Cheater Reputation: 55
Joined: 01 Oct 2008 Posts: 942
|
Posted: Sun May 24, 2020 9:35 am Post subject: |
|
|
hi,
with your pastebin data, I setup this setup table bases in second script
Code: |
local bases = {-- address_symbol = memory record description
ASSIST = {desc='01_Assists_OK',range=0x300,negRange=0x180},
COMBO = {desc='02_P1_Combo_Meter_Message',range=0x300,negRange=0x180},
LIFEBAR = {desc='03_P1_A_Lifebar_Portrait',range=0x300,negRange=0x180},
TRAINING = {desc='Training Menu S',range=0x300,negRange=0x180},
-- 03_P1_A_Lifebar_Portrait
}
|
The code is modified due to range should be positive and negative specify-able.
THE NEW CODE IS HERE.
The result for this 4 symbol ASSIST/COMBO/LIFEBAR/TRAINING is as pic shown.
You need to setup the table bases like this:
1. Name the scanned symbols (ASSIST/COMBO ... etc);
2. Associate the symbol name to memory record description that the address match (01_Assists_OK/02_P1_Combo_Meter_Message ... etc);
3. setup the range (positive, upper bound offset) and negRange (negative, lower bound offset), they can be omitted then it will be default 0x300, 0x100 respectively as in inRange function, the default can be modified.
You may try the script in pastebin like this:
1. make a NEW ce instance
2. delete all memory record if any;
3. load your ORIGINAL TABLE with NO MERGE option;
4. copy pastebin script and paste all into menu/table/[show cheat engine lua script];
5. save it as, said TEST.ct
...THEN...
6. run the script
7. see if the conversion result right
8. mostly likely the range need to fine adjustment;
9. to re-test, load TEST.ct again
10. adjust your modification (eg.ranges), then repeat from 6
Description: |
|
Filesize: |
14.65 KB |
Viewed: |
1767 Time(s) |
|
_________________
- Retarded. |
|
Back to top |
|
|
mg_01 Cheater Reputation: 0
Joined: 28 Jan 2018 Posts: 41
|
Posted: Tue May 26, 2020 3:33 am Post subject: |
|
|
hi,
i pasted your code and ran it, but I'm not sure what you're referring to by the 'ranges'. I keep getting "Invalid address (for all the bases")"
I tried adding another symbol, "TIMER" to it. (line7)
The CE on the left is using the old-way to recalculate the value. I'm not sure what the offset ranges are, if not the exact values themselves.
Thank you for your continued help.
Description: |
|
Filesize: |
179.25 KB |
Viewed: |
1685 Time(s) |
|
|
|
Back to top |
|
|
panraven Grandmaster Cheater Reputation: 55
Joined: 01 Oct 2008 Posts: 942
|
|
Back to top |
|
|
mg_01 Cheater Reputation: 0
Joined: 28 Jan 2018 Posts: 41
|
Posted: Tue May 26, 2020 3:33 pm Post subject: |
|
|
Sure, thank you!
|
|
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
|
|