Hi, english isnt my main language so i apologize if i dont explain myself correctly.
I play world of warcraft, i spam my keys, i would like to have a funtion where i just press 1-6 and the autohotkey will spam that key as fast as posible, the script could be enabled by pressing scroll lock.
i found a player saying this work but i tried and the script would not work. I only need 1-6 to work with spam.
Little more explanation, In the game you have to press your abilities, if you are a caster you want to get the cast as fast as possible, so in order to do this what i do is i spam (lets say fireball wich is number 4) the key 4, i would like to press a key down and the script to spam that key until i release the key.
Thanks in advance.
[Mod action: Topic moved to "Gaming".]
world of warcraft player, Looking for Autofire
- WarlordAkamu67
- Posts: 279
- Joined: 21 Mar 2023, 06:52
Re: world of warcraft player, Looking for Autofire
You may need to change the #HotIf statement to match your window title.
Code: Select all
#Requires AutoHotkey v2.0
#SingleInstance Force
#HotIf WinActive("World of Warcraft")
~1::
~2::
~3::
~4::
~5::
~6::
{
hit_Key := LTrim(A_ThisHotkey, "~")
while (GetKeyState(hit_Key, "P")) {
Send(hit_Key)
Sleep(50)
}
return
}
The End.
Re: world of warcraft player, Looking for Autofire
does the sleep 50 is the duration that it will take to press the key again?
can i lower that or increase that?
can i lower that or increase that?
- WarlordAkamu67
- Posts: 279
- Joined: 21 Mar 2023, 06:52
Re: world of warcraft player, Looking for Autofire
Yes, that is 50 miliseconds. You can alter that or remove it if you would like... you did say as fast as possible.
The End.
Re: world of warcraft player, Looking for Autofire
Im using the script but it doesnt looks like its working for me, im getting the current error:
Warning: This variable appears to never be assigned a value.
Specifically: global Input
▶ 005: SendMode(Input)
006: SetWorkingDir(%A_ScriptDir%)
008: {
For more details, read the documentation for #Warn.
Warning: This variable appears to never be assigned a value.
Specifically: global Input
▶ 005: SendMode(Input)
006: SetWorkingDir(%A_ScriptDir%)
008: {
For more details, read the documentation for #Warn.
Re: world of warcraft player, Looking for Autofire
this is what i have on the script:
[Mod edit: [code][/code] tags added. Please use them yourself when posting code!]
Code: Select all
#Requires AutoHotkey v2.0
#SingleInstance Force
; #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.
#HotIf WinActive("World of Warcraft")
~1::
~2::
~3::
~4::
~5::
~6::
{
hit_Key := LTrim(A_ThisHotkey, "~")
while (GetKeyState(hit_Key, "P")) {
Send(hit_Key)
Sleep(50)
}
return
}
Re: world of warcraft player, Looking for Autofire
https://www.youtube.com/watch?v=ICE7z87ZYzI this is what im trying to do, but his script doesnt work either.
Re: world of warcraft player, Looking for Autofire
This is the script he is using, i only need 1 to 6 keys, but this doesnt work for me.
[Mod edit: Added [code][/code] tags. Please use them yourself when posting code.]
Code: Select all
#HotkeyInterval 20 ; This is the default value (milliseconds).
#MaxHotkeysPerInterval 20000
; To add a new key to the script, add it to this array:
key_list := ["1", "2", "3", "4", "5", "6", "7", "^", "t", "a", "d", "r", "s", "<", "f", "c",
, "XButton1", "XButton2", "MButton"
, "Numpad0", "Numpad1", "Numpad2", "Numpad3", "Numpad4", "Numpad5", "Numpad6", "Numpad8"
, "NumpadMult", "NumpadDiv", "NumpadAdd", "NumpadSub", "F2", "F1", "F3"]
; Init lookup array for modifiers
modifiers := {LAlt: 0, LShift: 0, LCtrl: 0}
; Build lookup array, declare hotkeys
keys := {}
keys_modded := {}
Loop % key_list.MaxIndex(){
key := key_list[A_Index]
; init array values
keys[key] := 0
keys_modded[key] := 0
; Declare hotkeys for up and down events
hotkey, $*%key%, keydown
hotkey, $*%key% up, keyup
}
Loop {
; Endless loop - always running
GetKeyState, ScrollLockState, ScrollLock, T
for key, value in keys {
; Loop through each of the keys
if (value){
; If the key is held...
; Detect if any modifiers held
if (modifiers.LAlt || modifiers.LCtrl || modifiers.LShift){
modifier_held := 1
} else {
modifier_held := 0
}
; Build the list of modifiers to use for the send
s := ""
if (modifiers.LAlt){
s .= "!"
}
if (modifiers.LShift){
s .= "+"
}
if (modifiers.LCtrl){
s .= "^"
}
; Send the key with the modifiers
Send % s "{" key "}"
}
}
Sleep 10
}
; Any of the "keys" (ie not modifiers) being pressed will call this
keydown:
key := SubStr(A_ThisHotkey,3)
if (ScrollLockState <> "U") {
keys[key] := 1
return
} else {
s := ""
if (modifiers.LAlt){
s .= "!"
}
if (modifiers.LShift){
s .= "+"
}
if (modifiers.LCtrl){
s .= "^"
}
Send % s "{" key "}"
}
; Any of the "keys" being released will call this
keyup:
key := SubStr(A_ThisHotkey,3)
; Remove " up" from end
key := substr(key, 1, StrLen(key) - 3)
keys[key] := 0
keys_modded[key] := 0
return
; Modifiers
$~*LAlt::
$~*LShift::
$~*LCtrl::
mod := substr(A_ThisHotkey, 4)
modifiers[mod] := 1
return
$~*LAlt up::
$~*LCtrl up::
$~*LShift up::
mod := substr(A_ThisHotkey, 4)
; Remove " up" from end
mod := substr(mod, 1, StrLen(mod) - 3)
modifiers[mod] := 0
return
[Mod edit: Added [code][/code] tags. Please use them yourself when posting code.]
Re: world of warcraft player, Looking for Autofire
@Perrito — Please use [code][/code] tags when posting code! And don’t post the same thing more than once. Please be patient and wait for your post to be approved. Thank you.
- WarlordAkamu67
- Posts: 279
- Joined: 21 Mar 2023, 06:52
Re: world of warcraft player, Looking for Autofire
The lines that you added to what I provided are giving you and error because you are trying to set send mode to that of a variable called Input, which is not created. In version 2 of AutoHotkey, things are assumed to be expression, and so literal text must be quoted. In this case, you want a literal string, SendMode("Input"). Check out the documentation on send mode.
In the picture of the documentation, you can see the quotes around the send mode type. Additionally, you are causing some confusion with the script directory. The same problem is occurring in that the value passed to the function is assumed an expression all ready, and should be just the variable [SetWorkingDir(A_ScriptDir)] or a literal string/file path [SetWorkingDir("myfiles\here")]. More can be found in the documentation: https://www.autohotkey.com/docs/v2/lib/SetWorkingDir.htm
As for the second script you posted, I do not have the time today to look at it much. It is a script for AutoHotkey version 1.
In the picture of the documentation, you can see the quotes around the send mode type. Additionally, you are causing some confusion with the script directory. The same problem is occurring in that the value passed to the function is assumed an expression all ready, and should be just the variable [SetWorkingDir(A_ScriptDir)] or a literal string/file path [SetWorkingDir("myfiles\here")]. More can be found in the documentation: https://www.autohotkey.com/docs/v2/lib/SetWorkingDir.htm
As for the second script you posted, I do not have the time today to look at it much. It is a script for AutoHotkey version 1.
The End.
Re: world of warcraft player, Looking for Autofire
I apologize.
Still trying to figure out how can i get autofire on my 1-6 keys, i would prefer to activate the script when caps locks is on instead of when the game is active. Thanks in advance.
- WarlordAkamu67
- Posts: 279
- Joined: 21 Mar 2023, 06:52
Re: world of warcraft player, Looking for Autofire
I see now that this isn't what you mean and later today I can provide something closer to your description. To make sure everything is addressed, though:
Sorry I missed that part in the original post. That can be done be adding or changing a check for the toggle state of CapsLock (or you can change it to scrolllock). This can be done with GetKeyState("CapsLock", "T"). By adding that to the #HotIf statement, or changing the statement. I removed the WinActive and replace it with GetKeyState. Additionally, I quoted the string for the SendMode() and removed the %'s from the SetWorkingDir().
Sorry I missed that part in the original post. That can be done be adding or changing a check for the toggle state of CapsLock (or you can change it to scrolllock). This can be done with GetKeyState("CapsLock", "T"). By adding that to the #HotIf statement, or changing the statement. I removed the WinActive and replace it with GetKeyState. Additionally, I quoted the string for the SendMode() and removed the %'s from the SetWorkingDir().
Code: Select all
#Requires AutoHotkey v2.0
#SingleInstance Force
; #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.
#HotIf (GetKeyState("CapsLock", "T"))
~1::
~2::
~3::
~4::
~5::
~6::
{
hit_Key := LTrim(A_ThisHotkey, "~")
while (GetKeyState(hit_Key, "P")) {
Send(hit_Key)
}
return
}
The End.
- WarlordAkamu67
- Posts: 279
- Joined: 21 Mar 2023, 06:52
Re: world of warcraft player, Looking for Autofire
I used https://github.com/mmikeww/AHK-v2-script-converter to convert the script you posted. I then edited it to make it work. Here is the result:
Code: Select all
A_HotkeyInterval := 20 ; This is the default value (milliseconds).
A_MaxHotkeysPerInterval := 20000
; To add a new key to the script, add it to this array:
key_list := ["1", "2", "3", "4", "5", "6"]
; Init lookup array for modifiers
modifiers := Map(LAlt: 0, LShift: 0, LCtrl: 0)
; Build lookup array, declare hotkeys
keys := map()
keys_modded := map()
Loop key_list.Length {
key := key_list[A_Index]
; init array values
keys[key] := 0
keys_modded[key] := 0
; Declare hotkeys for up and down events
Hotkey("$*" key, key_Down)
Hotkey("$*" key " up", key_Up)
}
Loop{
; Endless loop - always running
ScrollLockState := GetKeyState("ScrollLock", "T")
for key, value in keys {
; Loop through each of the keys
if (value){
; If the key is held...
; Detect if any modifiers held
if (modifiers.LAlt || modifiers.LCtrl || modifiers.LShift){
modifier_held := 1
} else {
modifier_held := 0
}
; Build the list of modifiers to use for the send
s := ""
if (modifiers.LAlt){
s .= "!"
}
if (modifiers.LShift){
s .= "+"
}
if (modifiers.LCtrl){
s .= "^"
}
; Send the key with the modifiers
Send(s "{" key "}")
}
}
Sleep(10)
}
; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ;
; Any of the "keys" (ie not modifiers) being pressed will call this
key_Down(ThisHotkey) {
key := SubStr(A_ThisHotkey, 3)
if (ScrollLockState) {
keys[key] := 1
return
} else {
s := ""
if (modifiers.LAlt){
s .= "!"
}
if (modifiers.LShift){
s .= "+"
}
if (modifiers.LCtrl){
s .= "^"
}
Send(s "{" key "}")
}
}
; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ;
; Any of the "keys" being released will call this
key_Up(ThisHotkey) {
key := SubStr(A_ThisHotkey, 3)
; Remove " up" from end
key := SubStr(key, 1, StrLen(key) - 3)
keys[key] := 0
keys_modded[key] := 0
return
}
; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ;
; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ;
; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ;
; Modifiers
$~*LAlt::
$~*LShift::
$~*LCtrl::
{
global
maybeModified := SubStr(A_ThisHotkey, 4)
modifiers[maybeModified] := 1
return
}
$~*LAlt up::
$~*LCtrl up::
$~*LShift up::
{
global
maybeModified := SubStr(A_ThisHotkey, 4)
; Remove " up" from end
maybeModified := SubStr(maybeModified, 1, StrLen(maybeModified) - 3)
modifiers[maybeModified] := 0
return
}
The End.
Re: world of warcraft player, Looking for Autofire
im using this and still not working in game, then for no reason it crashed my computer pressing 1 non stop. i must be doing something wrong.WarlordAkamu67 wrote: ↑16 Nov 2023, 11:23I see now that this isn't what you mean and later today I can provide something closer to your description. To make sure everything is addressed, though:
Sorry I missed that part in the original post. That can be done be adding or changing a check for the toggle state of CapsLock (or you can change it to scrolllock). This can be done with GetKeyState("CapsLock", "T"). By adding that to the #HotIf statement, or changing the statement. I removed the WinActive and replace it with GetKeyState. Additionally, I quoted the string for the SendMode() and removed the %'s from the SetWorkingDir().
Code: Select all
#Requires AutoHotkey v2.0 #SingleInstance Force ; #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. #HotIf (GetKeyState("CapsLock", "T")) ~1:: ~2:: ~3:: ~4:: ~5:: ~6:: { hit_Key := LTrim(A_ThisHotkey, "~") while (GetKeyState(hit_Key, "P")) { Send(hit_Key) } return }
- DuckingQuack
- Posts: 222
- Joined: 20 Jan 2023, 18:20
Re: world of warcraft player, Looking for Autofire
Sounds like a classic case of "hotkey sends the hotkey" issue. Simple fix is $ in front of each hotkey but that's not so simple to add to this script.
Best of Luck,
The Duck
The Duck
- WarlordAkamu67
- Posts: 279
- Joined: 21 Mar 2023, 06:52
Re: world of warcraft player, Looking for Autofire
The 2nd script all ready includes "$" where the hotkey function creates the hotkeys. As for the original script I posted, don't forget to add them to the LTrim.DuckingQuack wrote: ↑16 Nov 2023, 22:01Sounds like a classic case of "hotkey sends the hotkey" issue. Simple fix is $ in front of each hotkey but that's not so simple to add to this script.
Code: Select all
#Requires AutoHotkey v2.0
#SingleInstance Force
; #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.
#HotIf (GetKeyState("CapsLock", "T"))
~$1::
~$2::
~$3::
~$4::
~$5::
~$6::
{
hit_Key := LTrim(A_ThisHotkey, "~$")
while (GetKeyState(hit_Key, "P")) {
Send(hit_Key)
}
return
}
The End.
Re: world of warcraft player, Looking for Autofire
this doesnt work while on game, when i try to use this, and come to the forums it works nonstop, the script will have to stop pressing the key when i release the key, for example. lets say my rotation is number 4 fireball wich is a 2 sec cast time, i wantt to spam 4 as fast as possible that way the spell is queque as soon as possible. then i get a proc of pyroblast, i want to now spam 5 (pyroblast key) that way when the last fireball is casted immidiatly fires the pyro and then again i want to press 4.WarlordAkamu67 wrote: ↑17 Nov 2023, 06:43The 2nd script all ready includes "$" where the hotkey function creates the hotkeys. As for the original script I posted, don't forget to add them to the LTrim.DuckingQuack wrote: ↑16 Nov 2023, 22:01Sounds like a classic case of "hotkey sends the hotkey" issue. Simple fix is $ in front of each hotkey but that's not so simple to add to this script.
Code: Select all
#Requires AutoHotkey v2.0 #SingleInstance Force ; #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. #HotIf (GetKeyState("CapsLock", "T")) ~$1:: ~$2:: ~$3:: ~$4:: ~$5:: ~$6:: { hit_Key := LTrim(A_ThisHotkey, "~$") while (GetKeyState(hit_Key, "P")) { Send(hit_Key) } return }
so it will look like this: i press 4 1 time then i press 5 1 time then i press 4 again, i want the script to fire the key until i release the key. this script is pressing that key forever and it only works sometimes on the forums not in game.
- DuckingQuack
- Posts: 222
- Joined: 20 Jan 2023, 18:20
Re: world of warcraft player, Looking for Autofire
My suggestion is changing send mode to event and adding setkeydelay( , 250) to the top.
On mobile, so i can’t test it or write it for you, but the script you have as a whole should do exactly what you want, but with these changes, the game should see the presses too.
On mobile, so i can’t test it or write it for you, but the script you have as a whole should do exactly what you want, but with these changes, the game should see the presses too.
Best of Luck,
The Duck
The Duck
Re: world of warcraft player, Looking for Autofire
You think you can convert this into V2DuckingQuack wrote: ↑23 Nov 2023, 20:39My suggestion is changing send mode to event and adding setkeydelay( , 250) to the top.
On mobile, so i can’t test it or write it for you, but the script you have as a whole should do exactly what you want, but with these changes, the game should see the presses too.
Code: Select all
#HotkeyInterval 20 ; This is the default value (milliseconds).
#MaxHotkeysPerInterval 20000
; To add a new key to the script, add it to this array:
key_list := ["1", "2", "3", "4", "5", "6"]
; Init lookup array for modifiers
modifiers := {LAlt: 0, LShift: 0, LCtrl: 0}
; Build lookup array, declare hotkeys
keys := {}
keys_modded := {}
Loop % key_list.MaxIndex(){
key := key_list[A_Index]
; init array values
keys[key] := 0
keys_modded[key] := 0
; Declare hotkeys for up and down events
hotkey, $*%key%, keydown
hotkey, $*%key% up, keyup
}
Loop {
; Endless loop - always running
GetKeyState, ScrollLockState, ScrollLock, T
for key, value in keys {
; Loop through each of the keys
if (value){
; If the key is held...
; Detect if any modifiers held
if (modifiers.LAlt || modifiers.LCtrl || modifiers.LShift){
modifier_held := 1
} else {
modifier_held := 0
}
; Build the list of modifiers to use for the send
s := ""
if (modifiers.LAlt){
s .= "!"
}
if (modifiers.LShift){
s .= "+"
}
if (modifiers.LCtrl){
s .= "^"
}
; Send the key with the modifiers
Send % s "{" key "}"
}
}
Sleep 10
}
; Any of the "keys" (ie not modifiers) being pressed will call this
keydown:
key := SubStr(A_ThisHotkey,3)
if (ScrollLockState <> "U") {
keys[key] := 1
return
} else {
s := ""
if (modifiers.LAlt){
s .= "!"
}
if (modifiers.LShift){
s .= "+"
}
if (modifiers.LCtrl){
s .= "^"
}
Send % s "{" key "}"
}
; Any of the "keys" being released will call this
keyup:
key := SubStr(A_ThisHotkey,3)
; Remove " up" from end
key := substr(key, 1, StrLen(key) - 3)
keys[key] := 0
keys_modded[key] := 0
return
; Modifiers
$~*LAlt::
$~*LShift::
$~*LCtrl::
mod := substr(A_ThisHotkey, 4)
modifiers[mod] := 1
return
$~*LAlt up::
$~*LCtrl up::
$~*LShift up::
mod := substr(A_ThisHotkey, 4)
; Remove " up" from end
mod := substr(mod, 1, StrLen(mod) - 3)
modifiers[mod] := 0
return
- DuckingQuack
- Posts: 222
- Joined: 20 Jan 2023, 18:20
Re: world of warcraft player, Looking for Autofire
@Perrito
This script is a simplified version of Warlord's script but with the changes I suggested earlier included. Try this and we can test other stuff depending on how it goes. I included an exit button if things go crazy (F12). Keep this line the first time you run it for safety, but if you need F12 in-game, then delete that line. The hotkeys are only activated while scroll lock is toggled on, so make sure you use it.
This script is a simplified version of Warlord's script but with the changes I suggested earlier included. Try this and we can test other stuff depending on how it goes. I included an exit button if things go crazy (F12). Keep this line the first time you run it for safety, but if you need F12 in-game, then delete that line. The hotkeys are only activated while scroll lock is toggled on, so make sure you use it.
Code: Select all
#Requires AutoHotkey v2.0
#SingleInstance Force
InstallKeybdHook
InstallMouseHook
SendMode("Event")
SetKeyDelay( 0, 250)
F12::ExitApp
#HotIf GetKeyState("ScrollLock", "T")
~$1:: {
While GetKeyState("1", "P") {
Send("{Blind}1")
Sleep(50)
}}
~$2:: {
While GetKeyState("2", "P") {
Send("{Blind}2")
Sleep(50)
}}
~$3:: {
While GetKeyState("3", "P") {
Send("{Blind}3")
Sleep(50)
}}
~$4:: {
While GetKeyState("4", "P") {
Send("{Blind}4")
Sleep(50)
}}
~$5:: {
While GetKeyState("5", "P") {
Send("{Blind}5")
Sleep(50)
}}
~$6:: {
While GetKeyState("6", "P") {
Send("{Blind}6")
Sleep(50)
}}
#HotIf
Best of Luck,
The Duck
The Duck
Who is online
Users browsing this forum: No registered users and 15 guests