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 


Building a pointer in my script

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

Joined: 22 May 2019
Posts: 4

PostPosted: Wed Jun 12, 2019 12:32 am    Post subject: Building a pointer in my script Reply with quote

I am trying to build a pointer in my script that then checks the value of the end result. If the value is 0 it saves that value to its child. How do you build a pointer in lua? I thought it was like this but I guess I read wrong.
Code:

[ENABLE]
{$lua}
disableMemrec(memrec)
players = {38,70,A8,E0,118}
for i,offset in ipairs(players) do
local adr = getAddress("DarkSoulsIII.exe")
adr = readPointer(adr+4768E78) -- BaseB
adr = readPointer(adr+40)
adr = readPointer(adr+offset)
local val = readBytes(adr+70)
if(val == 0) then
child = memrec.Child[0]
adr = getAddress("BaseB")
adr = readPointer(adr+40)
adr = readPointer(adr+offset)
adr = readPointer(adr+XB)
val = readString(adr+7D8)
child.Value = val
end
end
{$asm}
createThread(Snipe)
[DISABLE]
Back to top
View user's profile Send private message
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Wed Jun 12, 2019 12:54 pm    Post subject: Reply with quote

numbers in lua are in decimal unless you prefix with 0x so 10 is ten but 0x10 is sixteen. BTW getAddress and readString etc.'s string parsing can handle eg. "[[BaseB+40]+7D8]+10", in which case it uses the same parsing as CE does in the address list so numbers are hex by default. It can't do variable interpolation on it's own though so for a variable/looped offset you'd have to build a string with eg. readString(("[[[BaseB+40]+%X]+??]+7D8"):format(offset)) (XB is not a valid hex value btw, hence the ??s)
_________________
https://github.com/FreeER/ has a few CE related repos
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