Autofire and toggle

Put simple Tips and Tricks that are not entire Tutorials in this forum
Geff T
Posts: 6
Joined: 07 May 2016, 15:16

Re: Autofire and toggle

09 May 2016, 18:25

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
User avatar
evilC
Posts: 4277
Joined: 27 Feb 2014, 12:30

Re: Autofire and toggle

30 Jun 2016, 05:30

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
wuuii

Re: Autofire and toggle

05 Mar 2017, 15:01

ok but how do i change the hotkey
User avatar
tidbit
Posts: 1084
Joined: 29 Sep 2013, 17:15
Location: USA

Re: Autofire and toggle

05 Mar 2017, 16:22

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.
rawr. fear me.
*poke*
Is it December 21, 2012 yet?
landfillbaby
Posts: 3
Joined: 27 Jan 2018, 18:56
GitHub: landfillbaby

Re: Autofire and toggle

27 Jan 2018, 19:01


works for me (holding space presses it exactly 4 times per second), no need for a loop, i guess my keyboard works weird?
GreatGazoo
Posts: 69
Joined: 28 Dec 2017, 02:53

Re: Autofire and toggle

27 Jan 2018, 19:07

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
landfillbaby
Posts: 3
Joined: 27 Jan 2018, 18:56
GitHub: landfillbaby

Re: Autofire and toggle

28 Jan 2018, 02:06

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
GreatGazoo
Posts: 69
Joined: 28 Dec 2017, 02:53

Re: Autofire and toggle

28 Jan 2018, 02:50

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

landfillbaby
Posts: 3
Joined: 27 Jan 2018, 18:56
GitHub: landfillbaby

Re: Autofire and toggle

28 Jan 2018, 04:21

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
User avatar
Delta Pythagorean
Posts: 416
Joined: 13 Feb 2017, 13:44
GitHub: DelPyth
Location: Equestria

Re: Autofire and toggle

30 Jan 2018, 13:45

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.

Return to “Tips and Tricks”

Who is online

Users browsing this forum: No registered users and 0 guests