I hope I don't come across as lazy for asking someone to write a script for me, but I've spent a significant chunk of time trying to write one myself and I am at a mental block. Would someone mind writing this for me? I am disabled so I use a 2-button mouth-controlled mouse and voice software to use my computer. My goal is to use an auto hotkey script to allow me to play more games.
The script I am imagining would cause a "double right-click" to hold down "W" (moving forward in game). I got that far into writing a script, but these next options were just too advanced. I would also like it to cause an additional single right-click to press "space" (triggering jump in game) WHILE "W" is still being held down. Then I would like to be able to double right-click a 2nd time to cause the script to stop holding down "W".
Additionally, it would be nice if a triple right-click would do the exact same thing except to hold down left shift and W (running in game), while also allowing the option where an additional right-click would press the spacebar. Then to stop holding down left shift and W I could triple right-click.
Something else I need help with is how to stop a script from running? I would imagine I could run this script before I start playing the game, but I don't want a double right-click to ALWAYS cause these commands.
Please let me know if something doesn't make sense. Basically what I'm to be able to hold down left shift and/or W, with the option of pressing space, based on some variation of simply clicking the right mouse button. I haven't thought of a good way to incorporate A, S, and D in addition to W, so if you know of something please let me know!
Script for handicap gaming Topic is solved
-
- Posts: 9
- Joined: 15 Dec 2016, 15:24
Re: Script for handicap gaming
Hi and welcome. Can you move the mouse along the x,y-axes? If so, there are axis-to-wasd key scripts already available in the Scripts and function->Gaming section. My eyes are half shut atm, I'll send you link tomorrow if you cannot find it.scratchlaw wrote:I haven't thought of a good way to incorporate A, S, and D in addition to W, so if you know of something please let me know!
Good luck!
-
- Posts: 9
- Joined: 15 Dec 2016, 15:24
Re: Script for handicap gaming
Thank you for your welcome. I have since stumbled across those axis scripts. I am trying my best, but currently I still can't wrap my head around how they work. I wonder also if those scripts would still be useful if I need to be able to move the mouse cursor to change the camera angle? The game I am hoping to play is Astroneer.Helgef wrote:Hi and welcome. Can you move the mouse along the x,y-axes? If so, there are axis-to-wasd key scripts already available in the Scripts and function->Gaming section. My eyes are half shut atm, I'll send you link tomorrow if you cannot find it.scratchlaw wrote:I haven't thought of a good way to incorporate A, S, and D in addition to W, so if you know of something please let me know!
Good luck!
Re: Script for handicap gaming Topic is solved
Code: Select all
count:=b:=c:=0
SetTimer, check, 20
*^!x:: ;ctrl alt x
Send, {w up}
Send, {LShift Up}
ExitApp
;#IfWinActive <insert game title here>
*RButton::
txt:=A_TimeSincePriorHotkey
if (A_TimeSincePriorHotkey <= 500) ;maximum of 500ms between rclicks to inrease the count
count++
else
count=1
if count > 3
count=3
st := A_TickCount
return
check:
ToolTip, Time between Right Clicks: %txt%ms`nRight Click count: %count%`nw down: %b%`nLShitf down: %c%
if ( (A_TickCount - st) >= 500) ;500ms or more after the last rclick it will take action
{
if count = 1
send, {Space}
else if count = 2
{
b:=!b
if b
Send, {w Down}
else
Send, {w up}
}
else if count = 3
{
c:=!c
if c
Send, {LShift Down}
else
Send, {LShift Up}
}
count=0
}
return
-
- Posts: 9
- Joined: 15 Dec 2016, 15:24
Re: Script for handicap gaming
Thank you so much for putting your time into this! I have some follow-up questions if you don't mind. So it looks like "ctrl alt x" would end the script once I'm done playing? I also see that I need to insert the game title. How specific of titles need to be used? If I took away that hotkey, would the script continue to run regardless of the program or game until I ended it?ahcahc wrote:Also check context sensitive hotkeys https://autohotkey.com/docs/Hotkeys.htm#ContextCode: Select all
count:=b:=c:=0 SetTimer, check, 20 *^!x:: ;ctrl alt x Send, {w up} Send, {LShift Up} ExitApp ;#IfWinActive <insert game title here> *RButton:: txt:=A_TimeSincePriorHotkey if (A_TimeSincePriorHotkey <= 500) ;maximum of 500ms between rclicks to inrease the count count++ else count=1 if count > 3 count=3 st := A_TickCount return check: ToolTip, Time between Right Clicks: %txt%ms`nRight Click count: %count%`nw down: %b%`nLShitf down: %c% if ( (A_TickCount - st) >= 500) ;500ms or more after the last rclick it will take action { if count = 1 send, {Space} else if count = 2 { b:=!b if b Send, {w Down} else Send, {w up} } else if count = 3 { c:=!c if c Send, {LShift Down} else Send, {LShift Up} } count=0 } return
-
- Posts: 9
- Joined: 15 Dec 2016, 15:24
Re: Script for handicap gaming
I think you solved it. Absolutely brilliant. I need to test it in game, but it looks like it's working beautifully. Did you test it in a game?ahcahc wrote:Also check context sensitive hotkeys https://autohotkey.com/docs/Hotkeys.htm#ContextCode: Select all
count:=b:=c:=0 SetTimer, check, 20 *^!x:: ;ctrl alt x Send, {w up} Send, {LShift Up} ExitApp ;#IfWinActive <insert game title here> *RButton:: txt:=A_TimeSincePriorHotkey if (A_TimeSincePriorHotkey <= 500) ;maximum of 500ms between rclicks to inrease the count count++ else count=1 if count > 3 count=3 st := A_TickCount return check: ToolTip, Time between Right Clicks: %txt%ms`nRight Click count: %count%`nw down: %b%`nLShitf down: %c% if ( (A_TickCount - st) >= 500) ;500ms or more after the last rclick it will take action { if count = 1 send, {Space} else if count = 2 { b:=!b if b Send, {w Down} else Send, {w up} } else if count = 3 { c:=!c if c Send, {LShift Down} else Send, {LShift Up} } count=0 } return
-
- Posts: 9
- Joined: 15 Dec 2016, 15:24
Re: Script for handicap gaming
it seems like the only problem is that space is not working.ahcahc wrote:Also check context sensitive hotkeys https://autohotkey.com/docs/Hotkeys.htm#ContextCode: Select all
count:=b:=c:=0 SetTimer, check, 20 *^!x:: ;ctrl alt x Send, {w up} Send, {LShift Up} ExitApp ;#IfWinActive <insert game title here> *RButton:: txt:=A_TimeSincePriorHotkey if (A_TimeSincePriorHotkey <= 500) ;maximum of 500ms between rclicks to inrease the count count++ else count=1 if count > 3 count=3 st := A_TickCount return check: ToolTip, Time between Right Clicks: %txt%ms`nRight Click count: %count%`nw down: %b%`nLShitf down: %c% if ( (A_TickCount - st) >= 500) ;500ms or more after the last rclick it will take action { if count = 1 send, {Space} else if count = 2 { b:=!b if b Send, {w Down} else Send, {w up} } else if count = 3 { c:=!c if c Send, {LShift Down} else Send, {LShift Up} } count=0 } return
Re: Script for handicap gaming
You can exit the script by pressing ctrl+alt+x. If you remove this hotkey then you have to right click tray icon then click exit in order to exit the script or end task using task manager. Put SetTitleMatchMode, 2 at the top of the script, you can then use partial part of the game title with #ifwinactive.scratchlaw wrote:So it looks like "ctrl alt x" would end the script once I'm done playing? I also see that I need to insert the game title. How specific of titles need to be used? If I took away that hotkey, would the script continue to run regardless of the program or game until I ended it?
Yes. Tested it on an FPS game.scratchlaw wrote:Did you test it in a game?
tryscratchlaw wrote:it seems like the only problem is that space is not working.
send, %A_Space%
sendevent, %A_Space%
sendevent, {space}
or
SendMode Input
SendMode Event
or SetKeyDelay, 20, 20
-
- Posts: 9
- Joined: 15 Dec 2016, 15:24
Re: Script for handicap gaming
Does this line need to be edited? I got it working by using the same characters you used for W and LShift.ahcahc wrote:You can exit the script by pressing ctrl+alt+x. If you remove this hotkey then you have to right click tray icon then click exit in order to exit the script or end task using task manager. Put SetTitleMatchMode, 2 at the top of the script, you can then use partial part of the game title with #ifwinactive.scratchlaw wrote:So it looks like "ctrl alt x" would end the script once I'm done playing? I also see that I need to insert the game title. How specific of titles need to be used? If I took away that hotkey, would the script continue to run regardless of the program or game until I ended it?Yes. Tested it on an FPS game.scratchlaw wrote:Did you test it in a game?
tryscratchlaw wrote:it seems like the only problem is that space is not working.
send, %A_Space%
sendevent, %A_Space%
sendevent, {space}
or
SendMode Input
SendMode Event
or SetKeyDelay, 20, 20
ToolTip, Time between Right Clicks: %txt%ms`nRight Click count: %count%`nspace down: %d%`nw down: %b%`nLShitf down: %c%
if ( (A_TickCount - st) >= 500) ;500ms or more after the last rclick it will take action
{
if count = 1
{
d:=!d
if d
send, {Space down}
else
send, {Space up}
}
else if count = 2
The problem was that I had to right-click wants to press the spacebar, and then press it again to release the spacebar. It made it so that every other right-click would press the spacebar.
Re: Script for handicap gaming
You want single right click to repeatedly press spacebar and also stop it with a single right click?
Code: Select all
count:=b:=c:=d:=0
SetTimer, check, 20
SetTimer, check_space, 100
*^!x:: ;ctrl alt x
Send, {w up}
Send, {LShift Up}
ExitApp
;#IfWinActive <insert game title here>
*RButton::
txt:=A_TimeSincePriorHotkey
if (A_TimeSincePriorHotkey <= 500) ;maximum of 500ms between rclicks to inrease the count
count++
else
count=1
if count > 3
count=3
st := A_TickCount
return
check:
;ToolTip, Time between Right Clicks: %txt%ms`nRight Click count: %count%`nw down: %b%`nLShitf down: %c%
ToolTip, Time between Right Clicks: %txt%ms`nRight Click count: %count%`nw down: %b%`nLShitf down: %c%`nrepeat space: %d%
if ( (A_TickCount - st) >= 500) ;500ms or more after the last rclick it will take action
{
if count = 1
d:=!d
else if count = 2
{
b:=!b
if b
Send, {w Down}
else
Send, {w up}
}
else if count = 3
{
c:=!c
if c
Send, {LShift Down}
else
Send, {LShift Up}
}
count=0
}
return
check_space:
if d
Send {space}
return
-
- Posts: 9
- Joined: 15 Dec 2016, 15:24
Re: Script for handicap gaming
I apologize for the confusion. I would like a single right-click to press the spacebar while W is being held down (using the script). In my previous message I was able to accomplish that, sort of, but the way I wrote it the spacebar would only press down every other right-click. So, after double-clicking the right mouse W is being held down. From there, a single right-click would press the spacebar, a double right-click would stop pressing W, or a triple right-click would additionally hold down left shift. I believe?ahcahc wrote:You want single right click to repeatedly press spacebar and also stop it with a single right click?
Re: Script for handicap gaming
First, what do you mean by space is not working? Did it not send space after single right-click? Or sending space send, {space} has no effect ingame? Have you tried replacing send, {space} with send, %A_Space% , sendevent, %A_Space% or sendevent, {space}?scratchlaw wrote:it seems like the only problem is that space is not working.
This is what my first answer does:
single right-click = press and release spacebar once
double right-click = press and hold w (toggle)
tipple right-click = press and hold LShift (toggle)
They work independent of each other. Meaning a single rclick will press spacebar no matter what is the state of w or LShift and w or Lshift will toggle pressing down or up no matter what the states of the other keys were.
So you want single right-click to press spacebar only if w is held down and a single-right-click alone does not do anyhting?scratchlaw wrote: I would like a single right-click to press the spacebar while W is being held down (using the script). In my previous message I was able to accomplish that, sort of, but the way I wrote it the spacebar would only press down every other right-click. So, after double-clicking the right mouse W is being held down. From there, a single right-click would press the spacebar, a double right-click would stop pressing W, or a triple right-click would additionally hold down left shift. I believe?
And tripple right-click would hold left shift only if w is held down?
Code: Select all
count:=b:=c:=0
SetTimer, check, 20
*^!x:: ;ctrl alt x
Send, {w up}
Send, {LShift Up}
ExitApp
;#IfWinActive <insert game title here>
*RButton::
txt:=A_TimeSincePriorHotkey
if (A_TimeSincePriorHotkey <= 500) ;maximum of 500ms between rclicks to inrease the count
count++
else
count=1
if count > 3
count=3
st := A_TickCount
return
check:
ToolTip, Time between Right Clicks: %txt%ms`nRight Click count: %count%`nw down: %b%`nLShitf down: %c%
if ( (A_TickCount - st) >= 500) ;500ms or more after the last rclick it will take action
{
if (count = 1 and b)
send, {Space}
else if count = 2
{
b:=!b
if b
Send, {w Down}
else
Send, {w up}
}
else if count = 3
{
c:=!c
if (c and b)
Send, {LShift Down}
else
Send, {LShift Up}
}
count=0
}
return
-
- Posts: 9
- Joined: 15 Dec 2016, 15:24
Re: Script for handicap gaming
Thanks for the clarifying questions. That is correct, space was not working in game. I tried those other configurations and they also did not work. For your other question, it's okay if they work independently of each other. I did not think about that at first, but it's perfectly fine. Probably better in fact.ahcahc wrote:First, what do you mean by space is not working? Did it not send space after single right-click? Or sending space send, {space} has no effect ingame? Have you tried replacing send, {space} with send, %A_Space% , sendevent, %A_Space% or sendevent, {space}?scratchlaw wrote:it seems like the only problem is that space is not working.
This is what my first answer does:
single right-click = press and release spacebar once
double right-click = press and hold w (toggle)
tipple right-click = press and hold LShift (toggle)
They work independent of each other. Meaning a single rclick will press spacebar no matter what is the state of w or LShift and w or Lshift will toggle pressing down or up no matter what the states of the other keys were.
So you want single right-click to press spacebar only if w is held down and a single-right-click alone does not do anyhting?scratchlaw wrote: I would like a single right-click to press the spacebar while W is being held down (using the script). In my previous message I was able to accomplish that, sort of, but the way I wrote it the spacebar would only press down every other right-click. So, after double-clicking the right mouse W is being held down. From there, a single right-click would press the spacebar, a double right-click would stop pressing W, or a triple right-click would additionally hold down left shift. I believe?
And tripple right-click would hold left shift only if w is held down?
Code: Select all
count:=b:=c:=0 SetTimer, check, 20 *^!x:: ;ctrl alt x Send, {w up} Send, {LShift Up} ExitApp ;#IfWinActive <insert game title here> *RButton:: txt:=A_TimeSincePriorHotkey if (A_TimeSincePriorHotkey <= 500) ;maximum of 500ms between rclicks to inrease the count count++ else count=1 if count > 3 count=3 st := A_TickCount return check: ToolTip, Time between Right Clicks: %txt%ms`nRight Click count: %count%`nw down: %b%`nLShitf down: %c% if ( (A_TickCount - st) >= 500) ;500ms or more after the last rclick it will take action { if (count = 1 and b) send, {Space} else if count = 2 { b:=!b if b Send, {w Down} else Send, {w up} } else if count = 3 { c:=!c if (c and b) Send, {LShift Down} else Send, {LShift Up} } count=0 } return
Re: Script for handicap gaming
Using the script from my first answer try replacing
with
or with
Code: Select all
if count = 1
send, {Space}
Code: Select all
if count = 1
send, {Space Down}{Space Up}
Code: Select all
if count = 1
{
Send, {Space Down}
sleep, 100
Send, {Space Up}
}
Who is online
Users browsing this forum: No registered users and 68 guests