View previous topic :: View next topic |
Author |
Message |
danrevella Master Cheater Reputation: 2
Joined: 11 Jun 2008 Posts: 290
|
Posted: Sat Sep 03, 2016 5:41 pm Post subject: How to get the address of a table |
|
|
Hi!!
I have try to search for this problem, but I was unable to find a solution.
Suppose the follows:
-) I'm playing a new game
-) Search for money on it
-) found the right adress an save it as the first item of a CE table
-) the item I describe it "money", the adress is: 41d080
-) Now I wanna add a new item in the CE table: a script
-) This script have to be able in reading the first item in the table, read his address (41d080), and assign it in a variable in this script, f.e.
pseudo code:
value_money=getaddress(money)
value_money must to be == 41d080
Seems to be simple, but I have try any mode with no solution at all....
I would like also a mixed mode LUA/AA script
Any help please? Thanks
|
|
Back to top |
|
|
Zanzer I post too much Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Sat Sep 03, 2016 7:38 pm Post subject: |
|
|
Code: | local list = getAddressList()
local memrec = list.getMemoryRecordByDescription("money")
if memrec.Value == 0x41D080 then
print("yay")
else
print("boo")
end |
|
|
Back to top |
|
|
danrevella Master Cheater Reputation: 2
Joined: 11 Jun 2008 Posts: 290
|
Posted: Sun Sep 04, 2016 3:12 am Post subject: |
|
|
Many thanks, it works but with a little modification (my guilt, I was not enough clear...)
Code: | local list = getAddressList()
local memrec = list.getMemoryRecordByDescription("money")
------->if memrec.Value == 0x41D080 then<--------
if memrec.Address == 0x41D080 then
print("yay")
else
print("boo")
end |
|
|
Back to top |
|
|
panraven Grandmaster Cheater Reputation: 55
Joined: 01 Oct 2008 Posts: 942
|
Posted: Sun Sep 04, 2016 3:34 am Post subject: |
|
|
It work? May be you are using a very different CE from mine.
Both memrec.Address and memrec.Value is of Lua string type , comparing to a number for equality will always return false.
For address, try memrec.CurrentAddress, it is the evaluated number of the address, return 0 if the address is invalid.
For value, may try read* function on the address with proper type, return nil if address is invalid.
bye~
_________________
- Retarded. |
|
Back to top |
|
|
danrevella Master Cheater Reputation: 2
Joined: 11 Jun 2008 Posts: 290
|
Posted: Sun Sep 04, 2016 4:28 am Post subject: |
|
|
panraven wrote: | It work? May be you are using a very different CE from mine.
Both memrec.Address and memrec.Value is of Lua string type , comparing to a number for equality will always return false.
For address, try memrec.CurrentAddress, it is the evaluated number of the address, return 0 if the address is invalid.
For value, may try read* function on the address with proper type, return nil if address is invalid.
bye~ |
Uhm.....
I am using CE 6.6 beta 1 version (but this is not the problem...)
In fact I didn't need the if/else part of the code so I have not deep examined and utilized that part, I have utilized only the first part of the supplied code.
Sorry for the inconvenience.
BTW, here is my working table.
Description: |
|
Download |
Filename: |
test.CT |
Filesize: |
4.08 KB |
Downloaded: |
616 Time(s) |
|
|
Back to top |
|
|
panraven Grandmaster Cheater Reputation: 55
Joined: 01 Oct 2008 Posts: 942
|
Posted: Sun Sep 04, 2016 5:45 am Post subject: |
|
|
I see.
From your usage, you don't need to alloc/dealloc the symbol _playerbase.
To get the 1st record of the addresslist "first item of a CE table ",ie. topmost,
may use GetAddressList()[0]
eg.
Code: |
[ENABLE]
label(_playerbase)
{$lua}
local addr = GetAddressList()[0].CurrentAddress -- read 1st Entry of memory record
return string.format('%X:',addr~=0 and addr or 1) -- force update to an inavlid address
{$asm}
_playerbase:
registersymbol(_playerbase)
[DISABLE]
unregistersymbol(_playerbase)
|
bye~
_________________
- Retarded. |
|
Back to top |
|
|
danrevella Master Cheater Reputation: 2
Joined: 11 Jun 2008 Posts: 290
|
Posted: Sun Sep 04, 2016 10:06 am Post subject: |
|
|
panraven wrote: | I see.
From your usage, you don't need to alloc/dealloc the symbol _playerbase.
To get the 1st record of the addresslist "first item of a CE table ",ie. topmost,
may use GetAddressList()[0]
bye~ |
Your code does work, and it's really more efficient then mine, BTW, if possible, may you also show me code for obtaining these data table "by name", coz pratically the table grow, and so need this operation may be request more then one single time.
This may help me to easy maintainig a growing table.... (apologize for my poor english, I hope you have understand)
bye!!!
|
|
Back to top |
|
|
Zanzer I post too much Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Sun Sep 04, 2016 10:37 am Post subject: |
|
|
Sounds like you simply want:
Code: | [ENABLE]
label(_playerbase)
test.exe+1D090:
_playerbase:
registersymbol(_playerbase)
[DISABLE]
unregistersymbol(_playerbase) |
Or maybe:
Code: | [ENABLE]
label(_playerbase)
[test.exe+1D090]:
_playerbase:
registersymbol(_playerbase)
[DISABLE]
unregistersymbol(_playerbase) |
|
|
Back to top |
|
|
panraven Grandmaster Cheater Reputation: 55
Joined: 01 Oct 2008 Posts: 942
|
Posted: Sun Sep 04, 2016 10:37 am Post subject: |
|
|
I think Zanzer's code does this, by using 'Description' as 'Name'.
Code: |
local list = getAddressList()
local memrec = list.getMemoryRecordByDescription("money")
local memrec = list[0] -- get by listing order , 0 is 1st entry.
|
bye~
_________________
- Retarded. |
|
Back to top |
|
|
danrevella Master Cheater Reputation: 2
Joined: 11 Jun 2008 Posts: 290
|
Posted: Sun Sep 04, 2016 10:48 am Post subject: |
|
|
Thanks to all!!
You gave me all possible variable in solving the problem!!!
|
|
Back to top |
|
|
Zanzer I post too much Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Sun Sep 04, 2016 11:36 am Post subject: |
|
|
By the way... another possibility is to simply drag and drop a table entry on top of another.
You can then give that child entry an address or pointer like "+10".
This will make all child entries use the parent's address as base.
So when the base address needs to update, you only update a single entry.
|
|
Back to top |
|
|
|