Platonic Posted August 11, 2022 Posted August 11, 2022 Can someone explain me how this works. I have a table from the result list with 5 sub tables. Each has address, flags and value. Let's say i want the values of the current address + 0x8 Why does only the address update but not the value? I clearly have some misunderstandings i want to clear up. I also like to know how gg.getValues() is able to assign the right values to the addresses.
zolotov_official0 Posted August 11, 2022 Posted August 11, 2022 1 hour ago, Platonic said: Can someone explain me how this works. I have a table from the result list with 5 sub tables. Each has address, flags and value. Let's say i want the values of the current address + 0x8 Why does only the address update but not the value? I clearly have some misunderstandings i want to clear up. I also like to know how gg.getValues() is able to assign the right values to the addresses. First, to get offset, flag, value, you need to do a search and use gg.getResults. Example: gg.searchNumber('1000', 4) res = gg.getResults(gg.getResultsCount()) Let's try to print the res variable and get something like: [1] = { -- table(949ebdf) ['address'] = 0x32c017b8, ['flags'] = 4, -- gg.TYPE_DWORD ['value'] = 1000, }, [2] = { -- table(7d1902c) ['address'] = 0x32c01ab8, ['flags'] = 4, -- gg.TYPE_DWORD ['value'] = 1000, }, Now let's try to change the value in the first cell of the res table, for this we use gg.setValues(). Example: gg.searchNumber('10000', 4) res = gg.getResults(gg.getResultsCount()) res[1]['value'] = 1234 gg.setValues(res) If we try to print the first value in the res table, then we get: { -- table(cc54dac) ['address'] = 0x32c017b8, ['flags'] = 4, -- gg.TYPE_DWORD ['value'] = 1234, } We were able to change the value great job, in the same way we can change the value by offset. But what is gg.getValues() for? It's just that it is used to get the value knowing its offset, this will be relevant for the Code App region. Example: lib = gg.getRangesList('libtmessages.42.so')[1].start --Took the starting address of the library res = {} res[1] = {} res[1]['address'] = lib + 4 res[1]['flags'] = 4 res = gg.getValues(res) If we change the flag, we will get a number in a different type, lib + 4 means that we have added an offset to the starting address of the library, if your offset has the form of a hex, for example, 1FF9D4, then we can use it like this lib + tonumber('1FF9D4', 16). So if we make a print of our res we get: { -- table(a2e2972) [1] = { -- table(67491c3) ['address'] = 0xa2cff004, ['flags'] = 4, -- gg.TYPE_DWORD ['value'] = 65793, }, } As you can see, we got the value using only offset, this lesson comes to an end. I hope you appreciate my work
Platonic Posted August 11, 2022 Author Posted August 11, 2022 Hello Zolotov_official0, I believe my question has been misinterpreted. What i want to know is "why" values don't correspond to there addresses unless you do something as gg.getValues() which then get the values corresponding to the address in the sub tables...at least thats how it looks like it. Example in the screenshot. It is not always working in the favour to create new table with getValues because values don't get updated according to the address instantly. However im not complaining. Just asking why for educational purposes. Its something i don't find the logic in.
zolotov_official0 Posted August 11, 2022 Posted August 11, 2022 when you use gg.getValues() do your values change? Send me your code. I don't quite understand your problem
Platonic Posted August 11, 2022 Author Posted August 11, 2022 Code is not the problem. Its lua scripting or GG logic. Just as in your example you use offset. Which updates only the address but not the value on that updated address. You use gg.getValues() to then get the values on that updated address and perform some actions with it. It would been efficient if GG automatically updates the value as well without using gg.getValues() I want to make a script that does that. But have no understanding or whatsoever of whats happening behind the screens for make a script that updates the values according to its addresses without needing to use gg.getValues().
XEKEX Posted August 14, 2022 Posted August 14, 2022 try to make your script more dynamic you can just save the values in Global variable like ResultTable = {} and instead of writing local t = gg.getresult u can do ResultTable[1] = gg.getresult then add Update function in your script and call it WHILE NOT gg.visible() instead of writing gg.getValues x99 times somthing like: for key,values in (ResultTable) do ResultTable[key] = gg.getValues() end here is a vid on how to do it by Enyby : https://www.youtube.com/watch?v=L7MzDP6g1zU
Platonic Posted August 14, 2022 Author Posted August 14, 2022 3 hours ago, XEKEX said: try to make your script more dynamic you can just save the values in Global variable like ResultTable = {} and instead of writing local t = gg.getresult u can do ResultTable[1] = gg.getresult then add Update function in your script and call it WHILE NOT gg.visible() instead of writing gg.getValues x99 times somthing like: for key,values in (ResultTable) do ResultTable[key] = gg.getValues() end here is a vid on how to do it by Enyby : https://www.youtube.com/watch?v=L7MzDP6g1zU I think its useful when your accessing same table. But if table has a new variable because you don't want old table to be modified you still will be writhing multiply gg.getValues(). If its now in a while loop or not.
XEKEX Posted August 14, 2022 Posted August 14, 2022 21 minutes ago, Platonic said: I think its useful when your accessing same table. But if table has a new variable because you don't want old table to be modified you still will be writhing multiply gg.getValues(). If its now in a while loop or not. yeah the ResultTable i mentioned act like a database of ur searched values if u want to use gg.getresult(getresultcount()) use it on a new index in ResultTable it will be similar to this ResultTable = { ['index_1'] = { ['address'] = some address 1 , ['value']= value 1 ... etc }, ['index_2'] = { ['address'] = some address 2 , ['value']= value 2 ... etc }, . . . etc } ResultTable.index_1 = gg.getResult(gg.getResultCounts()) the update fn will loop for all the index's in ResultTable and apply getvalues to them whenever gg is not visible this will make the values refreshing at runtime accessing all the search you've made and lot easier to modify (ResultTable[index] = desired value setvalue(ResultTable[index])
Platonic Posted August 14, 2022 Author Posted August 14, 2022 4 hours ago, XEKEX said: yeah the ResultTable i mentioned act like a database of ur searched values if u want to use gg.getresult(getresultcount()) use it on a new index in ResultTable it will be similar to this ResultTable = { ['index_1'] = { ['address'] = some address 1 , ['value']= value 1 ... etc }, ['index_2'] = { ['address'] = some address 2 , ['value']= value 2 ... etc }, . . . etc } ResultTable.index_1 = gg.getResult(gg.getResultCounts()) the update fn will loop for all the index's in ResultTable and apply getvalues to them whenever gg is not visible this will make the values refreshing at runtime accessing all the search you've made and lot easier to modify (ResultTable[index] = desired value setvalue(ResultTable[index]) I see. Thanks for info provided.
Question
Platonic
Can someone explain me how this works.
I have a table from the result list with 5 sub tables. Each has address, flags and value.
Let's say i want the values of the current address + 0x8
Why does only the address update but not the value? I clearly have some misunderstandings i want to clear up.
I also like to know how gg.getValues() is able to assign the right values to the addresses.
8 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.