Jump to content
  • 0

How to implement Nearby Search in LUA Script for address that keeps changing


Question

Posted (edited)

Hello,

 

Wondering if someone can please help me. I have a group search and refined value like this:

 

gg.searchNumber("0.10000000149;2.5;6.0::9", gg.TYPE_FLOAT, false, gg.SIGN_EQUAL, 0, -1, 0)
gg.refineNumber("6", gg.TYPE_FLOAT, false, gg.SIGN_EQUAL, 0, -1, 0)

local t = gg.getResults(1)
gg.addListItems(t)
t = nil

 

What I'd like to do is use the result of "6" from above to perform a "NearBy Search" with an "After" distance of 500 for value: -1 DWORD.  The problem is the address of the "6" keeps changing when I restart the game. Is there a proper way to code the script so that it does what I need even when the address of the "6" changes?  I've searched and played around with it and couldn't figure it out at all. Not even sure if it's doable. That's why I'm asking.  Would appreciate any assistance.

Edited by Sami1982

8 answers to this question

Recommended Posts

  • 1
Posted
gg.searchNumber("0.10000000149;2.5;6.0::9", gg.TYPE_FLOAT, false, gg.SIGN_EQUAL, 0, -1, 0)
gg.refineNumber("6", gg.TYPE_FLOAT, false, gg.SIGN_EQUAL, 0, -1, 0)

-- Get up to 10 results just in case
local results = gg.getResults(10) 
local offset = 0x500
local allResults = {}

-- Loop through each address from results
for _, v in ipairs(results) do
    local baseAddress = v.address
    gg.clearResults()
    gg.searchNumber("-1", gg.TYPE_DWORD, false, gg.SIGN_EQUAL, baseAddress, baseAddress + offset, 0)

-- Get all found results for this address range
    local found = gg.getResults(10)
    for _, addr in ipairs(found) do
        table.insert(allResults, addr) -- Collect each valid result
    end
end

-- Load all results found for target value
if #allResults > 0 then
    gg.loadResults(allResults)
end

 

  • 2
Posted

im not an expert but try this and see if it work for you

gg.searchNumber("0.10000000149;2.5;6.0::9", gg.TYPE_FLOAT, false, gg.SIGN_EQUAL, 0, -1, 0)
gg.refineNumber("6", gg.TYPE_FLOAT, false, gg.SIGN_EQUAL, 0, -1, 0)

local results = gg.getResults(1)
local baseAddress = results[1].address
local offset = 0x500

gg.clearResults()
gg.searchNumber("-1", gg.TYPE_DWORD, false, gg.SIGN_EQUAL, baseAddress, baseAddress + offset, 0)

 

  • 0
Posted (edited)
10 hours ago, Sami1982 said:

Hello,

 

Wondering if someone can please help me. I have a group search and refined value like this:

 

gg.searchNumber("0.10000000149;2.5;6.0::9", gg.TYPE_FLOAT, false, gg.SIGN_EQUAL, 0, -1, 0)
gg.refineNumber("6", gg.TYPE_FLOAT, false, gg.SIGN_EQUAL, 0, -1, 0)

local t = gg.getResults(1)
gg.addListItems(t)
t = nil

 

What I'd like to do is use the result of "6" from above to perform a "NearBy Search" with an "After" distance of 500 for value: -1 DWORD.  The problem is the address of the "6" keeps changing when I restart the game. Is there a proper way to code the script so that it does what I need even when the address of the "6" changes?  I've searched and played around with it and couldn't figure it out at all. Not even sure if it's doable. That's why I'm asking.  Would appreciate any assistance.



But if you did a nearby search of 500 you should be able to find another group search that is better and more static.

Edited by nok1a
  • 0
Posted
9 hours ago, nok1a said:



But if you did a nearby search of 500 you should be able to find another group search that is better and more static.

Yeah unfortunately it's so weird and unreliable. I tried various group searches and backwards pointer searches. It works 4 or 5 times in a row when I restart the game, but then sadly it stops working 😞 

  • 0
Posted (edited)
3 hours ago, MonkeySAN said:

care to share the game name?

and what are you searching for?

Thanks for the response. Sorry It's kind of a long story and confusing lol.  But let me try to better clarify my question. It's pretty specific and straight forward. When I get my refined result from my group search, which is that number "6", I long press on it, and select "search nearby" and I search for -1 Dword with "After distance" of 500. The problem is, the address (as shown in the attached screenshot) is always different when I restart the game. Is there a way to write something in the script to perform this "long press/search nearby" without knowing what that address will be? That's all I need to know.

screen_shot.jpg

Edited by Sami1982
  • 0
Posted
3 hours ago, MonkeySAN said:

im not an expert but try this and see if it work for you

gg.searchNumber("0.10000000149;2.5;6.0::9", gg.TYPE_FLOAT, false, gg.SIGN_EQUAL, 0, -1, 0)
gg.refineNumber("6", gg.TYPE_FLOAT, false, gg.SIGN_EQUAL, 0, -1, 0)

local results = gg.getResults(1)
local baseAddress = results[1].address
local offset = 0x500

gg.clearResults()
gg.searchNumber("-1", gg.TYPE_DWORD, false, gg.SIGN_EQUAL, baseAddress, baseAddress + offset, 0)

 

Genius man!! That's exactly what I needed. Can't thank you enough. 

  • 0
Posted
4 hours ago, MonkeySAN said:

im not an expert but try this and see if it work for you

gg.searchNumber("0.10000000149;2.5;6.0::9", gg.TYPE_FLOAT, false, gg.SIGN_EQUAL, 0, -1, 0)
gg.refineNumber("6", gg.TYPE_FLOAT, false, gg.SIGN_EQUAL, 0, -1, 0)

local results = gg.getResults(1)
local baseAddress = results[1].address
local offset = 0x500

gg.clearResults()
gg.searchNumber("-1", gg.TYPE_DWORD, false, gg.SIGN_EQUAL, baseAddress, baseAddress + offset, 0)

 

Sorry to bother you again. Just one last question. If I had 2 results of that refined "6", how can I write the script to perform the same nearby search for both of them? Thanks again.

  • 0
Posted
1 hour ago, MonkeySAN said:
gg.searchNumber("0.10000000149;2.5;6.0::9", gg.TYPE_FLOAT, false, gg.SIGN_EQUAL, 0, -1, 0)
gg.refineNumber("6", gg.TYPE_FLOAT, false, gg.SIGN_EQUAL, 0, -1, 0)

-- Get up to 10 results just in case
local results = gg.getResults(10) 
local offset = 0x500
local allResults = {}

-- Loop through each address from results
for _, v in ipairs(results) do
    local baseAddress = v.address
    gg.clearResults()
    gg.searchNumber("-1", gg.TYPE_DWORD, false, gg.SIGN_EQUAL, baseAddress, baseAddress + offset, 0)

-- Get all found results for this address range
    local found = gg.getResults(10)
    for _, addr in ipairs(found) do
        table.insert(allResults, addr) -- Collect each valid result
    end
end

-- Load all results found for target value
if #allResults > 0 then
    gg.loadResults(allResults)
end

 

Thank you thank thank every so much bro.  You are awesome! Have a great day

 

 

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.