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 edit script ?

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

Joined: 30 Nov 2023
Posts: 1

PostPosted: Fri Dec 01, 2023 9:10 am    Post subject: how to edit script ? Reply with quote

Hi, i just want to change the button "F" on keyboard to Square on Ps4 controller, i am using Ds4windows:

{$lua}
local alist = getAddressList()
if alist.Count >= 1 then
local req = alist.getMemoryRecordByDescription("ACTIVATE")
if req ~= nil then
req.Active = true
end
end

isAPRunning = false
function APAutoF(thread)
while isAPRunning do
if IsGenshinForeground() then
if readInteger("check_auto_pickup") ~= 0 then
keyDown(VK_F)
sleep(125)
keyUp(VK_F)
sleep(112)
end
end
if process == nil or readInteger(process) == 0 then
isAPRunning = false
end
end
thread.terminate()
end
function SetAPAutoF(bool)
if not bool then
isAPRunning = false
else
if not isAPRunning then
isAPRunning = true
createThread(APAutoF)
end
end
end
{$asm}
[ENABLE]
aobscanmodule(aob_auto_pickup,UserAssembly.dll,8B 40 ? FF C8 89 83 ? ? 00 00 48 83 C4 ? 5B C3)
registersymbol(aob_auto_pickup og_auto_pickup check_auto_pickup)
alloc(newmem_auto_pickup,1024,aob_auto_pickup)
alloc(og_auto_pickup,Cool
alloc(check_auto_pickup,4)
label(return_auto_pickup quit_auto_pickup)

newmem_auto_pickup:
jmp quit_auto_pickup

quit_auto_pickup:
mov eax,[rax+18]
mov [check_auto_pickup],eax
dec eax
jmp return_auto_pickup

og_auto_pickup:
readmem(aob_auto_pickup,5)

check_auto_pickup:
dd #0

aob_auto_pickup:
jmp newmem_auto_pickup
return_auto_pickup:
{$lua}
SetAPAutoF(true)
{$asm}

[DISABLE]
{$lua}
SetAPAutoF(false)
{$asm}
aob_auto_pickup:
readmem(og_auto_pickup,5)

unregistersymbol(*)
dealloc(*)

{
// ORIGINAL CODE - INJECTION POINT: UserAssembly.dll+5E451DE

UserAssembly.dll+5E45191: 74 2D - je UserAssembly.dll+5E451C0
UserAssembly.dll+5E45193: B9 48 2C 00 00 - mov ecx,00002C48
UserAssembly.dll+5E45198: E8 73 40 3D FE - call UserAssembly.dll+4219210
UserAssembly.dll+5E4519D: 84 C0 - test al,al
UserAssembly.dll+5E4519F: 74 1F - je UserAssembly.dll+5E451C0
UserAssembly.dll+5E451A1: B9 48 2C 00 00 - mov ecx,00002C48
UserAssembly.dll+5E451A6: E8 D5 3F 3D FE - call UserAssembly.dll+4219180
UserAssembly.dll+5E451AB: 48 85 C0 - test rax,rax
UserAssembly.dll+5E451AE: 74 4F - je UserAssembly.dll+5E451FF
UserAssembly.dll+5E451B0: 48 8B D3 - mov rdx,rbx
UserAssembly.dll+5E451B3: 48 8B C8 - mov rcx,rax
UserAssembly.dll+5E451B6: 48 83 C4 20 - add rsp,20
UserAssembly.dll+5E451BA: 5B - pop rbx
UserAssembly.dll+5E451BB: E9 D0 BA 71 01 - jmp UserAssembly.dll+7560C90
UserAssembly.dll+5E451C0: 48 8B CB - mov rcx,rbx
UserAssembly.dll+5E451C3: E8 88 E9 FF FF - call UserAssembly.dll+5E43B50
UserAssembly.dll+5E451C8: 48 8B 83 60 01 00 00 - mov rax,[rbx+00000160]
UserAssembly.dll+5E451CF: C7 83 88 01 00 00 02 00 00 00 - mov [rbx+00000188],00000002
UserAssembly.dll+5E451D9: 48 85 C0 - test rax,rax
UserAssembly.dll+5E451DC: 74 27 - je UserAssembly.dll+5E45205
// ---------- INJECTING HERE ----------
UserAssembly.dll+5E451DE: 8B 40 18 - mov eax,[rax+18]
// ---------- DONE INJECTING ----------
UserAssembly.dll+5E451E1: FF C8 - dec eax
UserAssembly.dll+5E451E3: 89 83 78 01 00 00 - mov [rbx+00000178],eax
UserAssembly.dll+5E451E9: 48 83 C4 20 - add rsp,20
UserAssembly.dll+5E451ED: 5B - pop rbx
UserAssembly.dll+5E451EE: C3 - ret
UserAssembly.dll+5E451EF: E8 0C 6C EE FC - call UserAssembly.dll+2D2BE00
UserAssembly.dll+5E451F4: 48 8B C8 - mov rcx,rax
UserAssembly.dll+5E451F7: 33 D2 - xor edx,edx
UserAssembly.dll+5E451F9: E8 E2 6D EE FC - call UserAssembly.dll+2D2BFE0
UserAssembly.dll+5E451FE: CC - int 3
UserAssembly.dll+5E451FF: E8 0C 6E EE FC - call UserAssembly.dll+2D2C010
UserAssembly.dll+5E45204: CC - int 3
UserAssembly.dll+5E45205: E8 06 6E EE FC - call UserAssembly.dll+2D2C010
UserAssembly.dll+5E4520A: CC - int 3
UserAssembly.dll+5E4520B: CC - int 3
UserAssembly.dll+5E4520C: CC - int 3
UserAssembly.dll+5E4520D: CC - int 3
UserAssembly.dll+5E4520E: CC - int 3
UserAssembly.dll+5E4520F: CC - int 3
UserAssembly.dll+5E45210: 40 53 - push rbx
}
Back to top
View user's profile Send private message
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