 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
gid2525 Expert Cheater
Reputation: 2
Joined: 21 Oct 2013 Posts: 103
|
Posted: Sun Mar 13, 2016 5:17 am Post subject: Help with a script ...Not working properly |
|
|
Ok so I have this script:
| Code: |
[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(exit)
newmem: //this is allocated memory, you have read,write,execute access
pushfd
pushad
push '9'
call GetAsyncKeyState
shr ax,#15
cmp ax,1
popad
jne originalcode
mov [esp+0C],(float)5000.00
originalcode:
popfd
movss xmm0,[esp+0C]
exit:
jmp returnhere
"fs2_open_3_7_2.exe"+195480:
jmp newmem
nop
returnhere:
[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem)
"fs2_open_3_7_2.exe"+195480:
movss xmm0,[esp+0C]
//Alt: db F3 0F 10 44 24 0C
|
I looked at this:
http://www.cheatengine.org/keypresstut.php
and a few other examples.
First of all anyone know the keycode for the "Tab" button? It says its VK_TAB = 9 here:
http://wiki.cheatengine.org/index.php?title=Virtual-Key_Code
But "9" just uses the "9" on the keyboard :/ and VK_TAB does nothing.
The script is for player speed in a spaceship. I want it to only work when the player HOLDS DOWN a certain key. When the key is not pressed and held down -NO Effect, and when the key is released back to normal with NO EFFECT. Well when I start the script my ships speed continually rises for some reason even when the key is not pressed. When I press the key and hold it down it does do this like I want:
| Code: |
mov [esp+0C],(float)5000.00
|
but does not go back to the normal speed when I release the key, speed just keeps going up like i did before key was pressed down. Only thing that gets the speed to stop rising and back to normal is when I disable the script. Can anyone help?
|
|
| Back to top |
|
 |
Zanzer I post too much
Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Sun Mar 13, 2016 12:59 pm Post subject: |
|
|
push 9
not
push '9'
Sounds like you'll also want to add a little trigger.
When you change the float value, also set a custom variable to 1.
Then instead of jumping to the original code, jump to a new label.
Inside this label, check if your custom variable is 1.
If it is, then you want to set [esp+0C] back to the standard float value.
And, of course, set your custom variable to 0.
|
|
| Back to top |
|
 |
gid2525 Expert Cheater
Reputation: 2
Joined: 21 Oct 2013 Posts: 103
|
Posted: Sun Mar 13, 2016 2:28 pm Post subject: |
|
|
| Zanzer wrote: | push 9
not
push '9'
Sounds like you'll also want to add a little trigger.
When you change the float value, also set a custom variable to 1.
Then instead of jumping to the original code, jump to a new label.
Inside this label, check if your custom variable is 1.
If it is, then you want to set [esp+0C] back to the standard float value.
And, of course, set your custom variable to 0. |
Would you happen to know how to write that in the script? I am just learning how and most of what I can do is copied together from other sources. It would be a huge learning help. Thanks!
|
|
| Back to top |
|
 |
++METHOS I post too much
Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Sun Mar 13, 2016 3:52 pm Post subject: |
|
|
Based on what you've written, it actually sounds like your code is getting executed no matter what. You can test this by setting a breakpoint on:
| Code: | | mov [esp+0C],(float)5000.00 |
If the target breaks even when you're not holding down your key, you'll know that your compare is failing.
A trigger is not needed because you are essentially providing the trigger with a conditional jump for key press and since disabling the script returns the speed to normal, no 'reset' is probably needed.
It sounds like you've not discovered the speed address, but rather, a thruster/booster address.
|
|
| 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
|
|