Jump to content
  • 0

Help Set Values at Address with sequential offset


Kimiice7

Question

Help me to build this script..

gg.setRanges(gg.REGION_C_ALLOC)
gg.searchNumber('0;1;2:', gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1)
gg.refineNumber('0', gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1)

--for information, i need to edit 100 items--
--t[1], t[1].address +150, t[1].address +300, t[1].address +450, ..etc.--
--I already know the pattern is t[1].address +(150*n)--

--its for edit first item--
t = gg.getResults(5)
for i, v in ipairs(t) do
  t[1].value = 99
end
gg.setValues(t)

--here the problem --
--QUESTION : how to edit 2nd item untill 100th item in one command?--

for i, v in ipairs(t) do
  t[1].address = t[1].address +150
  t[1].value = 99 --edit 2nd item--
end
gg.setValues(t)

--its waste time to edit it one by one untill 100th item--
--i did some trial and error to edit all of them in one shoot--
--like n = (1~100) , t[1].address = t[1].address + (150*n)--
--but fail, i tried on gg.alert(1~100) its show alert 101, i feel stupid 😁 --

-- I TRIED TO SEARCH REFERENCES FOR THIS,--
--READ Some guide on this web, but not yet found the answear.--

gg.alert('THANKS FOR HELPING ME 🙏')

Help Set Multiple Values.lua

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

18 minutes ago, ItsSC said:

local t = gg.getResults(5)
local t1 = {}
for i = 0, 99 do 
	t1[#t1+1] = {address = t[1].address + 150*i, flags = 4,value = 99}
end
gg.setValues(t1)

 

Thanks brother.. For your help,

Will try on my real codes now..

Link to comment
Share on other sites

10 minutes ago, Enyby said:

Second row rewrite first row.

The form like this was out of my knowledge..

But when i see this.. I can get it,

Where i can learn more about scripting language like this?

Anyway.. This forum really helpfull to help people like me who want to learn more about lua scripting.

Thanks alot..

Link to comment
Share on other sites

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.