Jump to content
  • 0

How to group values to edit in a search?


ThienTeakee
 Share

Question

Hi guys, I'm new at GG

I have a script like this

gg.clearResults()

gg.setRanges(gg.REGION_ANONYMOUS)
gg.searchNumber('1.014.350.479;1.012.202.996;1.083.179.008;1.050.253.722;1.031.127.695;1.065.353.216;1.065.353.216;1.067.282.596:61', gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1)
gg.getResults(5000)

I want to change "1.014.350.479" to "1.011.011.011" and "1.050.253.722;1.031.127.695" to "1". Because I only know how to edit all of them with "editAll()", not know how to group them like this.

Thanks for your help

Link to comment
Share on other sites

Recommended Posts

  • 0
  • Administrators

Dot decimal separator. So '1.014.350.479' is not a valid number.

For change one value from group search need do refine search and editAll after that.

Or load all values and work with it in loop. Use 'if' and 'setValues'.

Link to comment
Share on other sites

  • 0
9 minutes ago, Enyby said:

Dot decimal separator. So '1.014.350.479' is not a valid number.

For change one value from group search need do refine search and editAll after that.

Or load all values and work with it in loop. Use 'if' and 'setValues'.

Do I have to use clearResults after each refine search? Does old group's values exist to do refine search again after doing clearResults?

Link to comment
Share on other sites

  • 0

as a noob....this is how i would do it

search =  '1.014.350.479;1.012.202.996;1.083.179.008;1.050.253.722;1.031.127.695;1.065.353.216;1.065.353.216;1.067.282.596:61'

refine to '1.014.350.479'

then edit all to '1.011.011.011'

continue...

search = '1.011.011.011;1.012.202.996;1.083.179.008;1.050.253.722;1.031.127.695;1.065.353.216;1.065.353.216;1.067.282.596:61'

refine to '1.050.253.722;1.031.127.695'

then edit all to '1'

not a perfect way i think.... but it did worked for me in some of the script that i made.

 

Link to comment
Share on other sites

  • 0

As a noob, here is my solution.

gg.setRanges(gg.REGION_ANONYMOUS)
gg.searchNumber('1014350479;1012202996;1083179008;1050253722;1031127695;1065353216;1065353216;1067282596:61', 4) -- search
gg.getResults(5000)
gg.searchNumber("1014350479;1050253722;1031127695",4)-- refine the three values that you want to edit
gg.editAll("1011011011;1;1",4) -- edit all of them individually

 

Edited by ItsSC
Link to comment
Share on other sites

  • 0
4 minutes ago, zam535582 said:

as a noob....this is how i would do it

search =  '1.014.350.479;1.012.202.996;1.083.179.008;1.050.253.722;1.031.127.695;1.065.353.216;1.065.353.216;1.067.282.596:61'

refine to '1.014.350.479'

then edit all to '1.011.011.011'

continue...

search = '1.011.011.011;1.012.202.996;1.083.179.008;1.050.253.722;1.031.127.695;1.065.353.216;1.065.353.216;1.067.282.596:61'

refine to '1.050.253.722;1.031.127.695'

then edit all to '1'

not a perfect way i think.... but it did worked for me in some of the script that i made.

 

Yes, that what I did and it worked well. But I want to find a shortcut 😂

Link to comment
Share on other sites

  • 0
3 minutes ago, ItsSC said:

As a noob, here is my solution.


gg.setRanges(gg.REGION_ANONYMOUS)
gg.searchNumber('1014350479;1012202996;1083179008;1050253722;1031127695;1065353216;1065353216;1067282596:61', 4) -- search
gg.getResults(5000)
gg.searchNumber("1014350479;1050253722;1031127695",4)-- refine the three values that you want to edit
gg.editAll("1011011011;1;1",4) -- edit all of them individually

 

Thank you, I will try that

Link to comment
Share on other sites

  • 0
5 minutes ago, ItsSC said:

As a noob, here is my solution.


gg.setRanges(gg.REGION_ANONYMOUS)
gg.searchNumber('1014350479;1012202996;1083179008;1050253722;1031127695;1065353216;1065353216;1067282596:61', 4) -- search
gg.getResults(5000)
gg.searchNumber("1014350479;1050253722;1031127695",4)-- refine the three values that you want to edit
gg.editAll("1011011011;1;1",4) -- edit all of them individually

 

you totally not a noob as how noob i am...

another thing learned.

[added 4 minutes later]
10 minutes ago, ThienTeakee said:

Yes, that what I did and it worked well. But I want to find a shortcut 😂

well....we both got lucky today.

Thanks to @ItsSC

Link to comment
Share on other sites

  • 0
1 minute ago, zam535582 said:

you totally not a noob as how noob i am...

another thing learned.

C'mon man. We all need to learn and improve ourself. My English is bad but I don't care because you guys still understand what I said

Link to comment
Share on other sites

  • 0
  • Administrators
38 minutes ago, ItsSC said:

gg.searchNumber("1014350479;1050253722;1031127695",4)-- refine the three values that you want to edit

gg.editAll("1011011011;1;1",4) -- edit all of them individually

Search not ordered, so order can be any and this code not work properly.

This is not even taking into account the fact that there may be duplicates of the same values in a row.

[added 1 minute later]
38 minutes ago, ThienTeakee said:

I want to find a shortcut

Iterate over results, build table and pass it to setValues.

Best solution if you have small amount of results.

Link to comment
Share on other sites

  • 0

The group search is not ordered, so I would prefer second approach from those Enyby mentioned. For this case it would be something like the following: 

gg.setRanges(gg.REGION_ANONYMOUS)
gg.clearResults()
gg.searchNumber('1014350479;1012202996;1083179008;1050253722;1031127695;1065353216;1065353216;1067282596:61', gg.TYPE_DWORD)
local results = gg.getResults(5000)
local edited = {}
for i, v in ipairs(results) do
  if v.value == 1014350479 then
    edited[#edited + 1] = {address = v.address, flags = v.flags, value = 1011011011}
  elseif v.value == 1050253722 or v.value == 1031127695 then
    edited[#edited + 1] = {address = v.address, flags = v.flags, value = 1}
  end
end
gg.setValues(edited)
Link to comment
Share on other sites

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
 Share

×
×
  • 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.