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 make a script to Enable it if the HotKey is Relased

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

Joined: 03 Mar 2024
Posts: 1
Location: Spain

PostPosted: Sun Mar 03, 2024 7:31 am    Post subject: How to make a script to Enable it if the HotKey is Relased Reply with quote

Hey i wanted to know how to make something that if i Release a Hotkey that i'm pressing at the moment turns on a Script.

I want this because i got 2 scripts that i want them to do this:

· One script enables itself when i press the hotkey and when i release it is deactivates the script.

· Another script that disables itself when i press the same hotkey and when i release it is activates the script back.

any clue on how to do that?
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 31

Joined: 16 Feb 2017
Posts: 1247

PostPosted: Sun Mar 03, 2024 9:14 am    Post subject: Reply with quote

You can use this separately or for two scripts. If you are going to use it separately, edit the following controls:

script active 1;
dwnTim1 : Timer name..
mem1 : Control name ..
al.getMemoryRecordByDescription("Hack2") : Desc name ..
isKeyPressed(VK_F8) : key ..

script active 2;
dwnTim2
mem2
al.getMemoryRecordByDescription("Hack2") : Desc name ..
isKeyPressed(VK_F8) : key ..

Code:
{$lua}
if syntaxcheck then return end
if dwnTim1 then dwnTim1.Destroy() dwnTim1=nil end

[ENABLE]

al = getAddressList()
dwnTim1 = createTimer()
dwnTim1.Interval = 200
  dwnTim1.OnTimer = function()
   mem1 = al.getMemoryRecordByDescription("Hack2")
    if isKeyPressed(VK_F8) then
      mem1.Active = true
    else
      mem1.Active = false
    end
  end
dwnTim1.Enabled=true

[DISABLE]


Or test multiple key hits in a single code;

Edit the script names you want to activate.
Edit the keys you want to use.
Default is "F8" and "F9".

Code:
{$lua}
if syntaxcheck then return end
if dwnTim1 then dwnTim1.Destroy() dwnTim1=nil end

[ENABLE]

al = getAddressList()
dwnTim1 = createTimer()
dwnTim1.Interval = 200
  dwnTim1.OnTimer = function()
   mem1 = al.getMemoryRecordByDescription("Hack1") -- your script name?
    if isKeyPressed(VK_F8) then
      mem1.Active = true
    else
      mem1.Active = false
    end

   mem2 = al.getMemoryRecordByDescription("Hack2")
    if isKeyPressed(VK_F9) then
      mem2.Active = true
    else
      mem2.Active = false
    end
  end
dwnTim1.Enabled=true

[DISABLE]

_________________
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 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