Jump to content
  • 0

Help me Lua script experts, how do I copy the resulting offset value, then paste the value in the next search result that has been offset?


Question

Posted (edited)

gg.clearResults()

gg.clearList()

gg.searchNumber("4321", gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1, 0)

local t = gg.getResults(1)

gg.addListItems(t)

gg.clearResults()

gg.searchNumber("4321", gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1, 0)

local t = gg.getResults(1)

gg.addListItems(t)

gg.clearResults()

gg.searchNumber("4321", gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1, 0)

local t = gg.getResults(1)

gg.addListItems(t) gg.clearResults()

local tc = gg.getListItems() gg.cleaeList()

for i, v in ipairs(tc) do

 v.address = v.address - 0x1C

end

gg.addListItems(tc)

local ttc = gg.getListItems()

gg.searchNumber("1234", gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1, 0)

local t = gg.getResults(1)

gg.addListItems(t)

gg.clearResults()

gg.searchNumber("1234", gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1, 0)

local t = gg.getResults(1)

gg.addListItems(t)

gg.clearResults()

gg.searchNumber("1234", gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1, 0)

local t = gg.getResults(1)

gg.addListItems(t) gg.clearResults()

local tb = gg.getListItems() gg.cleaeList()

for i, v in ipairs(tb) do

 v.address = v.address + 0x1C

 v.value = ttc[1].value

end

gg.addListItems(tb)

gg.setValues(ttc)

Edited by POXO

2 answers to this question

Recommended Posts

  • 0
Posted (edited)
On 8/1/2024 at 11:04 AM, POXO said:

gg.clearResults()

gg.clearList()

gg.searchNumber("4321", gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1, 0)

local t = gg.getResults(1)

gg.addListItems(t)

gg.clearResults()

gg.searchNumber("4321", gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1, 0)

local t = gg.getResults(1)

gg.addListItems(t)

gg.clearResults()

gg.searchNumber("4321", gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1, 0)

local t = gg.getResults(1)

gg.addListItems(t) gg.clearResults()

local tc = gg.getListItems() gg.cleaeList()

for i, v in ipairs(tc) do

 v.address = v.address - 0x1C

end

gg.addListItems(tc)

local ttc = gg.getListItems()

gg.searchNumber("1234", gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1, 0)

local t = gg.getResults(1)

gg.addListItems(t)

gg.clearResults()

gg.searchNumber("1234", gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1, 0)

local t = gg.getResults(1)

gg.addListItems(t)

gg.clearResults()

gg.searchNumber("1234", gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1, 0)

local t = gg.getResults(1)

gg.addListItems(t) gg.clearResults()

local tb = gg.getListItems() gg.cleaeList()

for i, v in ipairs(tb) do

 v.address = v.address + 0x1C

 v.value = ttc[1].value

end

gg.addListItems(tb)

gg.setValues(ttc)IMG_20250109_120936.thumb.jpg.56c233cc70b31756531e531e255905ca.jpg

Fix what I circled

Edited by reno45
  • 0
Posted

Hi,
The script, you provided contains several points.
In first piece of code, script searches for number "4321" three times in a row.
As a result, after tc = gg.getListItems(), you will have only one number, with one address,
because all three times only one number will be found and filtered out.
If you want to find number "4321" located in memory three times, search string would be:
gg.searchNumber("4321", gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1, 3)
Read description of this command on website:
https://gameguardian.net/help/classgg.html#a14685d871e664a2f8ea74dc3293e428e
Why do you even use command gg.addListItems() & gg.getListItems() ?
In scripts it is needed only if you want to "freeze" some number.
Just create a table and process it.
In your script, definition "local t=" is used six times.
Correct programming style is to make definitions at beginning,
and indicating type of variable.
In your case:
local t = {}
local tc = {}
Local tb = {}
And so on.
And remove all words "local" from body of script.
Honestly, from your description and example code, I still don’t understand what you want to do.

Good luck!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.