Memrec Group's Children Indexing / Group Options

Want Cheat Engine to do something specific and no idea how to do that, ask here. (From simple scripts to full trainers and extensions)
Post Reply
User avatar
EpicBirdi
Fearless Donors
Fearless Donors
Posts: 64
Joined: Sat Jul 21, 2018 2:22 pm
Reputation: 59

Memrec Group's Children Indexing / Group Options

Post by EpicBirdi »

Trying to write up some freeform functions I can pull from, but I'm not sure how to change the Index of children.. I see that you have access to a memrec's Index as read-only, and you can access a group's children via Child[index].

So.. how would I change a child's index under a group? Using appendToEntry() always puts it at the bottom of the group, and I'd like more control over that.

Currently I've just got this, but it doesn't work because the Index field is read-only, I'm guessing.

Code: Select all

local function childAppend(memDesc, parent)
  local al=getAddressList()
  for i=0,al.Count-1 do
    if al[i].Description == parent then
       trueParent = al[i]
    end
  end
  for i=0,al.Count-1 do
    if al[i].Description == memDesc then
       al[i].appendToEntry(trueParent)
    end
  end
  local TPCC = trueParent.Count -- Stores the index of the newly appended memrec
  trueParent[TPCC].Index = 0  -- Desired effect, anyway.. move the index/order of children.. can be expanded upon but I need this first
end
  -- trueParent.Child[TPCC].Index = 0 also doesn't work, presumably for the same reason?
I also fail to understand the Options property.. The wiki's small example doesn't really do it for me I guess.
I figured it was something like this, but no dice.

Code: Select all

Group.Options = [moHideChildren,moDeactivateChildrenAsWell]

aSwedishMagyar
Table Makers
Table Makers
Posts: 690
Joined: Mon Jul 06, 2020 3:19 am
Reputation: 1260

Re: Memrec Group's Children Indexing / Group Options

Post by aSwedishMagyar »

So for the first problem, I would just save the memrecs in a table and do a loop that appends them in that order to the parent rec. You can create the table and then use table.insert to put your new record in the right spot.
EpicBirdi wrote:
Thu Aug 19, 2021 9:17 am
I also fail to understand the Options property.. The wiki's small example doesn't really do it for me I guess.
I figured it was something like this, but no dice.

Code: Select all

Group.Options = [moHideChildren,moDeactivateChildrenAsWell]
This is luckily a simple fix, the options need to be a string so just put quotes around them like this: "[moHideChildren,moDeactivateChildrenAsWell]"

User avatar
EpicBirdi
Fearless Donors
Fearless Donors
Posts: 64
Joined: Sat Jul 21, 2018 2:22 pm
Reputation: 59

Re: Memrec Group's Children Indexing / Group Options

Post by EpicBirdi »

Thanks again Magyar, pretty easy fixes both ways haha. Hopefully I can finish what I'm writing so I can post it soon.

Post Reply

Who is online

Users browsing this forum: Baidu [Spider]