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 


HELP FOR CODE.

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

Joined: 21 May 2023
Posts: 0

PostPosted: Sun May 21, 2023 6:14 pm    Post subject: HELP FOR CODE. Reply with quote

Hi can anyone help me with the code,. Im a newbie.

I want a checkbox that when you click on it, hotkeys will be activated. thank you!!!
Back to top
View user's profile Send private message
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1055
Location: 0x90

PostPosted: Mon May 22, 2023 2:25 am    Post subject: Reply with quote

This goes against the reason for having the hotkey in the first place. The information provided is also quite vague. The hotkey for an entry within the Cheat Engine address list? A checkbox is on a trainer or within the Cheat Engine address list? Need more information.
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 32

Joined: 16 Feb 2017
Posts: 1251

PostPosted: Mon May 22, 2023 11:27 am    Post subject: Reply with quote

I hope I did not misunderstand the problem.

Oh I don't have a chance to try it, I'm writing from the phone note, can you try it?

What it does:
I left two examples. Checkbox and button.
Returns true on first click and assigns hotkey.
The shortcut option dies on the second click.

Code:
if f1 then f1.Destroy() end

f1=createForm()
chk1=createCheckbox(f1)
chk1.caption="F8 Key Off"
btn1=createButton(f1)
btn1.Top=55
btn1.caption="F9 Key Off"

function hotkeyFunc1()
sleep(250)
print("Hello Lua!")
end
function hotkeyFunc2()
sleep(250)
print("Hello CE!")
end

chk1.OnChange=function(sender)
  if sender.checked==true then
   if key1 then key1.Destroy() key1=nil end
   key1=createHotkey(hotkeyFunc1,VK_F8)
   chk1.caption="F8 Key ON"
  else
   if key1 then key1.Destroy() key1=nil end
   chk1.caption="F8 Key Off"
  end
end

local key2State = 0

btn1.OnClick=function()
 if key2State==0 then
  if key2 then key2.Destroy() key2=nil end
  key2=createHotkey(hotkeyFunc2,VK_F9)
  key2State = 1
  btn1.caption="F9 Key ON"
 else
  if key2 then key2.Destroy() key2=nil end
  key2State = 0
  btn1.caption="F9 Key Off"
 end
end

_________________
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