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 


Hotkey Increase Value By Multiplication?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
Gear2ndGandalf
Cheater
Reputation: 0

Joined: 22 Jan 2018
Posts: 36
Location: USA

PostPosted: Thu May 09, 2024 4:54 pm    Post subject: Hotkey Increase Value By Multiplication? Reply with quote

Is there a way I can increase the value by a multiplication of 2 via hotkeys?
I want to increase value from 1000 to 32000 like so:

1000 x2
2000 x2
4000 x2
8000 x2
16000 x2
32000 x2

Decrease as such:

32000 /2
16000 /2
8000 /2
4000 /2
2000 /2
1000 /2

Anything above a speed of 4000 is only good for guns and makes melee weapons useless. It would be tedious to constantly hotkey press up 32 times by increments of 1000 to 32000.

32000 is rapid fire for guns and any higher is pointless.

4000 is about the fastest speed for melee weapons, but I want to be able to go to 1000-2000 for those who may want it fast but not too fast.

Don't want to deal with 5000-31000 as guns are firing decently fast but not at full rapid fire (32000).

I'm trying to use only 2 hotkeys. ALT + Numeric + and ALT + Numeric -

Please view attachment for AA Script.

Code:
[ENABLE]

aobscanmodule(actionAnimation,sh3.exe,66 89 91 D4 01 00 00)
alloc(newmem,$1000)
alloc(aaSpeed,$32,actionAnimation)

label(reset)
label(reset2)
label(code)
label(return)

aaSpeed:
  dq (int)1000

newmem:
  cmp [aaSpeed],(int)32000
  jg reset
  cmp [aaSpeed],(int)1000
  jl reset2
  mov dx,[aaSpeed]
  mov [ecx+000001D4],dx
  jmp return

reset:
  mov [aaSpeed],(int)1000
  jmp return

reset2:
  mov [aaSpeed],(int)32000
  jmp return

code:
  //mov [ecx+000001D4],dx
  //jmp return

actionAnimation:
  jmp newmem
  nop 2
return:
registersymbol(actionAnimation)
registersymbol(aaSpeed)



Attack_Speed.PNG
 Description:
Attack Animation Speed Script
 Filesize:  47.79 KB
 Viewed:  1465 Time(s)

Attack_Speed.PNG


Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4711

PostPosted: Thu May 09, 2024 6:13 pm    Post subject: This post has 1 review(s) Reply with quote

"set value to", then use the value string "value*2" and "value/2" (no quotes)
Note that this doesn't have a limit and you can get to 0. For limits, use the Lua functions math.max and math.min. e.g. "math.max(1000,math.min(32000,value*2))"

That AA script - you're allocating 0x32 (50) bytes for aaSpeed, initializing it with an 8-byte value (dq 0), accessing it as a 4-byte value (cmp [aaSpeed],... / mov [aaSpeed],...), and letting the game treat it as a 2-byte value (mov dx,[aaSpeed])

You're also not executing the original code if "reset" or "reset2" is run.

alloc doesn't need the third parameter in 32-bit processes
Code:
[ENABLE]
aobscanmodule(actionAnimation,sh3.exe,66 89 91 D4 01 00 00)
alloc(newmem,2048)
alloc(aaSpeed,2)

label(tooLow)
label(tooHigh)
label(code)
label(return)

aaSpeed:
  dw #1000

newmem:
  movzx edx,word ptr[aaSpeed]
  cmp edx,#1000
  jb tooLow
  cmp edx,#32000
  ja tooHigh
  mov [ecx+000001D4],dx
  jmp return

tooLow:
  mov dx,#1000
  jmp code
tooHigh:
  mov dx,#32000
code:
  mov [aaSpeed],dx
  mov [ecx+000001D4],dx
  jmp return

actionAnimation:
  jmp newmem
  nop 2
return:

registersymbol(actionAnimation)
registersymbol(aaSpeed)

...

_________________
I don't know where I'm going, but I'll figure it out when I get there.


Last edited by ParkourPenguin on Fri May 10, 2024 1:18 am; edited 1 time in total
Back to top
View user's profile Send private message
Gear2ndGandalf
Cheater
Reputation: 0

Joined: 22 Jan 2018
Posts: 36
Location: USA

PostPosted: Thu May 09, 2024 6:36 pm    Post subject: Reply with quote

Works perfectly! Thanks for the insightful reply. I'm always messing up the memory allocation. I will work to correct this.


The below code works for me perfectly. alloc(aaSpeed,2) wasn't working for me and when using "Find out what addresses this instruction accesses" cheat engine seems to default to the variable being 4 bytes (dd) double word.
Code:
[ENABLE]

aobscanmodule(actionAnimation,sh3.exe,66 89 91 D4 01 00 00)
alloc(newmem,2048)
alloc(aaSpeed,4)

label(tooLow)
label(tooHigh)
label(code)
label(return)

aaSpeed:
  dd #1000

newmem:
  cmp dword ptr [aaSpeed],#1000
  jb tooLow
  cmp dword ptr [aaSpeed],#32000
  ja tooHigh
  mov dx,[aaSpeed]
  mov [ecx+000001D4],dx
  jmp return

tooLow:
  mov dword ptr [aaSpeed],#1000
  jmp return

tooHigh:
  mov dword ptr [aaSpeed],#32000
  jmp return

code:
  //mov [ecx+000001D4],dx
  //jmp return

actionAnimation:
  jmp newmem
  nop 2
return:
registersymbol(actionAnimation)
registersymbol(aaSpeed)

Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4711

PostPosted: Fri May 10, 2024 1:18 am    Post subject: Reply with quote

My bad, `movzx edx,[address]` defaults to a 1-byte access. That should've been `movzx edx,word ptr[aaSpeed]`

There was nothing wrong with what you were doing with the variable aaSpeed in your first post. It was just really confusing trying to figure out what type it was at a glance.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
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 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