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 


Hold button to active script

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
!BEWARE!
!BEWARE! Deletes post on answer
Reputation: 0

Joined: 26 Jun 2013
Posts: 56
Location: !BEWARE!

PostPosted: Fri Jan 20, 2023 4:00 pm    Post subject: Hold button to active script Reply with quote

Hello
I wanna update this script to work like:
Holding key "Lctrl" - script enabled
Relesing button "Lctrl" - script disabled

Code:
[ENABLE]
alloc(collision,2048,"App.exe"+58735C)
registersymbol(collision)
label(returnhere)

collision:
mov eax,#0 
mov [rcx+34],eax
ret
int 3
jmp returnhere

"App.exe"+58735C:
jmp collision
returnhere:

[DISABLE]
dealloc(*)
unregistersymbol(*)
"App.exe"+58735C:
mov [rcx+34],eax
ret
int 3

_________________
!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
AylinCE
Grandmaster Cheater Supreme
Reputation: 31

Joined: 16 Feb 2017
Posts: 1234

PostPosted: Fri Jan 20, 2023 5:35 pm    Post subject: Reply with quote

Wrap your code in a script in the address list and edit the name of the script in the code below and activate the lua code (Lua script: Cheat Table) and test it.
The default hotkey is "F8". You can edit this too.
Maybe he won't be able to react in the first print.
But it is a (Tested) code that reads the "down" or "up" status of the key correctly.

Your edit script name .. (Default "ActivateItFirst")

Code:
function activeKey()
 if isKeyPressed(VK_F8) then
  getAddressList().getMemoryRecordByDescription("ActivateItFirst").Active=true
 else
  getAddressList().getMemoryRecordByDescription("ActivateItFirst").Active=false
 end
end

if actKey1 then actKey1.Destroy() actKey1=nil end

actKey1=createHotkey(activeKey, VK_F8)

_________________
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
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25262
Location: The netherlands

PostPosted: Sat Jan 21, 2023 1:28 am    Post subject: Reply with quote

rightclick the record, choose set hotkeys
create hotkey
set the hotkey to ctrl
leave it at "toggle script"
and tick "deactivate on release"

now press ok and the entry will get enabled when ctrl is down and deactivate on release

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
!BEWARE!
!BEWARE! Deletes post on answer
Reputation: 0

Joined: 26 Jun 2013
Posts: 56
Location: !BEWARE!

PostPosted: Sat Jan 21, 2023 6:05 am    Post subject: Reply with quote

Thanks Aylin, i'll check this.
Dark Byte I already using it as toggle but nowhere saw "deactivate on release", where is it exactly?

_________________
!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
AylinCE
Grandmaster Cheater Supreme
Reputation: 31

Joined: 16 Feb 2017
Posts: 1234

PostPosted: Sat Jan 21, 2023 7:33 am    Post subject: Reply with quote

Assigning two hotkeys for such an option is risky.
It will be difficult to keep the keys pressed at the same time or optimize the release.
It will fail most of the time. Use single hotkey.

_________________
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
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25262
Location: The netherlands

PostPosted: Sat Jan 21, 2023 10:34 am    Post subject: Reply with quote

!BEWARE! wrote:
Thanks Aylin, i'll check this.
Dark Byte I already using it as toggle but nowhere saw "deactivate on release", where is it exactly?
ce 7.4 has it i think
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
!BEWARE!
!BEWARE! Deletes post on answer
Reputation: 0

Joined: 26 Jun 2013
Posts: 56
Location: !BEWARE!

PostPosted: Sun Jan 22, 2023 4:04 am    Post subject: Reply with quote

Aylin I am using single hotkey to on/off script
Dark Byte I am using latest version of CE.

_________________
!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!!BEWARE!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
AylinCE
Grandmaster Cheater Supreme
Reputation: 31

Joined: 16 Feb 2017
Posts: 1234

PostPosted: Sun Jan 22, 2023 9:41 am    Post subject: Reply with quote

https://forum.cheatengine.org/viewtopic.php?p=5782661#5782661

Did you try this?
And still the problem is not solved?

_________________
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