Jump to content

Auto Hotkey Help For Macro Users.


35 replies to this topic

#1 Koniving

    Welcoming Committee

  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • The Guide
  • The Guide
  • 23,384 posts

Posted 31 May 2013 - 02:45 PM

Solved! Title changed to let others use it for help. Check below for the hotkey scripts I use, and vids of them in action!

Spoiler

Edited by Koniving, 03 June 2013 - 11:23 AM.


#2 Wintersdark

    Member

  • PipPipPipPipPipPipPipPipPipPipPip
  • 13,375 posts
  • Google+: Link
  • Twitter: Link
  • LocationCalgary, AB

Posted 31 May 2013 - 03:04 PM

Good luck. I'm a devoted AutoHotkey fan, and while I can use it for chat macros, I've never been able to build gameplay macros with it in MWO (even with the hooks, running as admin, etc), they just don't work.

Admittedly, I just gave up and made mouse macros (gaming mouse)instead, but I'm quite proficient with AHK.

#3 Koniving

    Welcoming Committee

  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • The Guide
  • The Guide
  • 23,384 posts

Posted 31 May 2013 - 03:08 PM

View PostWintersdark, on 31 May 2013 - 03:04 PM, said:

Good luck. I'm a devoted AutoHotkey fan, and while I can use it for chat macros, I've never been able to build gameplay macros with it in MWO (even with the hooks, running as admin, etc), they just don't work.

Admittedly, I just gave up and made mouse macros (gaming mouse)instead, but I'm quite proficient with AHK.

You don't know how to assign the macro to run when pressing a specific key?

I'm hoping someone knows that.

Unfortunately I'm totally new to macros. I don't like it being on the middle mouse button. I have a new 3 AC/2, LB-10, twin MG Jager. I can't use left/right mouse + middle at the same time.

Edited by Koniving, 31 May 2013 - 03:44 PM.


#4 scJazz

    Member

  • PipPipPipPipPipPipPipPip
  • 1,668 posts
  • LocationNew London, CT

Posted 31 May 2013 - 04:22 PM

*sniff* I smell troll :) :(

#5 Mr Friday

    Member

  • PipPipPip
  • Bad Company
  • Bad Company
  • 63 posts
  • LocationYorkshire, England

Posted 31 May 2013 - 05:49 PM

AutoHotKey uses really simple syntax, so editing that script is as simple as changing these 2 parts:

MButton::

This line means everything after the '::' will run when everything before it is pressed. In this case 'MButton' refers to the middle mouse button. You can find a total list of keys AHK will use here. For instance, if we wanted to change it to 'V', we'd type:

v::

For Alt we'd use on of these for Either, Left or Right Alt respectively:

Alt::
LAlt::
RAlt::

You can also combine keys by listing them together or after each other:

vb::
   // This triggers when both V and B are pressed together.

V::
B::
   // This triggers when either V or B are pressed.


One final part for this line is modifiers. In other words allowing the code to detect Shift+V, Alt+V and Ctrl+V or any combination of them. The idea is to add a special character (or any combination of them) to the begining of the line. The characters are all here, but I'll list the most important.

! = Alt
^ = Control
+ = Shift

To use them you'd put something like this (for Ctrl+Shift+V):

^+V::

The other part you'll need to change is in the line directly below the last one.

while GetKeyState("MButton","P")

This states that anything between the '{ }' will repeat for as long as the 'MButton' is 'P'ressed. You'll notice that the speechmarked text is the same as the button that triggers the macro. Change that to the driving key,so V or Alt or whatever you choose. Don't however put any modifiers in.

So for the Ctrl+Shift+V key, you'd want:

^+V::
   while GetKeyState("V","P")

I will now give one word of warning. AHK will capture any keys you hotkey. This will stop MWO from knowing that the key was ever pressed. Don't stick the macro on anything you want MWO to access as well. This includes when typing in ingame chat. Don't want the V key to start inputting characters into the chat bar.

You can somewhat cirumvent this by using the ~ modifier. This will allow MWO to access the keypress / release events as well as AHK, but the macro will still trigger regardless.

I can post an AHK script that will allow macros to avoid this flaw if you want.

Edited by Mr Friday, 31 May 2013 - 05:52 PM.


#6 Wintersdark

    Member

  • PipPipPipPipPipPipPipPipPipPipPip
  • 13,375 posts
  • Google+: Link
  • Twitter: Link
  • LocationCalgary, AB

Posted 31 May 2013 - 08:29 PM

Here we go, finally, I could clean up the terrible mess I made. Here's an example with the middle mouse button changed to F1, and the macro set to only trigger in Mechwarrior Online, so F1 works as usual everywhere else.

Spoiler


The significant difference is that F1 has replaces both instances of MButton, so this will trigger on a press of F1 instead of the middle mouse button. See Mr. Friday's post for more detail on what can be used as a trigger.

The other change is the addition of "#IfWinActive ahk_class CryENGINE"

That tells AHK to only apply the following macros to Mechwarrior Online, so it won't interfere with other programs.

#7 Koniving

    Welcoming Committee

  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • The Guide
  • The Guide
  • 23,384 posts

Posted 01 June 2013 - 11:12 AM

View PostMr Friday, on 31 May 2013 - 05:49 PM, said:

Info!


So, say if I were to want to use Left CTRL.. I would put it in as..

Spoiler


Or would it be

Spoiler

Because I noticed it's Down and not Pressed in many cases.

#8 Koniving

    Welcoming Committee

  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • The Guide
  • The Guide
  • 23,384 posts

Posted 01 June 2013 - 11:20 AM

Actually figured it out! Thank you.

Both of these use Left CTRL, which is also mouse button under my ring finger.
I use this for the LB10, MG, AC/2 Jager. It's set to fire the AC/2s in groups 3, 4, and 5. My Shotgun fires on group 1, and the MGs are in the comfortable to hold group 2.

Spoiler


This second one I use in the new AC/5, AC/2 build I run, which evolved from an UAC/5 AC/2 build. This one is rigged to fire slower to compensate for heat issues.
Spoiler


Videos of results will be posted sometime today!

Edited by Koniving, 03 June 2013 - 08:13 AM.


#9 Wintersdark

    Member

  • PipPipPipPipPipPipPipPipPipPipPip
  • 13,375 posts
  • Google+: Link
  • Twitter: Link
  • LocationCalgary, AB

Posted 01 June 2013 - 11:31 AM

Next, adapt this to macro Backspace:: to work in a similar way, sending Backspace down, a very short delay, then backspace up in the same sort of while loop. This will allow you to hold backspace to delete chat text quickly. I'd copy and paste mine, but I'm at work :)

