Snovit How do I cheat?
  Reputation: 0
  Joined: 18 Jun 2024 Posts: 1
 
  | 
		
			
				 Posted: Tue Jun 18, 2024 4:02 am    Post subject: don't do anything when hotkey is held down | 
				       | 
			 
			
				
  | 
			 
			
				So I'd like to make so the script I've been editing doesn't activate when I hold down spacebar, but activates whenever I press spacebar. Do keep in mind that I need to be able to press the hotkey to activate the script sometimes straight away after activating it, so no common wait function would be able to work, I'm guessing. 
 
 
 
          	  | Code: | 	 		  [ENABLE]
 
AOBScanModule(WorldChrManFinder,eldenring.exe,48 8B FA 0F 11 41 70 48 8B 05)
 
AOBScanModule(OnAttack,eldenring.exe,45 0F B6 CE 4C 8B C3 48 8B D6 48 8B CF E8)
 
alloc(OnAttackHook,4096)
 
label(goback)
 
label(ReflectAttack)
 
registersymbol(ReflectAttack)
 
OnAttackHook:
 
mov rdx,WorldChrManFinder+A
 
mov eax,[rdx]
 
cdqe
 
mov rdx,[rdx+rax+4]
 
cmp rdx,10000
 
jl goback
 
mov rdx,[rdx+1E508]
 
cmp rdx,[rdi+8]
 
jne goback
 
cmp byte ptr[ReflectAttack],0
 
je @f
 
mov rdx,OnAttack+E
 
mov eax,[rdx]
 
cdqe
 
lea rax,[rdx+rax+4]
 
movzx r9d,r14l
 
mov r8,rbx
 
mov rdx,rsi
 
mov r14,[rdi+8]
 
mov [rdi+8],rdx
 
mov rcx,rdi
 
call rax
 
mov [rdi+8],r14
 
@@:
 
jmp OnAttack+12
 
goback:
 
movzx r9d,r14l
 
mov r8,rbx
 
mov rdx,rsi
 
mov rcx,rdi
 
jmp OnAttack+D
 
ReflectAttack:
 
db 0
 
OnAttack:
 
mov rax,OnAttackHook
 
jmp rax
 
 
{$lua}
 
if syntaxcheck then return end
 
-- CE 6.7 provides the memory record as memrec
 
-- if the user isn't running CE >= 6.7 or the name changes at some point
 
-- this is an alternative, though it depends on the user not changing the name
 
-- using the ID is a little more reliable but you have to open the CT to find it
 
-- or use the extra memrec info lua extension found on the CE forums
 
local memrec = memrec or getAddressList().getMemoryRecordByDescription("Script Name")
 
 
local timer = createTimer()
 
timer.Interval = 5 * 1000 -- 1000 milliseconds per second
 
timer.OnTimer = function(theTimerCallingThisFunction)
 
  memrec.Active = false -- deactivate the script
 
  timer.destroy() -- destroy the timer so it doesn't keep running
 
end
 
[DISABLE]
 
OnAttack:
 
db 45 0F B6 CE 4C 8B C3 48 8B D6 48 8B CF E8
 
unregistersymbol(ReflectAttack) | 	  
 | 
			 
		  | 
	
	
		ParkourPenguin I post too much
  Reputation: 152
  Joined: 06 Jul 2014 Posts: 4706
 
  | 
		
			
				 Posted: Tue Jun 18, 2024 11:45 am    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				 	  | Code: | 	 		  function onKeyRelease(f, key)
 
  local wasPressed = false
 
 
  local t = createTimer()
 
  t.Interval = 100
 
  t.OnTimer = function(t)
 
    if isKeyPressed(key) then
 
      wasPressed = true
 
    elseif wasPressed then
 
      wasPressed = false
 
      f(t)
 
    end
 
  end
 
 
  return t
 
end
 
 
onKeyRelease(function(t) print'space released!'; t.destroy() end, VK_SPACE) | 	  
 _________________
 I don't know where I'm going, but I'll figure it out when I get there.  | 
			 
		  |