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 


Change value of static adress with checkbox

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
lothe23
Advanced Cheater
Reputation: 0

Joined: 28 May 2016
Posts: 51

PostPosted: Sat Apr 08, 2023 11:09 am    Post subject: Change value of static adress with checkbox Reply with quote

Hello!
Im trying to change the value of a static address with a checkbox in my trainer, however without any success. Is there any obvious issues with this code?

Im not getting any errors but also no result

Code:
function CETrainer_CECheckbox2Change(sender)
  if (CETrainer.CECheckbox2.State==cbChecked)then
   writeFloat(0x0080CFFD, 1)
  else
   writeFloat(0x0080CFFD, 2)
   end
end
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Sat Apr 08, 2023 11:24 am    Post subject: Reply with quote

An unaligned float? I'd guess that's the wrong address. Static addresses should be something like "game.exe+1234" anyway.

If you're certain that's fine, make sure the OnChange property of the checkbox is that function. (execute the main Lua script to define that function and assign it in the forum designer)

_________________
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
AylinCE
Grandmaster Cheater Supreme
Reputation: 31

Joined: 16 Feb 2017
Posts: 1234

PostPosted: Sat Apr 08, 2023 1:24 pm    Post subject: Reply with quote

This is working.

Code:
CETrainer.CECheckbox2.OnChange=function(sender)
 val = readFloat("0080CFFD")
 print(val)
  if CETrainer.CECheckbox2.Checked==true then
   writeFloat("0080CFFD", 1)
  else
   writeFloat("0080CFFD", 2)
   end
end

CETrainer.show()



ek1.PNG
 Description:
 Filesize:  30.41 KB
 Viewed:  1157 Time(s)

ek1.PNG



_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
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