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 


How to read a value and update a Label

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

Joined: 12 Mar 2017
Posts: 4

PostPosted: Tue Mar 14, 2017 12:34 pm    Post subject: How to read a value and update a Label Reply with quote

I am having a hard time finding solid resources on Lua code that works with Cheat Engine. So if anyone has the solid reference link please let me know.

Anyway... I am looking for help with a simple concept. I have a label, named Label1. I would like Label1 to show the value of an address that I have, address = 7FF6104486E3.

If something like a label cant be used in a situation like this then thats fine but I would like the label value to refresh whenever the address value changes.
Can someone please help?
Back to top
View user's profile Send private message
akumakuja28
Master Cheater
Reputation: 16

Joined: 28 Jun 2015
Posts: 432

PostPosted: Tue Mar 14, 2017 12:49 pm    Post subject: Reply with quote

Code:

--[[

readSmallInteger(address) : Reads a 16-bit integer from the specified address
readInteger(address) : Reads a 32-bit integer from the specified address
readQword(address): Reads a 64-bit integer from the specified address
readPointer(address): In a 64-bit target this equals readQword, in a 32-bit target readInteger()
readFloat(address) : Reads a single precision floating point value from the specified address
readDouble(address) : Reads a double precision floating point value from the specified address
readString(address, maxlength, widechar OPTIONAL) : Reads a string till it encounters a 0-terminator. Maxlength is just so you won't freeze for too long, set to 6000 if you don't care too much. Set WideChar to true if it is encoded using a widechar formatting
writeSmallInteger(address,value) : Writes a 16-bit integer to the specified address. Returns true on success
]]


address = '00150038'  --- change this


f = createForm()

Label1 = createLabel(f)


function ReadAddress()
Label1.Caption = readInteger(address)
end


ReadTimer = createTimer(f)
ReadTimer.Interval = 500  --0.5 seconds
ReadTimer.OnTimer = ReadAddress

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

Joined: 12 Mar 2017
Posts: 4

PostPosted: Tue Mar 14, 2017 1:10 pm    Post subject: Now we are talking! Reply with quote

OK so i got the address with your script but it opened a different window with the number.

So i through for now Ill try this(see below). However this isnt working at all. I know I said i wanted it to update automatically but just for me troubleshooting I thought it would be easier to make it an onclick event


function CEButton2Click(sender)

address = '7FF6104486E2' --- changed this
Label1.Caption = readQword(address)

end

**My end game here is to create an error that I will be able to copy and paste some stats similar to what you see below. Please let me know if you think this is the best way to go about this.

Highlight-able Output:
Player 1: 82
Player 2: 11
Player 3: 32
Player 4: 55
Back to top
View user's profile Send private message
rowhyung
How do I cheat?
Reputation: 0

Joined: 09 Feb 2021
Posts: 3

PostPosted: Tue Feb 09, 2021 5:51 pm    Post subject: how do I choose a form and label that I already have made? Reply with quote

I want to use the code but I choose the form and the label that I am going to use and then change the positions, the font, the size and other things from the form designer, I tried to modify the code on my own but it seems to be made to be something temporary that is created at the moment and when I want to execute the script as an exe or if I execute it even from the cheat engine after closing the table without closing the cheat engine the values ​​stop changing and when I check the timer from the form designer everything is in white
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