#10 Mr Friday

    Member

  • PipPipPip
  • Bad Company
  • Bad Company
  • 63 posts
  • LocationYorkshire, England

Posted 01 June 2013 - 12:08 PM

Lets be even more helpful! Heres a script containing an easy toggle to check if we're chatting or not ('cause someone will want it somewhere), a 'quick fire' backspace hack, and a few extra lines that might be helpful. Mainly these bits:

SetTitleMatchMode, 2
DetectHiddenWindows, On
#IfWinActive MechWarrior Online


An alternative to the "ahk_class CryEngine" restrictor that only targets MWO instead of all CryEngine games.

Full script~

Spoiler


#11 Koniving

    Welcoming Committee

  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • The Guide
  • The Guide
  • 23,384 posts

Posted 01 June 2013 - 12:36 PM

Vids of them in use! With Mechwarrior 2 music.

Twin AC/2, twin AC/5 rig. Build info coming soon. (Second Vid Added)
Caustic Valley Fire Support Lance.

More in spoiler!
Spoiler



LB10, 3 AC/2, twin MG rig. Build info coming soon.
Taken before the macro was fixed.

Spoiler


Note multiple videos will be provided for both builds.

Edited by Koniving, 04 June 2013 - 06:59 PM.


#12 DireBloodWolf

    Rookie

  • Bridesmaid
  • 5 posts

Posted 02 June 2013 - 05:02 PM

I'm trying to get autohotkey to work for mapping the scroll wheel, and it is just not working. can someone tell me what i'm doing wrong:

SendMode Input 
 
#InstallMouseHook
#InstallKeyBDHook
 
 
WheelUp::
        Send {z }
 
return
 
WheelRight::
        Send {5 }
 
return
 
WheelLeft::
        Send {6 }
 
return


It works in notepad but not in MWO.

#13 Wintersdark

    Member

  • PipPipPipPipPipPipPipPipPipPipPip
  • 13,375 posts
  • Google+: Link
  • Twitter: Link
  • LocationCalgary, AB

Posted 02 June 2013 - 05:05 PM

View PostMr Friday, on 01 June 2013 - 12:08 PM, said:

Lets be even more helpful! Heres a script containing an easy toggle to check if we're chatting or not ('cause someone will want it somewhere), a 'quick fire' backspace hack, and a few extra lines that might be helpful. Mainly these bits:

SetTitleMatchMode, 2
DetectHiddenWindows, On
#IfWinActive MechWarrior Online


An alternative to the "ahk_class CryEngine" restrictor that only targets MWO instead of all CryEngine games.


