Jump to content
  • 0

Increments


KUMADEIT

Question

Posted

how do you add increments to gg results , if my results is 500 , i want to script adding +1 increment then search for the new value that the original changed to after adding +1 increment 

3 answers to this question

Recommended Posts

Posted

[ @Koolie ]
---
You just need to save the earlier results into memory:

function increments(memo)
	gg.clearResults()
	memo_temp = {}
	second_memo = gg.getValues(memo)
	for k, v in ipairs(second_memo) do
		memo_temp[k] = { ['address'] = v.address, ['flags'] = v.flags, ['value'] = tonumber(v.value) + 1 }
	end
	gg.setValues(memo_temp)
end

gg.searchNumber('10', gg.TYPE_DWORD)
memo = gg.getResults( gg.getResultsCount() )

--First Increment
increments(memo)

--Second Increment
increments(memo)
...

---
*Fixed. I forgot something

Posted
On 11/12/2023 at 9:19 PM, kiynox said:

[ @Koolie ]
---
You just need to save the earlier results into memory:

function increments(memo)
	gg.clearResults()
	memo_temp = {}
	second_memo = gg.getValues(memo)
	for k, v in ipairs(second_memo) do
		memo_temp[k] = { ['address'] = v.address, ['flags'] = v.flags, ['value'] = tonumber(v.value) + 1 }
	end
	gg.setValues(memo_temp)
end

gg.searchNumber('10', gg.TYPE_DWORD)
memo = gg.getResults( gg.getResultsCount() )

--First Increment
increments(memo)

--Second Increment
increments(memo)
...

---
*Fixed. I forgot something

Issue im finding is it increments all values and makes all them the same , its not +1 to each value listed , its +2 to each value therefor making them all the same 

Posted

[ @KUMADEIT ]
---

Quote

therefor making them all the same 

I never do testing before giving answer but the code looks fine as it calls "gg.getValues" at every iteration, thus the value will incremented. You can also call the 'increments' inside a loop:

--Solution 1
number_of_increments = 5

function increments(memo, n)
	gg.clearResults()
	memo_temp = {}
	for k, v in ipairs(memo) do
		memo_temp[k] = { ['address'] = v.address, ['flags'] = v.flags, ['value'] = tonumber(v.value) + n }
	end
	gg.setValues(memo_temp)
end

for i = 1, number_of_increments do
	increments(memo, n)
end

---

Archived

This topic is now archived and is closed to further replies.

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