|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
bknight2602 Grandmaster Cheater Reputation: 0
Joined: 08 Oct 2012 Posts: 577
|
Posted: Sun Jan 23, 2022 2:48 pm Post subject: Addresslist addresses, values, Descriptions |
|
|
I' running a code on one of my tables
Code: |
addresslist = getAddressList()
for x = 0,addresslist.Count-1
do
test = addresslist,x
print(test)
end |
The output is the same record.
If I change the print to print(x), the output is the number of records, so why is the record the same?
What I am ultimately seeking, after my question is to output the table record addresses, descriptions and values.
|
|
Back to top |
|
|
LeFiXER Grandmaster Cheater Supreme Reputation: 20
Joined: 02 Sep 2011 Posts: 1053 Location: 0x90
|
Posted: Sun Jan 23, 2022 3:05 pm Post subject: |
|
|
That's because you're printing the iterator and not the entry of the addresslist, not to mention that you have used a comma instead of the period character as the accessor.
Code: |
local al = getAddressList()
for x = 0, al.Count - 1 do
local mr = al.getMemoryRecord(x)
if mr ~= nil then
print('description:\t' .. mr.description .. '\nvalue:\t\t' .. mr.value .. '\naddress:\t\t' .. mr.address)
else
print('No memory records')
end
end
|
|
|
Back to top |
|
|
bknight2602 Grandmaster Cheater Reputation: 0
Joined: 08 Oct 2012 Posts: 577
|
Posted: Sun Jan 23, 2022 3:37 pm Post subject: |
|
|
Yes, I did use a comma. The output is great except I guess I should have said the table address and not the game address, which are known. The reason is there is code that I am debugging, and the output is the table address.
|
|
Back to top |
|
|
LeFiXER Grandmaster Cheater Supreme Reputation: 20
Joined: 02 Sep 2011 Posts: 1053 Location: 0x90
|
Posted: Sun Jan 23, 2022 3:55 pm Post subject: |
|
|
Okay, it's a little unclear exactly what it is you want, but I will explain here what's happening with your code.
Code: |
addresslist = getAddressList() // Assign the handle of getAddressList() into the variable addresslist
for x = 0,addresslist.Count-1 // Set x as the iterator from 0 to the addresslist count - 1
do
test = addresslist,x // Assign the handle of addresslist to test. ",x" does nothing. "x" stores the iteration of the loop, in your case it is 0 (first iteration)
print(test) // Prints the value of test to the log
end
|
It's not printing a record but the handle to the addresslist.
|
|
Back to top |
|
|
bknight2602 Grandmaster Cheater Reputation: 0
Joined: 08 Oct 2012 Posts: 577
|
Posted: Sun Jan 23, 2022 4:14 pm Post subject: |
|
|
Ok, for example the game addresses are
49ee3e (first address in table)
...
4a0fc2
...
4a105b(Last address in table)
While debugging code I get outputs
086C2BE0
0D13DAF0
Is that clearer?
|
|
Back to top |
|
|
LeFiXER Grandmaster Cheater Supreme Reputation: 20
Joined: 02 Sep 2011 Posts: 1053 Location: 0x90
|
Posted: Sun Jan 23, 2022 4:24 pm Post subject: |
|
|
Have I not explained that already? It's printing the handle of the addresslist to the console and not the memory record. The code I posted will do what you want to do. Loop through every memory record in the table and print it to the console.
See below:
LeFiXER wrote: |
Code: |
local al = getAddressList()
for x = 0, al.Count - 1 do
local mr = al.getMemoryRecord(x)
if mr ~= nil then
print('description:\t' .. mr.description .. '\nvalue:\t\t' .. mr.value .. '\naddress:\t\t' .. mr.address)
else
print('No memory records')
end
end
|
|
|
|
Back to top |
|
|
TheyCallMeTim13 Wiki Contributor Reputation: 50
Joined: 24 Feb 2017 Posts: 976 Location: Pluto
|
Posted: Sun Jan 23, 2022 4:28 pm Post subject: |
|
|
bknight2602 wrote: | Ok, for example the game addresses are
49ee3e (first address in table)
...
4a0fc2
...
4a105b(Last address in table)
While debugging code I get outputs
086C2BE0
0D13DAF0
Is that clearer? |
Like LeFiXER said, "test = addresslist,x" it the same as "test = addresslist". e.g. "test1, test2 = 'string 1', 'string 2'" just sets two variables at once. I think you are getting confused with a no parentheses notation, i.e. "print 'test'" note that there is no comma. I would definitely say use parentheses to help stop any confusion, and in this case you actually need to use square brackets for it to work this way.
Code: | test = addresslist[x] |
or
Code: | test = addresslist.getMemoryRecord(x) |
_________________
|
|
Back to top |
|
|
bknight2602 Grandmaster Cheater Reputation: 0
Joined: 08 Oct 2012 Posts: 577
|
Posted: Sun Jan 23, 2022 4:38 pm Post subject: |
|
|
LeFiXER wrote: | Have I not explained that already? It's printing the handle of the addresslist to the console and not the memory record. The code I posted will do what you want to do. Loop through every memory record in the table and print it to the console.
See below:
LeFiXER wrote: |
Code: |
local al = getAddressList()
for x = 0, al.Count - 1 do
local mr = al.getMemoryRecord(x)
if mr ~= nil then
print('description:\t' .. mr.description .. '\nvalue:\t\t' .. mr.value .. '\naddress:\t\t' .. mr.address)
else
print('No memory records')
end
end
|
|
|
Yes it certainly does, print game addresses which are known. I guess I can't explain any further I'm seeking a different set of addresses.
Thanks for your time and effort.
|
|
Back to top |
|
|
LeFiXER Grandmaster Cheater Supreme Reputation: 20
Joined: 02 Sep 2011 Posts: 1053 Location: 0x90
|
Posted: Sun Jan 23, 2022 4:53 pm Post subject: Re: Addresslist addresses, values, Descriptions |
|
|
bknight2602 wrote: | What I am ultimately seeking, after my question is to output the table record addresses, descriptions and values.
...
I guess I can't explain any further I'm seeking a different set of addresses.
|
The table holds the memory records that have been placed into the cheat table already. You can't access them if they don't exist. Without further details of what you're trying to achieve, what you have, what you've tried etc... no one here can help.
|
|
Back to top |
|
|
TheyCallMeTim13 Wiki Contributor Reputation: 50
Joined: 24 Feb 2017 Posts: 976 Location: Pluto
|
Posted: Sun Jan 23, 2022 5:16 pm Post subject: |
|
|
bknight2602 wrote: | LeFiXER wrote: | Have I not explained that already? It's printing the handle of the addresslist to the console and not the memory record. The code I posted will do what you want to do. Loop through every memory record in the table and print it to the console.
See below:
LeFiXER wrote: |
Code: |
local al = getAddressList()
for x = 0, al.Count - 1 do
local mr = al.getMemoryRecord(x)
if mr ~= nil then
print('description:\t' .. mr.description .. '\nvalue:\t\t' .. mr.value .. '\naddress:\t\t' .. mr.address)
else
print('No memory records')
end
end
|
|
|
Yes it certainly does, print game addresses which are known. I guess I can't explain any further I'm seeking a different set of addresses.
Thanks for your time and effort. |
Those aren't game addresses, here's an example. Open CE and don't attach to anything just open the lua engine window (Ctrl+m then Ctrl+L). Then paste this in and hit execute.
Code: | print(tostring(print)) |
You'll get an output like this.
Code: | function: 0000000000651710 |
And another example.
Code: | print(tostring({ })) |
You'll get an output like this.
Code: | table: 000000001017F490 |
And with "AddressList".
Code: | print(tostring(AddressList)) |
You'll get an output like this.
Code: | userdata: 000000000467B418 |
This has nothing to do with CE, it's just how lua works. It's an address for the object; i.e. print function, table, and the CE address list. You might want to start with some Lua tutorials. And I'd even say do some with just lua without CE.
https://www.tutorialspoint.com/lua/index.htm
_________________
|
|
Back to top |
|
|
bknight2602 Grandmaster Cheater Reputation: 0
Joined: 08 Oct 2012 Posts: 577
|
Posted: Sun Jan 23, 2022 5:42 pm Post subject: |
|
|
I resisted posting this since everyone will bang on me for not using the "proper" coding techniques, which I sadly have not learned. However,
Code: |
self.listview = createListView(self.form)
setProperty(self.listview, 'ViewStyle', 'vsReport')
setProperty(self.listview, 'RowSelect', 'True')
setProperty(self.listview, 'ReadOnly', 'True')
setProperty(self.listview, 'HideSelection', 'False')
self.listview.top = 165;
self.listview.width = 130;
self.listview.left = 165;
self.listview.height = 210;
self.listview.onClick = function (sender)
local char
if (trainer.characters_rg.ItemIndex >= 0 ) then
char = strings_getString(self.characters_rg.getItems(), self.characters_rg.ItemIndex);
end
local row_1 = sender.getItems().getItem(sender.getItemIndex()); -- Level
print(row_1)
local row_2 = strings_getString(row_1.getSubItems(),0) + 0; -- Exp
print(row_2)
if (char and row_1 and row_2) then
local address_1 = addresslist_getMemoryRecordByDescription(getAddressList(), char ..'Exp');
print(address_1)
if (address_1) then
memoryrecord_setValue(address_1, row_2 - math.floor(row_2/65536) * 65536)
end
end
end
|
The list view contains two columns of data, Level and Exp.
When the desired row lvl, exp, is selected the exp is supposed to be set at its desired game location. It does not.
|
|
Back to top |
|
|
TheyCallMeTim13 Wiki Contributor Reputation: 50
Joined: 24 Feb 2017 Posts: 976 Location: Pluto
|
Posted: Sun Jan 23, 2022 5:50 pm Post subject: |
|
|
bknight2602 wrote: | I resisted posting this since everyone will bang on me for not using the "proper" coding techniques, which I sadly have not learned. However,
Code: |
self.listview = createListView(self.form)
setProperty(self.listview, 'ViewStyle', 'vsReport')
setProperty(self.listview, 'RowSelect', 'True')
setProperty(self.listview, 'ReadOnly', 'True')
setProperty(self.listview, 'HideSelection', 'False')
self.listview.top = 165;
self.listview.width = 130;
self.listview.left = 165;
self.listview.height = 210;
self.listview.onClick = function (sender)
local char
if (trainer.characters_rg.ItemIndex >= 0 ) then
char = strings_getString(self.characters_rg.getItems(), self.characters_rg.ItemIndex);
end
local row_1 = sender.getItems().getItem(sender.getItemIndex()); -- Level
print(row_1)
local row_2 = strings_getString(row_1.getSubItems(),0) + 0; -- Exp
print(row_2)
if (char and row_1 and row_2) then
local address_1 = addresslist_getMemoryRecordByDescription(getAddressList(), char ..'Exp');
print(address_1)
if (address_1) then
memoryrecord_setValue(address_1, row_2 - math.floor(row_2/65536) * 65536)
end
end
end
|
The list view contains two columns of data, Level and Exp.
When the desired row lvl, exp, is selected the exp is supposed to be set at its desired game location. It does not. |
"address_1" is a memory record. So like it's been stated over and over already you are print the handle not the address property. To do that try this.
Code: | print(address_1.Address) |
_________________
|
|
Back to top |
|
|
bknight2602 Grandmaster Cheater Reputation: 0
Joined: 08 Oct 2012 Posts: 577
|
Posted: Sun Jan 23, 2022 6:32 pm Post subject: |
|
|
TheyCallMeTim13 wrote: | bknight2602 wrote: | I resisted posting this since everyone will bang on me for not using the "proper" coding techniques, which I sadly have not learned. However,
Code: |
self.listview = createListView(self.form)
setProperty(self.listview, 'ViewStyle', 'vsReport')
setProperty(self.listview, 'RowSelect', 'True')
setProperty(self.listview, 'ReadOnly', 'True')
setProperty(self.listview, 'HideSelection', 'False')
self.listview.top = 165;
self.listview.width = 130;
self.listview.left = 165;
self.listview.height = 210;
self.listview.onClick = function (sender)
local char
if (trainer.characters_rg.ItemIndex >= 0 ) then
char = strings_getString(self.characters_rg.getItems(), self.characters_rg.ItemIndex);
end
local row_1 = sender.getItems().getItem(sender.getItemIndex()); -- Level
print(row_1)
local row_2 = strings_getString(row_1.getSubItems(),0) + 0; -- Exp
print(row_2)
if (char and row_1 and row_2) then
local address_1 = addresslist_getMemoryRecordByDescription(getAddressList(), char ..'Exp');
print(address_1)
if (address_1) then
memoryrecord_setValue(address_1, row_2 - math.floor(row_2/65536) * 65536)
end
end
end
|
The list view contains two columns of data, Level and Exp.
When the desired row lvl, exp, is selected the exp is supposed to be set at its desired game location. It does not. |
"address_1" is a memory record. So like it's been stated over and over already you are print the handle not the address property. To do that try this.
Code: | print(address_1.Address) |
|
The output is 0D13DAF0 as I posted earlier, the game address is 4a0fc3.
row_1 prints as 08B0BAA0 row_2 prints as 99 which is the correct value in the listview.
|
|
Back to top |
|
|
LeFiXER Grandmaster Cheater Supreme Reputation: 20
Joined: 02 Sep 2011 Posts: 1053 Location: 0x90
|
Posted: Mon Jan 24, 2022 5:23 am Post subject: |
|
|
bknight2602 wrote: |
The output is 0D13DAF0 as I posted earlier, the game address is 4a0fc3.
row_1 prints as 08B0BAA0 row_2 prints as 99 which is the correct value in the listview. |
Code: |
local address_1 = addresslist_getMemoryRecordByDescription(getAddressList(), char ..'Exp');
|
This is your problem. As you can see the function addresslist_getMemoryRecordByDescription is being passed the addresslist, which is a handle to the addresslist object and not a string which the function expects. The following part ", char .. 'Exp'" is disregarded because the aforementioned function requires only one argument.
Code: |
getMemoryRecordByDescription(description): returns a MemoryRecord object
|
As you can see, it requires one argument to return the MemoryRecord object.
Code: |
getAddressList() : Returns the cheat table addresslist object
|
Like so, the getAddressList() function returns the cheat table's addresslist object.
|
|
Back to top |
|
|
bknight2602 Grandmaster Cheater Reputation: 0
Joined: 08 Oct 2012 Posts: 577
|
Posted: Mon Jan 24, 2022 10:52 am Post subject: |
|
|
LeFiXER wrote: | bknight2602 wrote: |
The output is 0D13DAF0 as I posted earlier, the game address is 4a0fc3.
row_1 prints as 08B0BAA0 row_2 prints as 99 which is the correct value in the listview. |
Code: |
local address_1 = addresslist_getMemoryRecordByDescription(getAddressList(), char ..'Exp');
|
This is your problem. As you can see the function addresslist_getMemoryRecordByDescription is being passed the addresslist, which is a handle to the addresslist object and not a string which the function expects. The following part ", char .. 'Exp'" is disregarded because the aforementioned function requires only one argument.
Code: |
getMemoryRecordByDescription(description): returns a MemoryRecord object
|
As you can see, it requires one argument to return the MemoryRecord object.
Code: |
getAddressList() : Returns the cheat table addresslist object
|
Like so, the getAddressList() function returns the cheat table's addresslist object. |
Well would you offer a solution to allow the exp to update the proper address?
In the first Hero 1 with Hero 1exp as the experience. The rest are
Hero 2
Hero 3
Hero 4
All with similar experience record descriptions.
|
|
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
|
|