Hello,
I want to use the "Shift" modifier to assign 2 functions to every Button, since this is faster for me and I am used to it from many other games I play.
MWO Settings and the actionmaps.xml file did not help me, so I tried AutoHotkey
Scrips like
if (GetKeyState("Shift", "P"))
{
if (GetKeyState("LButton", "P"))
{
Send {1 down}
Sleep 20
Send {1 up}
Return
}
}
do work, but MWO executes both functions, since the pressed Button is not hidden from it.
Rebindings like
~+LButton::
Send {1 down}
Sleep 20
Send {1 up}
Return
do work fine outside of MWO, but inside there is strange behaviour:
- only the first LButton after Shift is recognized, I have to release and press shift repeatedly
- sometimes 1 gets repeated over and over long after I released all buttons/keys
Does anybody have an Idea how to simply or complexly use "Shift" as a modifier for my Mousebuttons/Keys?
Regards,
Taxxian


Autohotkey Help Needed
Started by Taxxian, Feb 22 2016 12:58 AM
7 replies to this topic
#1
Posted 22 February 2016 - 12:58 AM
#2
Posted 22 February 2016 - 01:02 AM
I wish I can help you with that. However, considering the way their bindings are set up, I don't think you can avoid the two functions occurring simultaneously problem.
#3
Posted 22 February 2016 - 03:48 AM
Try this:
Also, MWO will probably not recognize input from AHK unless the AHK script is running as Admin (Right click script, run as admin)
#singleinstance force SetKeyDelay, 0, 50 ; IMPORTANT! MWO will not recognize keys held for <50ms ~LButton::1 ~+LButton::2
Also, MWO will probably not recognize input from AHK unless the AHK script is running as Admin (Right click script, run as admin)
#4
Posted 22 February 2016 - 09:55 AM
Also, note that the line
Will not send 2, but would send " (At least on a UK keyboard as " is Shift+2).
If the game did not recognize it as a keypress of the 2 key, you could change this to:
Also, when remapping the Left Mouse button, it can be a pain for the remap to be always active (eg you click in your text editor and it types 1).
To avoid that, you can wrap the hotkey mappings in an #ifwinactive block, like so:
Finally, you probably need the ~ before LButton, as this tells AHK to not "block" the function of the Left Mouse button. MWO may still be able to "see" LMB being pressed even if AHK tries to block it, but if it can't, you would need the ~ else you would not be able to click on anything with the mouse in MWO.
Bear in mind though that if LMB is bound to weapon group 1 in AHK, you may be firing weapon group 1 twice (Once as a result of it seeing LMB go down, once as a result of it sending 1)
~+LButton::2
Will not send 2, but would send " (At least on a UK keyboard as " is Shift+2).
If the game did not recognize it as a keypress of the 2 key, you could change this to:
~+LButton:: Send {Shift up}{2} return
Also, when remapping the Left Mouse button, it can be a pain for the remap to be always active (eg you click in your text editor and it types 1).
To avoid that, you can wrap the hotkey mappings in an #ifwinactive block, like so:
#singleinstance force SetKeyDelay, 0, 50 ; IMPORTANT! MWO will not recognize keys held for <50ms #IfWinActive ahk_class CryENGINE ~LButton::1 ~+LButton:: Send {Shift Up}{2} return #IfWinActive
Finally, you probably need the ~ before LButton, as this tells AHK to not "block" the function of the Left Mouse button. MWO may still be able to "see" LMB being pressed even if AHK tries to block it, but if it can't, you would need the ~ else you would not be able to click on anything with the mouse in MWO.
Bear in mind though that if LMB is bound to weapon group 1 in AHK, you may be firing weapon group 1 twice (Once as a result of it seeing LMB go down, once as a result of it sending 1)
Edited by evilC, 22 February 2016 - 10:01 AM.
#5
Posted 23 February 2016 - 01:21 AM
Thanks for your help!
Unfortunately it does not work...
Yesterday I have done this:
I did no longer try to remap LButton because of the reasons you mentioned.
Still: pressing "Shift+AnyButton" executes everything mapped to "AnyButton" while ingame...
Btw: MWO does not care if I send "1" or "!" and so on so that makes it easier.
Is there another way to hide a Button from MWO but "~"?
PS: For me "1" is WG3, beeing WG1 makes no sense, thats already on "LButton" .
PPS: Ah now I see the problem, it is unable to hide "RButton" from MWO so I simply dont use "RButton" in the MWO settings and bind WG2 to to some keyboard key... then I rebind "RButton" to 2 different keys via Autohotkey and is should be done since "RButton" no longer needs to be hidden... Only problem would be that I cant play without the script anymore, but thats ok I think. Ill try that tonight.
Unfortunately it does not work...
Yesterday I have done this:
#NoEnv #Warn #singleinstance force SendMode Input ;SendMode Play ; Games Compatibility. #InstallMouseHook #InstallKeybdHook SetKeyDelay, 0, 50 #IfWinActive, ahk_class CryENGINE ~RButton::RButton ~+RButton::1 ~MButton::MButton ~+MButton::2 ... ... <more remaps> ... #IfWinActive
I did no longer try to remap LButton because of the reasons you mentioned.
Still: pressing "Shift+AnyButton" executes everything mapped to "AnyButton" while ingame...
Btw: MWO does not care if I send "1" or "!" and so on so that makes it easier.
Is there another way to hide a Button from MWO but "~"?
PS: For me "1" is WG3, beeing WG1 makes no sense, thats already on "LButton" .
PPS: Ah now I see the problem, it is unable to hide "RButton" from MWO so I simply dont use "RButton" in the MWO settings and bind WG2 to to some keyboard key... then I rebind "RButton" to 2 different keys via Autohotkey and is should be done since "RButton" no longer needs to be hidden... Only problem would be that I cant play without the script anymore, but thats ok I think. Ill try that tonight.
Edited by Taxxian, 23 February 2016 - 01:29 AM.
#6
Posted 23 February 2016 - 11:05 AM
Why are you doing this?
You don't need the first line, you don't need to remap MButton to itself...
~ Doesn't hide buttons from the game, it does the opposite
Though as I mentioned, AHK cannot stop the game from seeing the mouse buttons, so the ~ prefix is pointless in this case.
~MButton::MButton ~+MButton::2
You don't need the first line, you don't need to remap MButton to itself...
~ Doesn't hide buttons from the game, it does the opposite
MButton::1 ; Remaps MButton to 1, tries to stop game from seeing MButton ~LButton::2 ; Remaps LButton to 1, does not try to stop things from seeing LButton
Though as I mentioned, AHK cannot stop the game from seeing the mouse buttons, so the ~ prefix is pointless in this case.
#7
Posted 24 February 2016 - 12:48 AM
The first was only a placeholder, commenting it out would have been the proper way to go and i actually misread the ~ description, thought it the other way around.
But it does not matter I already got it to work, My 3 Mouse-Buttons do control 4 Weapons Groups and "Toggle Max Zoom" now. :-)
Thanks a lot for the help especially from my left hand, which never has to leave WASD ever again while playing MWO^^
But it does not matter I already got it to work, My 3 Mouse-Buttons do control 4 Weapons Groups and "Toggle Max Zoom" now. :-)
Thanks a lot for the help especially from my left hand, which never has to leave WASD ever again while playing MWO^^
#8
Posted 24 February 2016 - 11:08 AM
You may also be interested in a new project that I am working on called UCR.
UCR is a GUI application written in Autohotkey that allows the end-user to load a number of Autohotkey scripts as "plugins" and configure the inputs and outputs, and to group those plugins into profiles, along with being able to swap the active profile with hotkeys.
UCR is written with two main audiences in mind: Gamers and people with physical disabilities that limit the number of buttons that they can use.
You can get more information and download the app from here:
https://autohotkey.c...hp?f=19&t=12249
UCR is a GUI application written in Autohotkey that allows the end-user to load a number of Autohotkey scripts as "plugins" and configure the inputs and outputs, and to group those plugins into profiles, along with being able to swap the active profile with hotkeys.
UCR is written with two main audiences in mind: Gamers and people with physical disabilities that limit the number of buttons that they can use.
You can get more information and download the app from here:
https://autohotkey.c...hp?f=19&t=12249
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users