Hawt. Probably the title match mode there that fixes it. I'd originally used Mechwarrior Online with the window title, but it was very inconsistent - would work sometimes, and not others, so I just went to window class (as I'm not playing other CryEngine games) which has worked quite a bit better for me.

Why detecthiddenwindows?

Also, having T or Y toggle a chat variable is pretty clever, I hadn't even considered it. Would remove the necessity to tap backspace very quickly to toggle chainfire without double-toggling it :D

#14 Wintersdark

    Member

  • PipPipPipPipPipPipPipPipPipPipPip
  • 13,375 posts
  • Google+: Link
  • Twitter: Link
  • LocationCalgary, AB

Posted 02 June 2013 - 05:08 PM

View PostDireBloodWolf, on 02 June 2013 - 05:02 PM, said:

I'm trying to get autohotkey to work for mapping the scroll wheel, and it is just not working. can someone tell me what i'm doing wrong:


It works in notepad but not in MWO.


I'm still working on why this is, but it *seems* to me that you can only load one script with keybd/mouse hooks. After a boot, I can load autohotkey and a script, and it'll work fine in MWO. However, if I start editing the script, closing the existing instance and reloading it, the script will no longer work in MWO (though it WILL work elsewhere without a #ifwinactive lock). Could be a matter of having the script already running before launching MWO, too. I'm not really sure, but I know I frequently have issues where my AHK scripts just won't function in MWO but will function outside just fine, as if I didn't have the keybd/mouse hooks in there.

#15 Koniving

    Welcoming Committee

  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • The Guide
  • The Guide
  • 23,384 posts

Posted 02 June 2013 - 06:58 PM

Actually I can edit the script, save the notepad file, then tell autohotkey to reload the script, and flip right back to the game in the middle of a match. I did so several times in the macro-testing videos using energy weapons, the cuts from pausing to go do it and coming back are pretty obvious.

However I never put in anything checking to see if there's a specific program running or anything of the sort. I confess I haven't put those lines in.

#16 Wintersdark

    Member

  • PipPipPipPipPipPipPipPipPipPipPip
  • 13,375 posts
  • Google+: Link
  • Twitter: Link
  • LocationCalgary, AB

Posted 03 June 2013 - 07:26 AM

View PostKoniving, on 02 June 2013 - 06:58 PM, said:

Actually I can edit the script, save the notepad file, then tell autohotkey to reload the script, and flip right back to the game in the middle of a match. I did so several times in the macro-testing videos using energy weapons, the cuts from pausing to go do it and coming back are pretty obvious.

However I never put in anything checking to see if there's a specific program running or anything of the sort. I confess I haven't put those lines in.

Yeah, even without those lines, AHK is very inconsistent for me in MWO. Works fine in everything else, but in MWO... It's unreliable. Quite frustrating, really - I suspect Windows 8 has a role in my troubles (because it often does) but I've been unable to reliably reproduce the problems. It *always* works in everything else, and just sometimes works in MWO... but it seems almost random. Frustrating.

#17 Koniving

    Welcoming Committee

  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • The Guide
  • The Guide
  • 23,384 posts

Posted 03 June 2013 - 07:34 AM

Tried administrator mode? I had to use it. Just a thought. I know this sounds noobish since I couldn't get it to work in MWO at all without it.

Edited by Koniving, 03 June 2013 - 07:34 AM.


#18 Wintersdark

    Member

  • PipPipPipPipPipPipPipPipPipPipPip
  • 13,375 posts
  • Google+: Link
  • Twitter: Link
  • LocationCalgary, AB

Posted 03 June 2013 - 07:47 AM

View PostKoniving, on 03 June 2013 - 07:34 AM, said:

Tried administrator mode? I had to use it. Just a thought. I know this sounds noobish since I couldn't get it to work in MWO at all without it.

Yeah. I always run AHK as admin, or it won't work at all with most programs.

Edited by Wintersdark, 03 June 2013 - 07:47 AM.


#19 Koniving

    Welcoming Committee

  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • The Guide
  • The Guide
  • 23,384 posts

Posted 03 June 2013 - 07:54 AM

I don't know. Mine runs extremely well with changes made inside a match. If you find me powered down in a match but I haven't fired a shot, the reason why is I'm fixing my macro as I change it every time I change a mech.

#20 zraven7

    Member

  • PipPipPipPipPipPipPipPip
  • 1,207 posts
  • LocationDuluth, Georgia

Posted 03 June 2013 - 08:00 AM

View PostscJazz, on 31 May 2013 - 04:22 PM, said:

*sniff* I smell troll ;) :D

Dude, Kon is one of the most helpful members of the community here. He's really not a troll.





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users