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 


A Problem about Memory Address Offset(Perfect solution)

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

Joined: 11 Oct 2019
Posts: 3

PostPosted: Fri Oct 11, 2019 12:46 am    Post subject: A Problem about Memory Address Offset(Perfect solution) Reply with quote

Code:

function MyScan777()
//--.......Some unimportant code
    Scan.firstScan(soExactValue, vtGrouped, rtExtremerounded, "4:1013 4:1 4:1067450368", "", StartAddress, EndAddress, "", fsmAligned, "4", false, false, false, false);
local addrList = getAddressList();
local result = MyScan777();
local count = result.getCount();
for i=0, count-1, 1 do
//+++++Important issues++++++++
  local addr = result.getAddress(i);
  //--local addr_1 = [addr + 0x00000004];//This is an incorrect expression.And it's my problem
    writeFloat(addr_1,0.4);
  //--local addr_2 = [addr + 0x00000008];//like addr_1
    writeFloat(addr_2,0.8);
//------Important issues--------
end
//Memory state:
//4DFF0000 1013            --addr Pointing here
//4DFF0004 1
//4DFF0008 1067450368      --Need addr_1 to point here
//4DFF000C 1067450368      --Need addr_2 to point here

Who can help me? Shocked Shocked Embarassed [/code]


Last edited by cvi001 on Fri Oct 11, 2019 8:36 pm; edited 3 times in total
Back to top
View user's profile Send private message Send e-mail
mgr.inz.Player
I post too much
Reputation: 218

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

PostPosted: Fri Oct 11, 2019 7:14 am    Post subject: Re: A Syntax Problem about Memory Address Offset Reply with quote

Code:

...
    writeFloat(addr+0x4, 0.4)
    writeFloat(addr+0x8, 0.8)
...

_________________
Back to top
View user's profile Send private message MSN Messenger
cvi001
How do I cheat?
Reputation: 0

Joined: 11 Oct 2019
Posts: 3

PostPosted: Fri Oct 11, 2019 7:57 am    Post subject: Re: A Syntax Problem about Memory Address Offset Reply with quote

mgr.inz.Player wrote:
Code:

...
    writeFloat(addr+0x4, 0.4)
    writeFloat(addr+0x8, 0.8)
...


I‘m sorry my friend,It's not working.But you got the point!

This variable addr does store the address. addr == "4DFF0000"
but it's a string, not a number.so..... Sad
Back to top
View user's profile Send private message Send e-mail
mgr.inz.Player
I post too much
Reputation: 218

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

PostPosted: Fri Oct 11, 2019 11:03 am    Post subject: Reply with quote

Code:
...
    local addr = tonumber(result.getAddress(i),16)
...
    writeFloat(addr+0x4, 0.4)
    writeFloat(addr+0x8, 0.8)
...

_________________
Back to top
View user's profile Send private message MSN Messenger
cvi001
How do I cheat?
Reputation: 0

Joined: 11 Oct 2019
Posts: 3

PostPosted: Fri Oct 11, 2019 1:41 pm    Post subject: Reply with quote

mgr.inz.Player wrote:
Code:
...
    local addr = tonumber(result.getAddress(i),16)
...
    writeFloat(addr+0x4, 0.4)
    writeFloat(addr+0x8, 0.8)
...

Very Happy Very Happy Very Happy Very Happy
Yah!! you found the right way.Amazing...

"tonumber(string,16)" solved all the problems.
Code:

writeFloat(addr+0x4, 0.4) -> writeFloat("addr+0x4", 0.4)

!!!!Thank you !!!!
Back to top
View user's profile Send private message Send e-mail
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