help for a Script Topic is solved

Ask gaming related questions (AHK v1.1 and older)
oNx1g
Posts: 3
Joined: 24 May 2018, 11:13

help for a Script

Post by oNx1g » 17 May 2022, 17:55

Hello all,

I am looking for a script that executes the following:

As soon as I press/hold the key "W" the key "E" should be executed with a very short delay like 2ms or so, but not permanently.

like: "W" pressedheld, delay "E", stop, delay, "E", stop, delay, "E " ...... and go on... as long as I hold W, the E should go on like this

I am unfortunately not found on the net would be great if someone could help me. Thanks :)



Edit:

I will try to explain it differently.

Aslong I press "W" and hold it down without releasing it, the key "E" should be activated aswell but with a short delay, but not just one time. The letter "E" should be going on. like: "W" -> short delay -> "E" -> short delay -> "E" -> short delay "E"

when I would use this on a wordpad it would look like WEEEEEEEEEEEEEE.

it would be even better when the Key "XButton1" would activated that sequence.

so: XButton1 -> W -> delay -> E -> delay -> E -> dealy -> E ...... that sequence should be going on aslong i hold the key XButton1
Last edited by oNx1g on 18 May 2022, 05:35, edited 1 time in total.

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

Re: help for a Script

Post by mikeyww » 17 May 2022, 19:21

I read this a few times and do not understand it. I would work on greater precision and detail in your description of each step. Many of the words are currently undefined in terms of meaning or magnitudes.

oNx1g
Posts: 3
Joined: 24 May 2018, 11:13

Re: help for a Script

Post by oNx1g » 18 May 2022, 05:57

This Script here work but i have to click everytime "XButton1" and let it go. I would like to just holding down "XButton1" and it should going on aslong im holding "XButton1"

Code: Select all

;The key (or mouse button) you press to activate the script. For a list of supported "keys" and combinations, see https://autohotkey.com/docs/Hotkeys.htm
;XButton1 = "Back"-Button on my mouse. For a complete list of special keys, see https://autohotkey.com/docs/KeyList.htm
XButton1::
{
	;Initialize random delays between 57 and 114 ms (arbitrary values, may be changed)
	random, delay2, 57, 114
	random, delay3, 57, 114
	random, delay4, 57, 114
	random, delay5, 57, 114

	;send, W ;simulates the keypress of the W button. If you use another button, change it!

	;sleep, %delay2%
	send, E ;simulates the keypress of the E button. If you use another button, change it!

	sleep, %delay3%
	send, W ;simulates the keypress of the W button. If you use another button, change it!

	sleep, %delay4%
	send, E ;simulates the keypress of the E button. If you use another button, change it!

	sleep, %delay5%
	send, W ;simulates the keypress of the W button. If you use another button, change it!
}
return
[Mod edit: [code][/code] tags added.]

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

Re: help for a Script  Topic is solved

Post by mikeyww » 18 May 2022, 06:04

Code: Select all

XButton1::
While GetKeyState("XButton1", "P") {
 Send x        ; Example of some code
 Sleep, 200
 ; More code here
 ; More code here
}
Return

Post Reply

Return to “Gaming Help (v1)”