Help rewriting this code Topic is solved

Ask gaming related questions (AHK v1.1 and older)
Raiden96
Posts: 38
Joined: 23 Oct 2021, 07:03

Help rewriting this code

Post by Raiden96 » 14 Aug 2022, 07:34

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!

User avatar
mikeyww
Posts: 26602
Joined: 09 Sep 2014, 18:38

Re: Help rewriting this code

Post by mikeyww » 14 Aug 2022, 08:25

It looks OK to me.

Raiden96
Posts: 38
Joined: 23 Oct 2021, 07:03

Re: Help rewriting this code

Post by Raiden96 » 14 Aug 2022, 09:05

@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!

User avatar
mikeyww
Posts: 26602
Joined: 09 Sep 2014, 18:38

Re: Help rewriting this code  Topic is solved

Post by mikeyww » 14 Aug 2022, 09:10

Could try:

Code: Select all

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

Raiden96
Posts: 38
Joined: 23 Oct 2021, 07:03

Re: Help rewriting this code

Post by Raiden96 » 14 Aug 2022, 14:16

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!

User avatar
mikeyww
Posts: 26602
Joined: 09 Sep 2014, 18:38

Re: Help rewriting this code

Post by mikeyww » 14 Aug 2022, 14:41

You are welcome. Tips: viewtopic.php?f=7&t=11084

Raiden96
Posts: 38
Joined: 23 Oct 2021, 07:03

Re: Help rewriting this code

Post by Raiden96 » 15 Aug 2022, 08:24

@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!

User avatar
mikeyww
Posts: 26602
Joined: 09 Sep 2014, 18:38

Re: Help rewriting this code

Post by mikeyww » 15 Aug 2022, 08:27

Try:

Code: Select all

Send {RButton}
Explained: Key names

Raiden96
Posts: 38
Joined: 23 Oct 2021, 07:03

Re: Help rewriting this code

Post by Raiden96 » 15 Aug 2022, 08:53

@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.

User avatar
mikeyww
Posts: 26602
Joined: 09 Sep 2014, 18:38

Re: Help rewriting this code

Post by mikeyww » 15 Aug 2022, 10:25

Tilde will unblock the key's native function, in case that is what you need. https://www.autohotkey.com/docs/Hotkeys.htm#Tilde

Raiden96
Posts: 38
Joined: 23 Oct 2021, 07:03

Re: Help rewriting this code

Post by Raiden96 » 16 Aug 2022, 09:23

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!

Post Reply

Return to “Gaming Help (v1)”