Page 1 of 1

Help rewriting this code

Posted: 14 Aug 2022, 07:34
by Raiden96
While this piece of code does the the job it's supposed to do can't help but wonder if there isn't a better way of writing this code. I'm not sure it's 100% correct.

Code: Select all

~RButton Up::
SetMouseDelay, 10
Click, 4
Return
Thanks!

Re: Help rewriting this code

Posted: 14 Aug 2022, 08:25
by mikeyww
It looks OK to me.

Re: Help rewriting this code

Posted: 14 Aug 2022, 09:05
by Raiden96
@mikeyww Alright i guess. Might wanna tweak the delay a bit since 10ms since a bit too low. Could be the game's limitations as well since it does something funny that i can't figure out. Thanks!

Re: Help rewriting this code  Topic is solved

Posted: 14 Aug 2022, 09:10
by mikeyww
Could try:

Code: Select all

~RButton Up::
SetKeyDelay, 25, 25
Send {LButton 4}
Return

Re: Help rewriting this code

Posted: 14 Aug 2022, 14:16
by Raiden96
mikeyww wrote:
14 Aug 2022, 09:10
Could try:

Code: Select all

~RButton Up::
SetKeyDelay, 25, 25
Send {LButton 4}
Return
Thanks! Looks good. The issue seems to be related to the game itself. Maybe i can find a workaround. Regardless, thanks a lot for your help!

Re: Help rewriting this code

Posted: 14 Aug 2022, 14:41
by mikeyww
You are welcome. Tips: viewtopic.php?f=7&t=11084

Re: Help rewriting this code

Posted: 15 Aug 2022, 08:24
by Raiden96
@mikeyww Since we're still on the topic do you think you can lend me a hand on this?

Code: Select all

Mbutton::
SetKeyDelay, 10, 10
Send {W down}
Send {Space down} 
Send RButton
Send {Space up}
Send {W up}
Return
To perform a combo i have to press W then Space then right click in quick succession. Technically speaking as far as ahk is concerned, from what i noticed judging on how the keys are pressed physically, i press W and hold it then quickly press space and hold it then click right click immediately. I could time this combo as taking up to 800ms, no kidding. This is the code i've tried, but it doesn't seem to work. I ain't gonna lie, it's not easy to translate keypresses into code. Maybe you can spot what i'm doing wrong. Thanks!

Re: Help rewriting this code

Posted: 15 Aug 2022, 08:27
by mikeyww
Try:

Code: Select all

Send {RButton}
Explained: Key names

Re: Help rewriting this code

Posted: 15 Aug 2022, 08:53
by Raiden96
@mikeyww Thanks a lot! That did it. Can't believe i forgot this simple detail. Btw can i use ~ in front of the activation key because i noticed that if i hold down the activation key it kinda bugs out the move. I hope you know what i'm saying.

Re: Help rewriting this code

Posted: 15 Aug 2022, 10:25
by mikeyww
Tilde will unblock the key's native function, in case that is what you need. https://www.autohotkey.com/docs/Hotkeys.htm#Tilde

Re: Help rewriting this code

Posted: 16 Aug 2022, 09:23
by Raiden96
Thanks! I suppose i got what i'm looking for. I'll keep playing with it. Maybe i can find new ways to improve it. Thanks again!