help me

Ask gaming related questions (AHK v1.1 and older)
bryantan179
Posts: 74
Joined: 29 Mar 2017, 01:55

help me

25 Feb 2018, 09:23

When i click or hold capslock , the script should loop Spam1 and Spam2 . But , when i click or hold capslock ,only the Spam 1 is looped . after that i tried to remove SetTimer, Spam2, OFF and both Spam 1 and Spam2 is looped but it will not stop when i release capslock . how can i solve this problem ?





Code: Select all

#MaxHotkeysPerInterval 9900000000000
#HotkeyInterval 9900000000000

 
$*Capslock::
{
	Send, {2 down}
	SetTimer, Spam1, 10
	KeyWait, Capslock 
	SetTimer, Spam1, OFF
	SetTimer, Spam2, 10
	KeyWait, Capslock
	SetTimer, Spam2, OFF
	Send, {2 up}
} Return


Spam1:
{	Send, {space down}
	Send, {space up}
	Send, {s down}
	Send, {space down}
	Send, {s up}
	Send, {space up}
} Return

Spam2:
{
	Send, {a down}
	Send, {a up}
} Return
User avatar
Nwb
Posts: 444
Joined: 29 Nov 2016, 08:56

Re: help me

25 Feb 2018, 11:07

Here you go. Let me know if it works

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#MaxThreadsPerHotkey 2

$*Capslock::
Send, {2 Down}
SetTimer, Spam1, 10
SetTimer, Spam2, 10
KeyWait, Capslock 
SetTimer, Spam1, Off
SetTimer, Spam2, Off
Send, {2 Up}
return

Spam1:
Send, {Space Down}{Space Up}{S Down}{Space Down}{S Up}{Space Up}
return

Spam2:
Send, {A Down}{A Up}
return


esc:: ExitApp ; esc, exits the script

	

I am your average ahk newbie. Just.. a tat more cute. ;)
bryantan179
Posts: 74
Joined: 29 Mar 2017, 01:55

Re: help me

25 Feb 2018, 11:45

thx it works , but why didnt my script worked ? is it because i used 2 keywait ?
bryantan179
Posts: 74
Joined: 29 Mar 2017, 01:55

Re: help me

25 Feb 2018, 11:53

What if i hold capslock and i hold ''D''button , i want it to send D instead of Send, {A Down}{A Up} ? is it possible ?
Also , if i hold the button for few seconds and release it ,sometimes it will take few second for the script to stop looping . is it possible to stop the script from looping immediately after capslock is released , maybe a method to ignore the rest of the script that hasnt been looped when clicked .

#NoEnv
#Warn
SetWorkingDir %A_ScriptDir%
#MaxThreadsPerHotkey 2

$*Capslock::
Send, {2 Down}
SetTimer, Spam1, 10
SetTimer, Spam2, 10
KeyWait, Capslock
SetTimer, Spam1, Off
SetTimer, Spam2, Off
Send, {2 Up}
return

Spam1:
Send, {Space Down}{Space Up}{S Down}{Space Down}{S Up}{Space Up}
return

Spam2:
Send, {A Down}{A Up}
return
User avatar
Nwb
Posts: 444
Joined: 29 Nov 2016, 08:56

Re: help me

25 Feb 2018, 12:35

bryantan179 wrote:thx it works , but why didnt my script worked ? is it because i used 2 keywait ?
Yes indeed!
I am your average ahk newbie. Just.. a tat more cute. ;)
User avatar
Nwb
Posts: 444
Joined: 29 Nov 2016, 08:56

Re: help me

25 Feb 2018, 12:41

bryantan179 wrote:What if i hold capslock and i hold ''D''button , i want it to send D instead of Send, {A Down}{A Up} ? is it possible ?
Also , if i hold the button for few seconds and release it ,sometimes it will take few second for the script to stop looping . is it possible to stop the script from looping immediately after capslock is released , maybe a method to ignore the rest of the script that hasnt been looped when clicked .

#NoEnv
#Warn
SetWorkingDir %A_ScriptDir%
#MaxThreadsPerHotkey 2

$*Capslock::
Send, {2 Down}
SetTimer, Spam1, 10
SetTimer, Spam2, 10
KeyWait, Capslock
SetTimer, Spam1, Off
SetTimer, Spam2, Off
Send, {2 Up}
return

Spam1:
Send, {Space Down}{Space Up}{S Down}{Space Down}{S Up}{Space Up}
return

Spam2:
Send, {A Down}{A Up}
return
Hmm it shouldn't be taking seconds to stop. I guess we will have to use pause or exit? Anyways tell me if this works like you wanted it to.
If the problem persists then we will use while getkeystate for capslock

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#MaxThreadsPerHotkey 2

$*Capslock::
Send, {2 Down}
SetTimer, Spam1, 10
SetTimer, Spam2, 10
KeyWait, Capslock 
SetTimer, Spam1, Off
SetTimer, Spam2, Off
Send, {2 Up}
return

Spam1:
Send, {Space Down}{Space Up}{S Down}{Space Down}{S Up}{Space Up}
return

Spam2:
Send, {A Down}{A Up}
return

Capslock & d::
Send, {2 Down}
SetTimer, Spam3, 10
SetTimer, Spam4, 10
KeyWait, d
SetTimer, Spam3, Off
SetTimer, Spam4, Off
Send, {2 Up}
return

Spam3:
Send, {Space Down}{Space Up}{S Down}{Space Down}{S Up}{Space Up}
return

Spam4:
Send, {D Down}{A Up}
return


esc:: ExitApp ; esc, exits the script
I am your average ahk newbie. Just.. a tat more cute. ;)
bryantan179
Posts: 74
Joined: 29 Mar 2017, 01:55

Re: help me

25 Feb 2018, 13:14

what if i send something with a long sleep ? for example:
Send {a down}
Sleep 500
Send {a up}
what i want is , when i release the capslock , it will immediately stop the loop instead of continue for a few second until the loop is finished .
bryantan179
Posts: 74
Joined: 29 Mar 2017, 01:55

Re: help me

25 Feb 2018, 16:22

what about this ? how do i make it so that when i release capslock , script stop looping.

#MaxHotkeysPerInterval 9900000000000
#HotkeyInterval 9900000000000

$*Capslock::
if(jumpout = 0)
{
jumpout = 1
Send {2 down}
Send {2 up}
SetTimer, Send_2, 10
SetTimer, Send_3, 10
}
else
{
jumpout = 0
SetTimer, Send_2, off
SetTimer, Send_3, off
}
Return

Send_2:
Send {space down}
Send {space up}
Send {s down}
Send {space down}
Send {s up}
Send {space up}
Return

Send_3:
Send {a down}
Send {a up}
Return

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 38 guests