Jump to content

Question

Posted

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

Recommended Posts

  • 0
  • Administrators
Posted

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'.

  • 0
Posted
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?

  • 0
  • Administrators
Posted

No. No.

You need read API help. Do some small examples, use record script feature and so on. Al of these described in help and on forum.

  • 0
Posted
1 minute ago, Enyby said:

No. No.

You need read API help. Do some small examples, use record script feature and so on. Al of these described in help and on forum.

Thank you so much. I'm learning now ♥️

  • 0
Posted

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.

 

  • 0
Posted (edited)

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
  • 0
Posted
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 😂

  • 0
Posted
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

  • 0
Posted
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

  • 0
Posted
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

  • 0
  • Administrators
Posted
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.

  • 0
Posted

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)
  • 0
Posted
29 minutes ago, ThienTeakee said:

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

yup...im learning too.

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.