Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[Bug] 6.8.3: TTreeNodes.GetNodeFromIndex Index Out of Bounds

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
Nyqita
How do I cheat?
Reputation: 0

Joined: 10 Jun 2019
Posts: 4

PostPosted: Mon Jun 10, 2019 6:14 pm    Post subject: [Bug] 6.8.3: TTreeNodes.GetNodeFromIndex Index Out of Bounds Reply with quote

Cheat engine 6.8.3 bug report

Summary:
If a script deletes its children memory records when deactivated, then deactivating it with the space key creates an error

Steps to reproduce:
1. Run Cheat Engine 6.8.3
2. Create a script memory record in the cheat table
3. Add some child memory records to it
4. Ensure the [DISABLE] portion of the script deletes its child memory records
5. Once active, select the parent script memory record and use the space key to deactivate it

Expected results:
Parent memory record deactivates without error after having deleted all children memory records

Actual results:
Children memory records are successfully deleted, but the following error pops up afterwards

Code:
TTreeNodes.GetNodeFromIndex Index somenumber Out of Bounds (Count = somenumber)


Further information:
Even assigning the space key as a hotkey to toggle the parent script doesn't produce the error.

For your convenience, I've provided a simple cheat table entry as a demonstration. In the disable section of the script, there are three slightly different functions for deleting child memory records. From my testing, they all produce the same error under the exact same circumstance.

Code:

<?xml version="1.0" encoding="utf-8"?>
<CheatTable>
  <CheatEntries>
    <CheatEntry>
      <ID>0</ID>
      <Description>"Parent memory record"</Description>
      <LastState/>
      <VariableType>Auto Assembler Script</VariableType>
      <AssemblerScript>{$lua}
function childCreator(memoryRecord, numberOfChildrenMemoryRecords)
  for i = 1, numberOfChildrenMemoryRecords do
    local childMemoryRecord = getAddressList().createMemoryRecord()
    childMemoryRecord.Description = "Child memory record " .. i
    childMemoryRecord.appendToEntry(memoryRecord)
  end
end

function childDeleter1(memoryRecord)
  -- Keep checking the number of children and delete the first child, until no children remain
  while memoryRecord.Count &gt; 0 do
    local childRecord = memoryRecord.Child[0]
    childRecord.destroy()
    --memoryrecord_delete(childRecord)
  end
end

function childDeleter2(memoryRecord)
  -- Count forwards from 1 to the total number of children, and delete the first child
  for i = 1, memoryRecord.Count do
    local childRecord = memoryRecord.Child[0]
    childRecord.destroy()
    --memoryrecord_delete(childRecord)
  end
end

function childDeleter3(memoryRecord)
  -- Count backwards from the total number of children to 1, and delete the last child
  for i = memoryRecord.Count - 1, 0, -1 do
    local childRecord = memoryRecord.Child[i]
    childRecord.destroy()
    --memoryrecord_delete(childRecord)
  end
end

[ENABLE]
childCreator(memrec, 5)

[DISABLE]
childDeleter1(memrec)
-- childDeleter2(memrec)
-- childDeleter3(memrec)
</AssemblerScript>
      <Hotkeys>
        <Hotkey>
          <Action>Toggle Activation</Action>
          <Keys>
            <Key>17</Key>
            <Key>32</Key>
          </Keys>
          <ID>0</ID>
        </Hotkey>
      </Hotkeys>
    </CheatEntry>
  </CheatEntries>
</CheatTable>


After having tried various different deletion methods and searching the forums for possible solutions, I eventually thought it was likely due to a bug.

I apologise if this is a result of some error on my part. I hope someone might be able to help me understand what I've done wrong to create this error in this one specific circumstance.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25288
Location: The netherlands

PostPosted: Wed Jun 12, 2019 12:26 am    Post subject: Reply with quote

I can not reproduce this in 6.8.3
Are you using windows XP? Or using a self built version ?

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Nyqita
How do I cheat?
Reputation: 0

Joined: 10 Jun 2019
Posts: 4

PostPosted: Wed Jun 12, 2019 8:32 am    Post subject: Reply with quote

I'm sorry, I should have given some information about my system as well.

Dark Byte wrote:
Are you using windows XP?

Windows 10 Pro x64, version 1809 (OS Build 17763.557), with no changes that I'm aware of.

Dark Byte wrote:
Or using a self built version ?

I am running Cheat Engine with the "cheatengine-x86_64.exe" executable of the latest version (6.8.3) downloaded from wwwDOTcheatengineDOTorg/downloads.php and, to the best of my knowledge, unmodified in any way.

Please tell me if there are any other details I could provide that might be helpful. I hope I haven't wasted anyone's time by reporting an issue that is unique to me or my system.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25288
Location: The netherlands

PostPosted: Wed Jun 12, 2019 9:55 am    Post subject: Reply with quote

ok, ive manage to reproduce it. it's the space key
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Nyqita
How do I cheat?
Reputation: 0

Joined: 10 Jun 2019
Posts: 4

PostPosted: Wed Jun 12, 2019 10:14 am    Post subject: Reply with quote

Dark Byte wrote:
it's the space key


Would you be able to suggest some way that I can deactivate the script using the space key without the error popping up? Is there something I can do that would suppress those error pop-ups, or a different deletion method I might use that doesn't cause the space key to have that effect upon deactivation?

From what I can tell, my scripts seem to otherwise function properly when deactivated - despite the pop-up error message. Anything that could prevent the messages appearing would solve the problem I'm having.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25288
Location: The netherlands

PostPosted: Wed Jun 12, 2019 12:06 pm    Post subject: Reply with quote

here's a temporary fix, not sure how it works in the rest of the table though

execute this code (only needs to be called once):
Code:

atv=AddressList.Component[0]
atv.OnKeyDown=function(s,k)
  if atv.Selected and (k==VK_SPACE) then
    atv.Selected.HasChildren=false
  end
end

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Nyqita
How do I cheat?
Reputation: 0

Joined: 10 Jun 2019
Posts: 4

PostPosted: Thu Jun 13, 2019 2:04 pm    Post subject: Reply with quote

The code you provided seems to work well without causing the previous error, but unfortunately will indiscriminately delete all child entries of any selected entry deactivated with space. I'm hoping to find a solution that would work in a cheat table which uses scripts that auto-delete their children, as well as headers with children that must be preserved.

I'm very unfamiliar with how Cheat Engine works, but from searching through the script engine documentation on the wiki, it seems that
Code:
atv.Selected
in the code you wrote might be a TreeNode object. If that's the case, is there some way to access the TreeNode associated with a memory record?

Might it be possible to use something like the following to delete the children of the specified cheat entry?

Code:
function getTreeNodeByMemoryRecordID(memoryRecordID)
  -- return a TreeNode object associated with the given memoryRecord
end

function childDeleter(memoryRecord)
  -- Destroy child entries by setting the HasChildren property of the associated TreeNode object to false
  local treeNode = getTreeNodeByMemoryRecordID(memoryRecord.ID)
  treeNode.HasChildren = false
  -- treeNode.deleteChildren()
end

[DISABLE]
childDeleter(memrec)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites