Page 2 of 2

Re: Autofire and toggle

Posted: 09 May 2016, 18:25
by Geff T
tidbit wrote:Welcome to ahk, Geff T :)


ty

i have had to give in and ask a Q here https://autohotkey.com/boards/viewtopic.php?f=18&t=17642&p=85827#p85827but i wont go to OT

Re: Autofire and toggle

Posted: 30 Jun 2016, 05:30
by evilC
Please can we remove the GetKeyState technique for detecting release of a key? IMHO it is bad advice (Only works with one key) and is inefficient (Potentially introduces up to 10ms lag if you use a Sleep 10)

See here: https://autohotkey.com/boards/viewtopic.php?f=7&t=19745

Re: Autofire and toggle

Posted: 05 Mar 2017, 15:01
by wuuii
ok but how do i change the hotkey

Re: Autofire and toggle

Posted: 05 Mar 2017, 16:22
by tidbit
please read before asking.
Helpful links:
1. Don't know how to use these? READ THIS: https://autohotkey.com/docs/Tutorial.htm
2. AHK not working in your game/program? READ THIS: https://autohotkey.com/boards/viewtopic.php?f=7&t=11084
3. List of keys to use as HOTKEYS (the line with "::"): https://autohotkey.com/docs/KeyList.htm
...


and also a link explaining.
as well as a tutorial teaching you the very basics.

Re: Autofire and toggle

Posted: 27 Jan 2018, 19:01
by landfillbaby

works for me (holding space presses it exactly 4 times per second), no need for a loop, i guess my keyboard works weird?

Re: Autofire and toggle

Posted: 27 Jan 2018, 19:07
by GreatGazoo
landfillbaby wrote:
works for me (holding space presses it exactly 4 times per second), no need for a loop, i guess my keyboard works weird?



could it be that the hotkey and the key sent being the same key, that it's creating a loop on it's own

Re: Autofire and toggle

Posted: 28 Jan 2018, 02:06
by landfillbaby
GreatGazoo wrote:could it be that the hotkey and the key sent being the same key, that it's creating a loop on it's own
ok, i've just checked, it still works when the input isn't in the outputthis would probably be a bad thing if i wasn't trying to make a loop anyway

Re: Autofire and toggle

Posted: 28 Jan 2018, 02:50
by GreatGazoo
landfillbaby wrote:
GreatGazoo wrote:could it be that the hotkey and the key sent being the same key, that it's creating a loop on it's own
ok, i've just checked, it still works when the input isn't in the outputthis would probably be a bad thing if i wasn't trying to make a loop anyway




yeah i noticed that too with my random number generator, while holding control j it sends random number, enter, and it sends J's too

Code: [Select all] [Download] GeSHi © Codebox Plus


^j::
SoundBeep, 525, 100
Random, rand, 1, 10000
send, %rand% {enter}
return


Re: Autofire and toggle

Posted: 28 Jan 2018, 04:21
by landfillbaby
it turns out it's tied to the physical keyboard's auto-repeat feature, and is interrupted by other keypresses
i used this instead:

Code: [Select all] [Download] GeSHi © Codebox Plus

SetKeyDelay -1
t=
Space Up::t=
Space::
t=1
While t {
Send % " "
Sleep 250
}
Return
it's basically just the toggle method but without the threading problem

Re: Autofire and toggle

Posted: 30 Jan 2018, 13:45
by Delta Pythagorean
landfillbaby wrote:it turns out it's tied to the physical keyboard's auto-repeat feature, and is interrupted by other keypresses
i used this instead:

Code: [Select all] [Download] GeSHi © Codebox Plus

SetKeyDelay -1
t=
Space Up::t=
Space::
t=1
While t {
Send, % " "
Sleep, 250
}
Return
it's basically just the toggle method but without the threading problem


If you want to use a spammer for a key, just use this. It's small, simple, and can be used anywhere in a script, not just a hotkey.