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 


TTreeNodes.GetNodeFromIndex Index # Out of Bounds (Count=#)

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
cooleko
Grandmaster Cheater
Reputation: 11

Joined: 04 May 2016
Posts: 717

PostPosted: Wed Jun 08, 2016 2:49 am    Post subject: TTreeNodes.GetNodeFromIndex Index # Out of Bounds (Count=#) Reply with quote

Followed instructions from here: http://www.cheatengine.org/forum/viewtopic.php?p=5471426&sid=4c9b410c7265db56a3478c38adfa2db4#5471426

I add 8 entries and remove 8 entries, but always get an error (title)



I have tried terminating early, skipping the last entry, skipping the last two entries, and deleting the memoryrecords in reverse order (so that they are deleted in LiFo fashion). Whenever the table is on its last entry, it gives the error message.

The script correctly builds my cheat table and deletes my cheat table on execution of the code, just trying to figure out why the error and how to get rid of it.
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Wed Jun 08, 2016 5:01 am    Post subject: Reply with quote

Code:
createMemRecOrig=getAddressList().createMemoryRecord
getMemRecByDesc=getAddressList().getMemoryRecordByDescription
registeredMRs={}

function createMemRecAndRegister()
  local obj=createMemRecOrig()
  registeredMRs[1+#registeredMRs]=obj
  return obj
end

function destroyRegisteredMRs()
  for _,v in ipairs(registeredMRs) do
    v.destroy()
  end
  registeredMRs={}
end



for i=1,10 do
  newmr = createMemRecAndRegister()
  newmr.Description =  'Slot '..i
  newmr.IsGroupHeader = true
end

for i=1,10 do
  parent=getMemRecByDesc('Slot '..i)
  newmr = createMemRecAndRegister()
  newmr.Description =  'ItemName'
  newmr.Type=6
  newmr.String.Size=20
  newmr.Address = string.format('%X',(i-1)*32+28)
  newmr.appendToEntry(parent)

  newmr = createMemRecAndRegister()
  newmr.Description =  'Item Amount'
  newmr.Type=2
  newmr.Address = string.format('%X',(i-1)*32+32)
  newmr.appendToEntry(parent)
end

_________________
Back to top
View user's profile Send private message MSN Messenger
cooleko
Grandmaster Cheater
Reputation: 11

Joined: 04 May 2016
Posts: 717

PostPosted: Thu Jun 30, 2016 9:12 pm    Post subject: Reply with quote

I copied your code and am still getting the same error.

Code:
[ENABLE]
luacall(buildTable())
[DISABLE]
luacall(destroyRegisteredMRs())


Code:
createMemRecOrig=getAddressList().createMemoryRecord
getMemRecByDesc=getAddressList().getMemoryRecordByDescription
registeredMRs={}

function createMemRecAndRegister()
  local obj=createMemRecOrig()
  registeredMRs[1+#registeredMRs]=obj
  return obj
end

function destroyRegisteredMRs()
  for _,v in ipairs(registeredMRs) do
    v.destroy()
  end
  registeredMRs={}
end


function buildTable()
  for i=1,10 do
    newmr = createMemRecAndRegister()
    newmr.Description =  'Slot '..i
    newmr.IsGroupHeader = true
  end

  for i=1,10 do
    parent=getMemRecByDesc('Slot '..i)
    newmr = createMemRecAndRegister()
    newmr.Description =  'ItemName'
    newmr.Type=6
    newmr.String.Size=20
    newmr.Address = 00000000
    newmr.appendToEntry(parent)

    newmr = createMemRecAndRegister()
    newmr.Description =  'Item Amount'
    newmr.Type=2
    newmr.Address = 00000000
    newmr.appendToEntry(parent)
  end
end
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 Lua Scripting 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