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 


reading a linked list

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

Joined: 08 Sep 2010
Posts: 28

PostPosted: Sun Aug 07, 2011 6:13 pm    Post subject: reading a linked list Reply with quote

Could someone explain (or point me in the right direction) how I am supposed to read in a linked list in a target program ?

I figured out that the structure for an inventory item is 48 bytes big and that the first 4 bytes of each structure is a pointer to the next inventory item.
The last inventory item has all zeroes in the next_item_pointer field (end of LL)

I also located a static pointer that always points to the first item (first node on the linked list).

I suppose LUA needs to parse each node as it is variable how many nodes (inventory items) are present at any time.

(target program is nethack for windows)

if anyone has any code snipets, advise or pointers where I should look for info on how to do this in CE, that would be greatly appreciated.

I'm no wiz coder, but there is no need to dumb it down Smile I can handle it.
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: Sun Aug 07, 2011 6:29 pm    Post subject: Reply with quote

Look into readInteger
use readInteger to read the pointer and use that as the pointer for the next block

For the rest use readBytes, readFloat, etc... to read entries of the current block

As for programming it look into examples. LUA supports while loops so you can do the check if the next (or current) block is null there

example:
Code:

curentblock=readInteger("[[bla.exe+1234]+5678]+4") --read the pointer to the first block

while ((currentblock ~= 0) and (currentblock ~= nil)) do
  --do something with the data at currentblock (e.g print)

  currentblock=readInteger(currentblock)   --get next block
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
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