Hello guys. First time posting here.
So I have a script that allows me to jump repeatedly. But when I press W (to run) and Shift (To sprint) The Space bar doesnt work.
Here is the script
#usehook ;*1
hotkey, space, spam ;*2
return
spam: ;*3
{
while getkeystate(a_thishotkey, "p") ;*4
{
sleep, 200 ;*5
sendinput, {%a_thishotkey%} ;*6
}
}
return
end::exitapp ;*7
/*
Need help with script. Info inside. Topic is solved
-
- Posts: 1259
- Joined: 16 Apr 2015, 09:41
Re: Need help with script. Info inside.
Try changing hotkey, space, spam ;*2 to hotkey, *space, spam ;*2.
Re: Need help with script. Info inside. Topic is solved
Space doesnt work at all now.Shadowpheonix wrote:Try changing hotkey, space, spam ;*2 to hotkey, *space, spam ;*2.
-
- Posts: 1259
- Joined: 16 Apr 2015, 09:41
Re: Need help with script. Info inside.
Odd, as it worked when I tested it in Notepad.
Edit:
My mistake. When I tested, I used a version of the script that did not use A_ThisHotkey. I tried it with A_ThisHotkey and it does indeed fail for me as well.
The options I see are to either...
A) Replace all references to A_ThisHotkey with Space, which may cause problems if you use that Spam section for other hotkeys also.
B) Create additional hotkeys to cover Shift+Space, Alt+Space, Ctrl+Space, and any other combinations you may use.
Edit:
My mistake. When I tested, I used a version of the script that did not use A_ThisHotkey. I tried it with A_ThisHotkey and it does indeed fail for me as well.
The options I see are to either...
A) Replace all references to A_ThisHotkey with Space, which may cause problems if you use that Spam section for other hotkeys also.
B) Create additional hotkeys to cover Shift+Space, Alt+Space, Ctrl+Space, and any other combinations you may use.
Re: Need help with script. Info inside.
Another alternative is to strip the leading * from A_ThisHotkey. i.e. using *Space causes A_ThisHotkey to contain *Space (not Space, without the *) and since no such key exists GetKeyState is always returning false. Even if you forced the GetKeyState to be Space, the sendinput would also not send a simple space but possibly a * and Space if anything at all. Personally I'd do something like this:
Code: Select all
spam: ;*3
{
Button := LTrim(A_ThisHotkey, "~*$<>^!#+")
while getkeystate(Button, "p") ;*4
{
sleep, 200 ;*5
sendinput, {%Button%} ;*6
}
}
return
-
- Posts: 1259
- Joined: 16 Apr 2015, 09:41
Re: Need help with script. Info inside.
When I said "Replace all references to A_ThisHotkey with Space, which may cause problems if you use that Spam section for other hotkeys also", it was intended to include the reference on the SendInput line specifically to avoid that issue. However, your solution presents a 3rd option that I think is better than either of the ones I suggested.
Who is online
Users browsing this forum: No registered users and 89 guests