When i press a certain key - Toogle what other keys will send Topic is solved

Ask gaming related questions (AHK v1.1 and older)
YGA
Posts: 2
Joined: 13 Jun 2021, 18:01

When i press a certain key - Toogle what other keys will send

Post by YGA » 13 Jun 2021, 18:12

Hy, I'm new to autohotkey and i was trying to do control what a certain group of keys will send. My idea is the following:

If i press the dot key "." i want my "Space" bar to work as "c", my "left mouse button" to to work as "x" and my "right mouse button" to to work as "z". Only when i press dot again "." the 3 keys will start to behave normally, by normally i mean space will work as space, lmb will work as lmb and rmb will work as rmb.

This is as far as i got with coding that and i know my syntax is totally wrong:

Code: Select all

varx:=true
.::
if (varx)
{
    	Space:=c
	LButton:=x
	RButton:=:z
	varx:=false
}
else
{
    	Space:=Space
	LButton:=LButton
	RButton:=RButton
	varx:=true
}
return
[Mod edit: [code][/code] tags added.]

Thanks in advance for the help
User avatar
mikeyww
Posts: 26601
Joined: 09 Sep 2014, 18:38

Re: When i press a certain key - Toogle what other keys will send  Topic is solved

Post by mikeyww » 13 Jun 2021, 18:47

Actually, the first four lines look OK.... :)

Code: Select all

.::
on := !on
SoundBeep, 1000 + 500 * on
Return
#If on
Space::c
LButton::x
RButton::z
#If
You could have a look at the AHK documentation, which includes an introduction. Happy coding!
YGA
Posts: 2
Joined: 13 Jun 2021, 18:01

Re: When i press a certain key - Toogle what other keys will send

Post by YGA » 13 Jun 2021, 19:30

Thanks a lot worked perfectly.
Post Reply

Return to “Gaming Help (v1)”