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 


Mass add pointer addresses with an increasing offset.

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

Joined: 21 Nov 2015
Posts: 36

PostPosted: Sat Feb 11, 2017 12:08 am    Post subject: Mass add pointer addresses with an increasing offset. Reply with quote

Essentially I want to do what the following script, shamelessly stolen from zanzer, does, but with pointers.

Code:
function addMoreAddresses(baseAddress, num, step)
  local al = getAddressList()

  local base = al.createMemoryRecord()
  base.setAddress(baseAddress)
  base.setDescription("Base Address")
  base.Type = vtString
  base.String.Size = 0

  for i=0, num-1 do
    local rec = al.createMemoryRecord()
    local str = string.format("+%X", i * step)
    rec.setAddress(str)
    rec.setDescription(str)
    rec.appendToEntry(base)
  end
end

addMoreAddresses("002C083C", 10, 4)


Someone else mentioned wanting to accomplish similar, so zanzer offered the following edit of

Code:
local al = getAddressList()
...
local rec = al.createMemoryRecord()
rec.setAddress("00000000")
rec.setOffsetCount(3)
rec.setOffset(0, 0x10)
rec.setOffset(1, 0x20)
rec.setOffset(2, 0x30)


but I don't understand how to use it. My "base" pointer is
"[citra-qt-gcc-jit-18.exe+004DD2F0]+28E"
and I'd like to automatically add a bunch of address listings for every 110 up (something like 40 of them), to get +39E,+4AE, etc.

I've tried throwing my pointer in there at a few different points but the "0x10" and such has me completely lost, and I think the codes trying to add a bunch of offsets to ONE pointer which is not what I want; I want 40 different listings, each a single pointer.

Thanks for any help in advance, be it explaining how adding pointer records via LUA or just how to adapt the code above for this use-case. Been trying to shove my numbers in there in various places and while I can get it to work for non-pointers, I'm at a loss beyond that.
Back to top
View user's profile Send private message
Filipe_Br
Master Cheater
Reputation: 3

Joined: 07 Jan 2016
Posts: 272
Location: My house

PostPosted: Sat Feb 11, 2017 5:25 am    Post subject: Re: Mass add pointer addresses with an increasing offset. Reply with quote

If I understood what you want, this will do.
Code:

quantity_address = 40
base_address = getAddress('[[citra-qt-gcc-jit-18.exe+004DD2F0]+28E]'
all_address = {}
affset = 0
displacement = 0x110

for i=1,quantity_address do
    all_address[i] = base_address + offset
    offset = offset + displacement
end

Yesterday I wrote an aimbot that used 40 addresses, to facilitate getting a list with all the addresses, I wrote a script similar to this.

_________________
...
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Sat Feb 11, 2017 9:09 am    Post subject: Reply with quote

Code:
local al = getAddressList()

local base = al.createMemoryRecord()
base.Description = "Base Address"
base.Address = "citra-qt-gcc-jit-18.exe+004DD2F0"
base.OffsetCount = 1
base.Offset[0] = 0
base.Type = vtString
base.String.Size = 0

local offset = 0x28E
for i = 1, 40 do
  local rec = al.createMemoryRecord()
  local addr = string.format("+%X", offset)
  rec.Description = addr
  rec.Address = addr
  rec.appendToEntry(base)
  offset = offset + 0x110
end
Back to top
View user's profile Send private message
Valatros
Cheater
Reputation: 1

Joined: 21 Nov 2015
Posts: 36

PostPosted: Sat Feb 11, 2017 12:24 pm    Post subject: Reply with quote

Awesome, thanks both of you. Interesting to see the two different approaches to doing the same thing, too.

Filipe_Br wrote:
If I understood what you want, this will do.
Code:

quantity_address = 40
base_address = getAddress('[[citra-qt-gcc-jit-18.exe+004DD2F0]+28E]'
all_address = {}
affset = 0
displacement = 0x110

for i=1,quantity_address do
    all_address[i] = base_address + offset
    offset = offset + displacement
end

Yesterday I wrote an aimbot that used 40 addresses, to facilitate getting a list with all the addresses, I wrote a script similar to this.


You missed a parenthesis and had a typo, but even after fixing those... running the script shoots no errors, but doesn't do anything. Not sure I explained what I'm trying to do correctly, so gonna use screenshots below

Zanzer wrote:
Code:
local al = getAddressList()

local base = al.createMemoryRecord()
base.Description = "Base Address"
base.Address = "citra-qt-gcc-jit-18.exe+004DD2F0"
base.OffsetCount = 1
base.Offset[0] = 0
base.Type = vtString
base.String.Size = 0

local offset = 0x28E
for i = 1, 40 do
  local rec = al.createMemoryRecord()
  local addr = string.format("+%X", offset)
  rec.Description = addr
  rec.Address = addr
  rec.appendToEntry(base)
  offset = offset + 0x110
end


This made the addresses, but the new additions aren't pointers themselves; they're still just regular addresses. So they won't work next boot.

What I have is, the first pointer is the following:



Then the next exp pointer is


and that goes on for over 40 character slots. I don't want a big single code that runs each time to edit ALL exp; I want functional addresses for each one separately to be edited. Hoping to adjust the script to do the same for items, stats, etc. later but I need a working base to start with.

Filipe's script isn't adding any addresses and I don't even begin to understand it so I have no idea why. zanzer's is making the addresses, but the new ones aren't pointers, only the base one is. I... think I might be able to adjust it using the code that made the base a pointer correctly, but wanted to post this so that if I fail a response might be added when I get off work.

Edit: Fixed images because apparently foruming is hard.
Back to top
View user's profile Send private message
Filipe_Br
Master Cheater
Reputation: 3

Joined: 07 Jan 2016
Posts: 272
Location: My house

PostPosted: Sat Feb 11, 2017 1:44 pm    Post subject: Reply with quote

When I wrote that script, I got the wrong impression of what you really needed.
_________________
...
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Sat Feb 11, 2017 5:55 pm    Post subject: Reply with quote

If you wanted them all separate, instead of children...
Code:
local al = getAddressList()

local offset = 0x28E
for i = 1, 40 do
  local rec = al.createMemoryRecord()
  rec.Description = string.format("+%X", offset)
  rec.Address = "citra-qt-gcc-jit-18.exe+004DD2F0"
  rec.OffsetCount = 1
  rec.Offset[0] = offset
  offset = offset + 0x110
end
Back to top
View user's profile Send private message
Valatros
Cheater
Reputation: 1

Joined: 21 Nov 2015
Posts: 36

PostPosted: Sat Feb 11, 2017 7:14 pm    Post subject: Reply with quote

Perfect Zanzer, thank you! Yup that's what I wanted; previously it was just making them all children of the single pointer, with the children having no offset.
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