Trouble making command with A_Priorhotkey Topic is solved

Ask gaming related questions (AHK v1.1 and older)
shanshans
Posts: 27
Joined: 13 Dec 2015, 08:10

Trouble making command with A_Priorhotkey

Post by shanshans » 15 Jun 2022, 06:14

Code: Select all

#NoEnv
ListLines Off
Process, Priority, , A
SendMode Input
#Persistent
#MaxHotkeysPerInterval 99000000
#HotkeyInterval 99000000
;SetKeyDelay, -1
#InstallKeybdHook
#SingleInstance Force



down::
if (A_Priorhotkey = "right") and (A_TimeSincePriorHotkey < 120) and (threeofthree = 1)
threeofthree:= 2
else
threeofthree:= 0
return



right::
if (A_Priorhotkey = "down") and (A_TimeSincePriorHotkey < 150) and (threeofthree = 2)
threeofthree:= 3
else
sstime := A_TickCount
threeofthree:= 1
return


numpad1::msgbox %threeofthree%

I am making some kind of fighting game command .
Pressing Right > Down > Right and then a button (within 170ms) will send out something.
But the msgbox only return 0.1.2 of threeofthree... If the timing and flow of command is correct it should return 3 ... (I will use that(3) with sstime to confirm the final output)I wonder what is wrong with this , plz help :)

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

Re: Trouble making command with A_Priorhotkey  Topic is solved

Post by mikeyww » 15 Jun 2022, 06:23

For an example of a block, see :arrow: Else.
Blocks are one or more statements enclosed in braces. Typically used with function definitions and control flow statements.

shanshans
Posts: 27
Joined: 13 Dec 2015, 08:10

Re: Trouble making command with A_Priorhotkey

Post by shanshans » 15 Jun 2022, 06:31

My bad , I thought the {} can be skipped when it is one line only... Guess i am wrong... THKS :D

Rohwedder
Posts: 7774
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Trouble making command with A_Priorhotkey

Post by Rohwedder » 15 Jun 2022, 06:38

Hallo,
the way you have programmed it here:

Code: Select all

right::
if (A_Priorhotkey = "down") and (A_TimeSincePriorHotkey < 150) and (threeofthree = 2)
	threeofthree:= 3
else
	sstime := A_TickCount
threeofthree:= 1 ;generally !!!
return
generally threeofthree:= 1 is set.

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

Re: Trouble making command with A_Priorhotkey

Post by mikeyww » 15 Jun 2022, 08:23

Yes, that is the idea: when the Right routine finishes, threeofthree is never 3, which seems to contradict what you wanted.

Post Reply

Return to “Gaming Help (v1)”