Page 1 of 1

Can Lua batch copy and add groups?

Posted: Tue Feb 16, 2021 5:25 am
by longsers
Similar to this question
cheatengine.org/forum/viewtopic.php?t=609399
If there is already a ready group,header's Description is Character1
like this:

Code: Select all

Character1
   hp    [[a.exe+123]+104]+10
   mp    [[a.exe+123]+108]+10
   str     [[a.exe+123]+10c]+10
Zanzer gave a lua batch editing offset

Code: Select all

local list = getAddressList()
for n = 0, list.Count - 1 do
  local rec = list[n]
  if rec.OffsetCount > 0 then
    rec.Offset[1] = rec.Offset[1] + 0x100
  end
end
Can Lua be used to increase 100 groups at once?
such as:

Group2 is

Code: Select all

Character2
   hp     [[a.exe+123]+204]+10
   mp    [[a.exe+123]+208]+10
   str    [[a.exe+123]+20c]+10
-------------------------------
finally, The twisty method is to repeat the copy and paste 8 times to get 128 groups, and then delete 28 groups
and use this

Code: Select all

local list = getAddressList()
 for n = 0, list.Count - 1 do
  local rec = list[n]
  if rec.OffsetCount > 0 then
    local m = math.floor(n/4)
    rec.Offset[1] = rec.Offset[1] + m*0x100
  end
end