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 


Questions of Lua Var to address

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

Joined: 01 Mar 2020
Posts: 2

PostPosted: Mon Jan 18, 2021 5:26 am    Post subject: Questions of Lua Var to address Reply with quote

in this code ECX can read a 4 byte int
that show a map size in B
E.g : A map is 1 MB it will show 1,048,576 (B) [1024 x 1024]

But it is hard to read the size in B
so I am trying to make it show it in KB

MapInKB = ECX / 1024
and round it up

MapInKBRoundup =math.floor(MapInKB+1)


Code:
addresslist=getAddressList()

ECX=readInteger("[Game.dll+D7D000]+134")
if ECX~=nil then
MapInKB = ECX / 1024
MapInKBRoundup =math.floor(MapInKB+1)
mr=addresslist_getMemoryRecordByDescription(addresslist, "Map size in KB")
memoryrecord_setAddress(mr,MapInKBRoundup)
end

print(MapInKBRoundup)



Code:
<?xml version="1.0" encoding="utf-8"?>
<CheatTable>
  <CheatEntries>
    <CheatEntry>
      <ID>7345</ID>
      <Description>"Map size in B"</Description>
      <LastState Value="27437" RealAddress="0265103C"/>
      <ShowAsSigned>0</ShowAsSigned>
      <VariableType>4 Bytes</VariableType>
      <Address>Game.dll+D7D000</Address>
      <Offsets>
        <Offset>134</Offset>
      </Offsets>
    </CheatEntry>
    <CheatEntry>
      <ID>7343</ID>
      <Description>"Map size in KB"</Description>
      <ShowAsSigned>0</ShowAsSigned>
      <VariableType>4 Bytes</VariableType>
      <Address>27</Address>
    </CheatEntry>
  </CheatEntries>
</CheatTable>





this code can show MapInKBRoundup in Lua engine
but fail to show the variable (MapInKBRoundup) in address list

I have been google a lot I guess it is

getMemoryRecordByDescription

memoryrecord_setAddress

but it did change the address but it change the value as a address not value as value


I use a dumb way to fix it

Code:

function getMapsize()
ECX=readInteger("[Game.dll+D7D000]+134")
if ECX~=nil then
MapInKB = ECX / 1024
MapInKBRoundup = math.floor(MapInKB + 1)
writeInteger("70002000",MapInKBRoundup)
end
end

getMapsize()



there is a timer looping getMapsize()
Back to top
View user's profile Send private message
Oxijen
Expert Cheater
Reputation: 0

Joined: 07 May 2020
Posts: 163
Location: On The Moon

PostPosted: Wed Jan 20, 2021 1:00 pm    Post subject: Reply with quote

Try this
Code:
addresslist=getAddressList()

ECX=readInteger("[Game.dll+D7D000]+134")
if ECX~=nil then
MapInKB = ECX / 1024
MapInKBRoundup =math.floor(MapInKB+1)
mr=addresslist_getMemoryRecordByDescription(addresslist, "Map size in KB")
memoryrecord_setValue(mr,MapInKBRoundup)
end

print(MapInKBRoundup)
i think this should work gl
_________________
I can see you Hitler
Especially When I am On the Moon!!
You are Right now in cheat engine forum Wink
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