Jump to content

Copy UTF-16 and add in new table


Platonic

Recommended Posts

 

function skillsGroup()
  gg.clearResults()
  gg.setRanges(gg.REGION_ANONYMOUS | gg.REGION_C_ALLOC | gg.REGION_OTHER)
  gg.searchNumber(1000, gg.TYPE_QWORD) 
    a = gg.getResults(1000)
    skills = {}
    baseValue = {}
    for i, v in ipairs(a) do
      skills[i] = {address = v.address + 0x18, flags = gg.TYPE_QWORD} 
      baseValue[i] = {address = v.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 name
    for 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 copied
    end
    stringLengthFilter = 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
    
    gg.loadResults(stringLength)
    resultAmount = gg.getResultsCount()
    stringLength = gg.getResults(resultAmount)
  return skills, resultAmount, stringLength
end
skillsGroup()

function tester(final)
  resultAddress = {}
  for i = 1, resultAmount do
    resultAddress[#resultAddress + 1] = {address = stringLength[i].address + 2, flags = gg.TYPE_BYTE, value = stringLength[i].value} -- + 2 == start of the first char of the string
    saint = {} 
    for j = 1, resultAddress[i].value * 2 do
      saint[#saint + 1] = {address = resultAddress[i].address + j, flags = gg.TYPE_BYTE}
    end
    saint = gg.getValues(saint)
    table = {}
    str = {}
    local str = ''
    for i, v in ipairs(saint) do
      str = str .. string.char(v.value & 0xFF)
    end
    finish = {}
    for i, v in ipairs(saint) do
      finish[#finish + 1] = {address = baseValue[i].address, flags = v.flags, name = str}
    end
    print(i, 'address: ', stringLength[i].address, 'name: ', str)
  end
end
tester()

The script must put the string names in the table of "baseValue", by chronological order and then add that table in saved items. Kind of has to do like in the screenshot(unknown-5.png). But this script is not working as i want to. I can't get the strings out of the for loop. And when i try to put the name to some address the name will appear the same amount of times on different addresses as the length of a string. If i print the table "finish" then its missing a bunch off addresses, And only showing the last name that has been copied. 

how do i fix this?

 

unknown-5.png

unknown-6.png

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.