This is regarding a previous post which got posted by accident in the LUA script section while it had to be in Help.
Managed to kind of get the script working. Now it does load the correct addresses and their corresponding names in to the saved list. The only problem im having is that this process is really slow. Its adding the addresses in the saved list one by one for each loop..which is kind of slow. Is there a way to optimize the script in a way that it does the objective (adding the addresses of the table "baseValue" in to the saved list with their corresponding names) faster? Here is the script.
function skillsGroup()if loopSkills <=1then
gg.clearResults()
gg.setRanges(gg.REGION_ANONYMOUS | gg.REGION_C_ALLOC | gg.REGION_OTHER)
gg.searchNumber(1000, gg.TYPE_QWORD)
a = gg.getResults(1000)
resultAmount = gg.getResultsCount()
skills ={}
baseValue ={}
loop =1endfor i, v in ipairs(a)do
skills[i]={address = a[loop].address +0x18, flags = gg.TYPE_QWORD}-- skillIdOffset: 32bit = 0x8 | 64bit = 0x10
baseValue[i]={address = a[loop].address +0x28, flags = gg.TYPE_DOUBLE}--end
gg.clearResults()
baseValue = gg.getValues(baseValue)-- the table to which i want to past each complete string
skills = gg.getValues(skills)-- value on these addresses == pointers to string namefor i, v in ipairs(skills)do
v.address = v.value
end
skills = gg.getValues(skills)
stringLengthFilter ={}for i, v in ipairs(skills)do
stringLengthFilter[i]={address = v.address +0x10, flags = gg.TYPE_BYTE}-- value on those addresses == length of the string to be copiedend
stringLength = gg.getValues(stringLengthFilter)--[[
stringLength = {}
for i, v in ipairs(stringLengthFilter) do
if v.value > 5 and v.value < 80 then
stringLength[#stringLength + 1] = v
end
end
]]if loop >1then
tester()endreturn skills, resultAmount, stringLength
end
skillsGroup()function tester()
resultAddress ={}for i =1,1do
resultAddress[#resultAddress +1]={address = stringLength[1].address +2, flags = gg.TYPE_BYTE, value = stringLength[1].value}-- + 2 == start of the first char of the string
saint ={}for j =0, resultAddress[1].value *2do
saint[#saint +1]={address = resultAddress[1].address + j, flags = gg.TYPE_BYTE}end
saint = gg.getValues(saint)
finish ={}local str =''for i, v in ipairs(saint)do
str = str .. string.char(v.value &0xFF)end
finish ={}
finish[1]={address = baseValue[i].address, flags = gg.TYPE_DOUBLE, name = str}
print(finish)
gg.addListItems(finish)end
loop = loop +1if loop == resultAmount then
os.exit()end
skillsGroup()end
tester()
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.
Question
Platonic
Hi.
This is regarding a previous post which got posted by accident in the LUA script section while it had to be in Help.
Managed to kind of get the script working. Now it does load the correct addresses and their corresponding names in to the saved list. The only problem im having is that this process is really slow. Its adding the addresses in the saved list one by one for each loop..which is kind of slow. Is there a way to optimize the script in a way that it does the objective (adding the addresses of the table "baseValue" in to the saved list with their corresponding names) faster? Here is the script.
Some help, guidance would be great.
5 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.