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 


AobScan to find base address to generate offsets

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

Joined: 19 Jun 2014
Posts: 72

PostPosted: Tue Aug 05, 2014 6:01 pm    Post subject: AobScan to find base address to generate offsets Reply with quote

I read some threads here but haven't found sth matching my purpose and somehow I'm not able to adapt all parts Wink

What I want to to is the following:
I want to find the base address of the game "WizOrb" which points to a data struct and already got the aobscan correct. Now I want to use the base address to point to magic, lives, gold and mana. I know the offsets but can't use base address + offset in the address field of the table entries. Also I don't know how to permanently save the adapted lua script from daSpamer in my table Surprised

The script so far is the following:
Code:
local AoB = AOBScan("EC 6C ?? ?? ?? ?? ?? 03 ?? ?? ?? 03 ?? ?? ?? 03 ?? ?? ?? 03 ?? ?? ?? 03 28 12 ?? 03 05 00 00 00"); //--> Search the base address
if (AoB == nil or AoB.Count > 1) then --> Ends function earlier if the AoB was not found, or if multiply aobs were found.
   return
end
local BaseAddress = AoB[0]; //--> First address

local pGold  = '[' .. BaseAddress .. ']+54';
local pKeys  = '[' .. BaseAddress .. ']+58';
local pMana  = '[' .. BaseAddress .. ']+5C';
local pLives = '[' .. BaseAddress .. ']+60';

When I print e.g. pGold I got "[theBaseAddress]+54" which I want to store in the address entries of my table.

I don't want to mess with the code but want a simple solution for freezing and manipulating the entries.

I hope there is a not that complex way to achieve this.

Thanks

PS:
Perhaps someone has a good idea to put the whole struct into the table to make it easy manipulating values.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

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

PostPosted: Tue Aug 05, 2014 6:07 pm    Post subject: Reply with quote

Add this to your code
Code:

al=getAddressList()

mr=al.createMemoryRecord()
mr.Description='Gold'
mr.Address=BaseAddress
mr.OffsetCount=1
mr.Offset[0]=0x54

mr=al.createMemoryRecord()
mr.Description='Keys'
mr.Address=BaseAddress
mr.OffsetCount=1
mr.Offset[0]=0x58

mr=al.createMemoryRecord()
mr.Description='Mana'
mr.Address=BaseAddress
mr.OffsetCount=1
mr.Offset[0]=0x5c

mr=al.createMemoryRecord()
mr.Description='Lives'
mr.Address=BaseAddress
mr.OffsetCount=1
mr.Offset[0]=0x5c



Also, to add a structure to a cheat table just add a pointer to the base address, and then give it children with as address "+54" , "+58" , etc...
every time the pointer changes, the children will get changed accordingly

_________________
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
Xathan
Advanced Cheater
Reputation: 1

Joined: 19 Jun 2014
Posts: 72

PostPosted: Tue Aug 05, 2014 6:57 pm    Post subject: Reply with quote

It's working so far. Thanks. Hope you can help me with a little mistake too.

The values are all wrong because hm.. how to explain.. the base address is correct but the +54 is not like the first address offset but just the position 0x54 bytes after the base address.
So if base address is 0x200 then gold is at address 0x254. How can I add these offsets directly to the base address?

I executed the script manually several times and every time there are new entries with the same name. Is there a command to clear the address list first?

And how can I then let the script start automatically so when the game is running and I open the table all is already how it should like?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

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

PostPosted: Wed Aug 06, 2014 3:44 am    Post subject: Reply with quote

ah, so your aobscan doesn't find a pointer to the structure, but the structure itself.
In that case you can remove the
Code:

mr.OffsetCount=1
mr.Offset[0]=0x**

parts and change the address to what you need

e.g:
Code:

mr.Address=BaseAddress.."+54"


alternative, just add the base address and then give it children the address "+54","+58" and let the script only update the base address in the list

to clear the addresslist you can do:
Code:

al=getAddressList()
while al.Count>0 do
  al[0].destroy()
end


to make the script run as soon as the game has been attached use the onOpenProcess function and in there create a timer with a short interval so it runs as soon as everything has been done to open the process

Code:

function onOpenProcess(processid)
  local t=createTimer(nil)
  t.OnTimer=function (t)
      yourcodeorfunctiontoyourcode() 
      t.destroy()
    end

  t.Interval=1
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
Xathan
Advanced Cheater
Reputation: 1

Joined: 19 Jun 2014
Posts: 72

PostPosted: Wed Aug 06, 2014 5:03 am    Post subject: Reply with quote

Thank you very much for your help. I will give feedback as soon as I can test it.

And now I also know why I can't use lua script on my main computer. When I open the lua script of the table my taskbar tells me there is another window but it's never shown. Tested it on my working computer and here I see the window. Can I somehow reset the settings or is it easier to reinstall CE?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

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

PostPosted: Wed Aug 06, 2014 7:09 am    Post subject: Reply with quote

Run the reset settings program in the ce start menu
_________________
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
Xathan
Advanced Cheater
Reputation: 1

Joined: 19 Jun 2014
Posts: 72

PostPosted: Wed Aug 06, 2014 1:08 pm    Post subject: Reply with quote

Thank you again. The table is now ready and I also found out how to set the float type with the main.lua. I will give it a thoroughly examination for better understanding.

Also the reset helped. Now I could easily edit and save the script inside my table. I will put it online immediately =)
Back to top
View user's profile Send private message
greenito
How do I cheat?
Reputation: 0

Joined: 26 May 2014
Posts: 4

PostPosted: Fri Oct 07, 2016 11:55 am    Post subject: Reply with quote

have anyone made a working script for Wizorb game?
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