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 


Show updated timer value on form

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

Joined: 22 Mar 2009
Posts: 3

PostPosted: Mon Jan 25, 2021 5:12 am    Post subject: Show updated timer value on form Reply with quote

Hey all, sorry if this isn't in the right place.

This is my first proper go using Cheat Engine, I am trying to extract and show the in-game timer from Sniper Elite 4 which I think I got with a pointer scan. My problem is that I am unsure where to go from here..

I created a form within CE, added a timer on 1 second intervals on a label to show the value "in-game timer" and works, but when I re-created a standalone exe it doesn't. I have tried googled it and I am guessing it's because it reads from getMemoryRecordByDescription. And now I am unsure what to do to get it into its own exe.

The code is
Code:

timer = getAddressList().getMemoryRecordByDescription("In-Game Timer")

function UDF1_CETimer1Timer(sender)
UDF1.CELabel1.Caption = (string.format("%2.1f", timer.value))
end

Thank you
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4712

PostPosted: Mon Jan 25, 2021 5:02 pm    Post subject: Reply with quote

I don't know how exe trainers access the address list (if they even can), but I'd put the pointer path in directly.
Code:
function UDF1_CETimer1Timer(sender)
  UDF1.CELabel1.Caption = ("%2.1f"):format(readDouble'[[game.exe+123ABC]+4A8]+10')
end

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
dazmouk
How do I cheat?
Reputation: 0

Joined: 22 Mar 2009
Posts: 3

PostPosted: Tue Jan 26, 2021 6:47 am    Post subject: Reply with quote

Thank you for the reply.

It doesn't work unfortunatly. I kept getting a format error so remove the format and shows nothing.



Code:
function UDF1_CETimer1Timer(sender)
  UDF1.CELabel1.Caption = (readFloat'[[[[SniperElite4_DX11.exe+0xEB0BC8]+f40]+160]+18]+a0')
end


I got told before that it probably isn't possible, so I wasn't holding much hope, I thought I would ask. Thank you again.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4712

PostPosted: Tue Jan 26, 2021 11:20 am    Post subject: Reply with quote

Are you sure you copied/pasted it correctly? Maybe the pointer path isn't always valid and readFloat returns nil? The formatting is fine:
Code:
assert(("%2.1f"):format(392.681) == "392.6")
assert(("%2.1f"):format(0.001) == "0.0")
-- even works with non-normal numbers
assert(("%2.1f"):format(1.4013e-45) == "0.0")
assert(("%2.1f"):format(1.0/0.0) == "inf")
assert(("%2.1f"):format(-1.0/0.0) == "-inf")
assert(("%2.1f"):format(0.0/0.0) == "-nan")

I'd guess it's a bad pointer. Make sure you copied the offsets in the correct order. Looking at a memory record's "change address" window, this would be bottom-up:
Code:
memory record:
f40
160
18
a0
SniperElite4_DX11.exe+0xEB0BC8

pointer path:
[[[[SniperElite4_DX11.exe+0xEB0BC8]+a0]+18]+160]+f40

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
dazmouk
How do I cheat?
Reputation: 0

Joined: 22 Mar 2009
Posts: 3

PostPosted: Thu Jan 28, 2021 5:23 am    Post subject: Reply with quote

Sorry for the late reply.

You were right I had the offsets back to front.

I placed the pointer path and correct offset, generated the exe and it works.

Thank you for your help!
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