Script for switch holding a and d

Ask gaming related questions
rambo546677
Posts: 2
Joined: 13 Oct 2017, 03:34

Script for switch holding a and d

Post by rambo546677 » 13 Oct 2017, 03:55

Ok hope u Guys can help me and understand waht i wanna do.
Basicly i want an Script that is holding the button a for 1sec, then let go this key and hold the button d instead for 1sec. And repeat this over and over again.
Im really new to AHK and it would be amazing if u Guys have any tips for me.
User avatar
elModo7
Posts: 36
Joined: 01 Sep 2017, 02:38

Re: Script for switch holding a and d

Post by elModo7 » 13 Oct 2017, 07:13

Let's see:

Code: Select all

#MaxThreadsPerHotkey 2

*^q::

toggle := !Toggle
loop
{
If toggle 
{
Send {a down}
sleep, 1000
Send {a up}
Send {d down}
sleep, 1000
Send {d up}
}
else
	break
}
return
Activate / Deactivate it with "ctrl + q".
Just to fill my curiosity... Are you here for The Evil Within 2?
:beer:
User avatar
Reloaded
Posts: 267
Joined: 25 Aug 2017, 08:48

Re: Script for switch holding a and d

Post by Reloaded » 14 Oct 2017, 13:51

elModo7 wrote:Let's see:

Code: Select all

#MaxThreadsPerHotkey 2

*^q::

toggle := !Toggle
loop
{
If toggle 
{
Send {a down}
sleep, 1000
Send {a up}
Send {d down}
sleep, 1000
Send {d up}
}
else
	break
}
return
Activate / Deactivate it with "ctrl + q".
Just to fill my curiosity... Are you here for The Evil Within 2?
Hey! id post this Toggle Script xD
User avatar
elModo7
Posts: 36
Joined: 01 Sep 2017, 02:38

Re: Script for switch holding a and d

Post by elModo7 » 17 Oct 2017, 10:27

Reloaded wrote:
elModo7 wrote:Let's see:

Code: Select all

#MaxThreadsPerHotkey 2

*^q::

toggle := !Toggle
loop
{
If toggle 
{
Send {a down}
sleep, 1000
Send {a up}
Send {d down}
sleep, 1000
Send {d up}
}
else
	break
}
return
Activate / Deactivate it with "ctrl + q".
Just to fill my curiosity... Are you here for The Evil Within 2?
Hey! id post this Toggle Script xD
You did also reply to an older post I did and, as you can see there, I gave credit.
I normally tend to give credit.
However, in this case I remember writing the inner loop code myself, so if you did write it too, that may have just been pure coincidence. (Pressing a button each second is not something that varies a lot from method to method), it's like if someone asks how to add 1+1, the code section of reply messages will always be 1+1 or x+x or around that xD

Btw, that toggle script has existed almost since the language was born, it's like no need to credit a loop or a default function right?
That or I didn't understand what you meant :lol:
I can't see how you wrote that code, it's basic ahk scripting.
:beer:
User avatar
Reloaded
Posts: 267
Joined: 25 Aug 2017, 08:48

Re: Script for switch holding a and d

Post by Reloaded » 17 Oct 2017, 13:17

elModo7 wrote:
Reloaded wrote:
elModo7 wrote:Let's see:

Code: Select all

#MaxThreadsPerHotkey 2

*^q::

toggle := !Toggle
loop
{
If toggle 
{
Send {a down}
sleep, 1000
Send {a up}
Send {d down}
sleep, 1000
Send {d up}
}
else
	break
}
return
Activate / Deactivate it with "ctrl + q".
Just to fill my curiosity... Are you here for The Evil Within 2?
Hey! id post this Toggle Script xD
You did also reply to an older post I did and, as you can see there, I gave credit.
I normally tend to give credit.
However, in this case I remember writing the inner loop code myself, so if you did write it too, that may have just been pure coincidence. (Pressing a button each second is not something that varies a lot from method to method), it's like if someone asks how to add 1+1, the code section of reply messages will always be 1+1 or x+x or around that xD

Btw, that toggle script has existed almost since the language was born, it's like no need to credit a loop or a default function right?
That or I didn't understand what you meant :lol:
I can't see how you wrote that code, it's basic ahk scripting.
Here ;) Sry bad english im from Kasachstan but can speak German too :/

Copy and Paste the Full script into a new ahk file and make the Editor to Full screen, its better so ! trust me .

Code: Select all

#MaxThreadsPerHotkey 2			;This you need for it send just 2 Keys (So work a Toggle Script better)
SetBatchLines -1 			;This make your Script faster

*^q::					;With this Key you Start the Script 			

toggle := !Toggle			; "!" are mean False so its just start if you press the Key when you pressed it the "!" false going to be a "True" this means the Script can start.
loop					;Loop means the Script never end
{
If toggle 				;The Toggle := !Toggle is now false if you press "*^q" the Flase go to an True and the Script can start
{ 
Send {a down}				;Here you Copy and Paste what you want to Send, click or something better said, your Script 
sleep, 1000
Send {a up}
Send {d down}
sleep, 1000
Send {d up}
}
else					; This mean if you press again "*^q" he break the Loop, this mean the Loop stopoed
	break
}
return					;The Script start at first line and go to the last, if they didnt stand "Return" the Script just close and think its over, but with return he go back to first line 

User avatar
Reloaded
Posts: 267
Joined: 25 Aug 2017, 08:48

Re: Script for switch holding a and d

Post by Reloaded » 18 Oct 2017, 07:50

elModo7 wrote:
Reloaded wrote:
elModo7 wrote:Let's see:

Code: Select all

#MaxThreadsPerHotkey 2

*^q::

toggle := !Toggle
loop
{
If toggle 
{
Send {a down}
sleep, 1000
Send {a up}
Send {d down}
sleep, 1000
Send {d up}
}
else
	break
}
return
Activate / Deactivate it with "ctrl + q".
Just to fill my curiosity... Are you here for The Evil Within 2?
Hey! id post this Toggle Script xD
You did also reply to an older post I did and, as you can see there, I gave credit.
I normally tend to give credit.
However, in this case I remember writing the inner loop code myself, so if you did write it too, that may have just been pure coincidence. (Pressing a button each second is not something that varies a lot from method to method), it's like if someone asks how to add 1+1, the code section of reply messages will always be 1+1 or x+x or around that xD

Btw, that toggle script has existed almost since the language was born, it's like no need to credit a loop or a default function right?
That or I didn't understand what you meant :lol:
I can't see how you wrote that code, it's basic ahk scripting.
I´m so Stupid xD

I understand it so you dont know how the Script xD

Jeah, can be some one else posted this Toggle Script, but im always at Gaming Forum and many ask me for Help because there Toggle Script didnt work, because this id said "Hey id posted the Script xD"
User avatar
elModo7
Posts: 36
Joined: 01 Sep 2017, 02:38

Re: Script for switch holding a and d

Post by elModo7 » 26 Oct 2017, 03:11

Nah I'm just saying I got a toggle code and then rewrited it to fit OP needs.
I mean that code was gotten from the ahk docs, you don't seem to understand that.
If I get code from someone else, the first thing I do is give credit.
You either don't understand English or idk what did you understand :lol: .
It's ok you are helpful, just don't take me wrong okey?
Have a good day btw ;)
:beer:
Post Reply

Return to “Gaming”