 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
vovasivy Cheater
Reputation: 0
Joined: 09 Jun 2021 Posts: 43
|
Posted: Tue Nov 16, 2021 12:34 am Post subject: {$luacode} ??? |
|
|
Why the "doKeyPress(0x1B)" function does not work.
Function "sleep()" and "print()" work.
How to make it work.
I will be grateful for your help. | Code: | define(address,"witcher3.exe"+150ECEA)
define(bytes,42 8B 0C 08 8B 07)
[ENABLE]
assert(address,bytes)
alloc(newmem,$1000,"witcher3.exe"+150ECEA)
label(code)
label(return)
label(flag_menu)
registersymbol(flag_menu)
newmem:
cmp [flag_menu],0
je code
mov [flag_menu],0
{$luacode}
doKeyPress(0x1B) -- The "Esc" key does not turn on.
--print("Hello") -- It works.
{$asm}
{$luacode}
sleep(10000) -- It works.
{$asm}
{
cmp r15w,00D8
jne code
mov [rax+r9],#3
}
code:
mov ecx,[rax+r9]
mov eax,[rdi]
jmp return
align 4,CC
flag_menu:
dd 00
address:
jmp newmem
nop
return:
[DISABLE]
address:
db bytes
// mov ecx,[rax+r9]
// mov eax,[rdi]
unregistersymbol(flag_menu)
dealloc(newmem) |
The second question.
Are the lower 8 bits in 64 bit registers not supported?
| Code: | cmp r15w,00D8
jne code
|
Works!!!
| Code: | cmp r15b,D8
jne code
|
Returns an error!!!
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25806 Location: The netherlands
|
Posted: Tue Nov 16, 2021 3:39 am Post subject: |
|
|
It depends on where you do your code hooking
doKeyPress does the following:
Press down
sleep(110)
Release key
If your code is inside the main game thread, and the game only check if the key is currently down instead of have been pressed (e.g it only checks the least significant bit) then when it checks if the key is down it won't see it, as it's up already
You can try keyDown(0x1b) and the next time the code is executed release the key
it's
_________________
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 |
|
 |
vovasivy Cheater
Reputation: 0
Joined: 09 Jun 2021 Posts: 43
|
Posted: Tue Nov 16, 2021 5:54 am Post subject: |
|
|
Thanks!
| Code: |
cmp r15l,D8 - Works
|
Unfortunately keyDown, keyUp
| Code: | {$luacode}
keyDown(0x1B)
sleep(110)
keyUp(0x1B)
{$asm}
|
It doesn't work!!![/code]
| Code: |
define(address,"witcher3.exe"+150ECEA)
define(bytes,42 8B 0C 08 8B 07)
[ENABLE]
assert(address,bytes)
alloc(newmem,$1000,"witcher3.exe"+150ECEA)
label(code)
label(return)
label(flag_menu)
registersymbol(flag_menu)
newmem:
cmp [flag_menu],0
je code
mov [flag_menu],0
{$luacode}
keyDown(0x1B)
sleep(110)
keyUp(0x1B)
{$asm}
cmp r15l,D8
jne code
mov [rax+r9],#3
code:
mov ecx,[rax+r9]
mov eax,[rdi]
jmp return
align 4,CC
flag_menu:
dd 00
address:
jmp newmem
nop
return:
[DISABLE]
address:
db bytes
// mov ecx,[rax+r9]
// mov eax,[rdi]
unregistersymbol(flag_menu)
dealloc(newmem)
|
I will explain the task:
I need to go to the menu (using the "Esc" key) while in full-screen 3D game mode.
Then move through the menu tree to a certain setting parameter, switch it, and back by pressing the "Esc" key to return to the game.
I made a simple script and it works
| Code: |
[ENABLE]
{$Lua}
doKeyPress(0x1B)
sleep(200)
doKeyPress(VK_S)
sleep(50)
doKeyPress(VK_S)
sleep(50)
doKeyPress(VK_S)
sleep(50)
doKeyPress(0x0D)
sleep(200)
doKeyPress(VK_S)
sleep(50)
doKeyPress(VK_S)
sleep(50)
doKeyPress(VK_S)
sleep(50)
doKeyPress(VK_S)
sleep(50)
doKeyPress(VK_S)
sleep(50)
doKeyPress(VK_S)
sleep(50)
doKeyPress(0x0D)
sleep(200)
doKeyPress(0x0D)
sleep(300)
doKeyPress(VK_S)
sleep(50)
doKeyPress(0x0D)
sleep(100)
doKeyPress(0x0D)
sleep(100)
doKeyPress(0x1B)
sleep(100)
doKeyPress(0x1B)
sleep(100)
doKeyPress(0x1B)
sleep(100)
doKeyPress(0x1B)
sleep(100)
doKeyPress(0x1B)
{$Asm}
[DISABLE]
|
And such automation would probably be enough for me.
However, even with a small, random push during the execution of the script, the cursor position changes
and I get to another menu item.
So I found an instruction that sets the cursor to a specific menu item, and then I got stuck.
Maybe someone will help.
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25806 Location: The netherlands
|
Posted: Tue Nov 16, 2021 6:08 am Post subject: |
|
|
of course it doesn't work. As I said, the key is up at the time the game is checking if the key is down.
You need to keep the key down until the game has checked it, and once it has been processed, you can move the key up
But if you don't want key perfect precision then use a thread
| Code: |
{$luacode}
createThread(function()
doKeyPress(0x1B)
end)
{$asm}
|
_________________
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 |
|
 |
|
|
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
|
|