Gauss Overlay Macro

Thread in 'MechWarrior Online' started by ProtoformX, Jun 10, 2014.

  1. Michael

    Michael Grand Poobah

    4,835
    829
    234
    This has been argued before when I posted the Auto Hotkey scripts/settings for AC macros as well as PPC/AC20 timing macros for mouse clicks etc. PGI never contacted me in regards to the matter and I happen to know two of the individuals who frequent this site complained about them.

    I wouldn't sweat it.

    Also, posting GM conversations is a no no.
     
  2. ProtoformX

    ProtoformX Active Member

    84
    3
    12
    PGI has not contacted me. The script has been restored to the original post.
     
    WVAnonymous likes this.
  3. MadBONOBO

    MadBONOBO New Member

    4
    0
    1
    For me it kind of works, but doesn't always fire the PPC linked to the Gauss, seems there's only a short window of time when they fire both togheter, but if I hold the charge longer and fire when it's about to fade only gauss fires....why ?

    also there's no GUI nor sounds is this normal now ? (1680*1050)

    EDIT: ok I realized what happens when only gauss fires, it's when I press F too or when I start charging before the cooldown is gone, any way to fix it?
     
  4. ProtoformX

    ProtoformX Active Member

    84
    3
    12
    Yeah, it seems to have a problem when certain other keys or actions are engaged(try holding shift for arm lock for instance; the PPC's just wont fire). Also, the charge window is linked to a sleep timer as the progress bar loads. Depending on how fast your computer is, it might go too fast or too slow; hence your problem linking the PPC's. I have a feeling your CPU is a touch faster than mine. I am working on resolving both of these issues!

    There's no sounds included; just what's built into MWO. I haven't tried 1680x1050, but I think I may have an old monitor that supports it, so I'll try it out. The GUI should show up when you're in a match, but my pixel checker is probably looking in the wrong place for the "down arrow" on the targeting computer's compass(that's how I check if you're in a match to display the GUI). That's a major caveat of working with multiple resolutions. I'm trying to find a way to remedy this for all resolutions. Basically I either need to recode my pixel checker to do some math with your game's resolution, OR give you a tool that lets you place a box over the described "down arrow" so my program always knows where to look via your user input.

    Unfortunately I'm new to the AutoHotkey stuff, so there's probably some features I just don't know about that would make this work a lot better. It's a fun project though, and it actually helps me learn for work(AHK can do a ton for you at work), so I'll perfect the script soon.
    Since the GUI isn't working for you, you may want to look at the original AHK script called "GaussBeeps" until I can get this working for you! It's the same thing, but it uses actual timers(rather than looped sleep timers, so it'll work correctly for you) and beeps instead of a visual overlay.


    GaussBeeps
    Code:
    #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
    #Warn  ; Recommended for catching common errors.
    SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
    SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
    #singleinstance Force
    ;Set gauss to right mouse group,  ppc to group 6 (6 key).  hold right mouse to charge.
    ;firing window marked with beeps.  release right mouse to fire.  PPC will only fire in the gauss firing window.  
    ;Additional beep indicates recycle complete.
    
    Rbutton::
    settimer, gCharge, 750
    Charging := 1
    return
    
    Rbutton up::
    settimer, gCharge, off
    settimer, gWindow, off
    if ((Charging == 0) and (charged == 1)) {
    settimer, recycle, 4000
    send, {6 down}
    sleep, 25
    send {6 up}
    }
    charged := 0
    charging := 0
    return
    
    GCharge:
    settimer, gCharge, off
    settimer gWindow, 1250
    charged := 1
    Charging := 0
    soundbeep , 1000, 50
    return
    
    gWindow:
    settimer gWindow, off
    charged := 0
    soundbeep , 1000, 50
    soundbeep , 500, 150
    return
    
    recycle:
    settimer, recycle, off
    soundbeep, 2000, 100
    return
     
  5. ProtoformX

    ProtoformX Active Member

    84
    3
    12
    I spent a couple hours rewriting portions of the script for timing. I've also tweaked it for 1680x1050. I think you'll find it acceptable now. Let me know if you continue to have trouble, and keep watching here for further updates.
     
  6. MadBONOBO

    MadBONOBO New Member

    4
    0
    1
    with this version I see the graphical part when launching the patcher but not ingame and it doesn't shot togheter the PPCs with the gauss so I'm still using the first one you posted :)

    even if it has some bugs it still makes the gauss viable so thanks if you can fix it, if not still great help for me !
     
  7. SniperCzar

    SniperCzar Well-Known Member

    149
    14
    28
    Been meaning to write one of these for a long time, but I've been lazy.

    One of the things I started on but never finished was adjusting for the projectile speed difference between PPCs and Gauss via page up/page down and visual feedback via overlay (100/200/300m)

    I think the math was something like 3ms of delay to hold back the Gauss for every 20m of travel on the PPCs.
     
  8. ProtoformX

    ProtoformX Active Member

    84
    3
    12
    Doh! There must be an issue with a color difference between our monitors(or something I'm missing right now). I'm going to have to build a tool that lets you select the color and the location of that compass down arrow. Speaking of; the Clan HUD is a different color, meaning you'll need to be able to select two different colors.


    I'm really puzzled why the PPC's aren't releasing for you. I'll see if I can find any issue. This is a stupid question, but your PPC's were in group 6 right? I'm sorry to say I don't intend on putting any more work in on this project this weekend. However, I'll be back on it next week.


    [quote author=SniperCzar link=topic=6829.msg45120#msg45120 date=1402770424]
    Been meaning to write one of these for a long time, but I've been lazy.

    One of the things I started on but never finished was adjusting for the projectile speed difference between PPCs and Gauss via page up/page down and visual feedback via overlay (100/200/300m)

    I think the math was something like 3ms of delay to hold back the Gauss for every 20m of travel on the PPCs.
    [/quote]
    Nice! You're welcome to improve on the project if you're interested. Obviously you'd be listed in the credits for your work. Even if you just want to work on the fun bits like that. If not, that's good information to know if I ever decide to advance the script to that point, so thanks!


    FYI, if you do decide to add this to the script, it'll go somewhere under the 'Rbutton up' section. I'm guessing you'd call a 3ms increment timer based on target distance. Reading the distance off the screen could be rather difficult, but I'm not sure; I've never tried it:
    Code:
    Rbutton up::
    settimer, gWindow, off
    if ((Charging == 0) and (charged == 1))
    {
    send, {6 down}
    sleep, 25
    send {6 up}
    Recycling := 1
    settimer, gRecycle, 185
    MyIndex3 := 0
    GuiControl, +CFACC2E, MyProgress3
    GuiControl,, MyProgress3, %MyIndex3%
    }
    charged := 0
    charging := 0
    MyIndex1 := 0
    MyIndex2 := 100
    GuiControl,, MyProgress1, %MyIndex1%
    GuiControl,, MyProgress2, %MyIndex2%
    Return
     
  9. MadBONOBO

    MadBONOBO New Member

    4
    0
    1
    Yes, I put them in Group 6 infact with the other version they work for me, (always unless I press F or start recharging before the cooldown is over).

    No problem, the the most important part works with the v2 :D
     
  10. ProtoformX

    ProtoformX Active Member

    84
    3
    12
    Okay, I have an updated version for you guys to try. This one takes a different approach to turning the overlay on and off. It's not as cool as being automatic, but it should work for just about anyone.


    When you get into a match the GUI will not attempt to launch itself anymore. You'll need to press Ctrl+Alt+G(While in-game) to toggle it on and off. If you forget to toggle it off when you exit MWO the Ctrl+Alt+G combo will not be able to hide the overlay(an AutoHotkey limitation it seems). You'll either need to exit from the tray icon or use the key combo Windows+Alt+G.


    As always, let me know what problems you have. At this time, I'm not able to explain why several of you are experiencing a problem with the PPC group not firing. I'm continuing to investigate the problem. Please let me know if there's any change with this version.

    Code:
    /*
    BEGIN COMMENTS
    
    
    CREDIT:
    kuangmk11 posted a wonderful AutoHotkey macro at this link:
    http://mwomercs.com/forums/topic/134382-cant-you-just-macro-the-gauss/page__view__findpost__p__2751940
    His macro was utilized as a base to build a Gauss overlay for MWO.
    
    
    ProtoformX is the primary contributor to this project.
    
    
    INSTRUCTIONS:
    1.) Place the Gauss rifle in Weapon Group 2(Must be right mouse button).
    2.) Place the PPC's or other weapons you want to fire with the Gauss rifle in Weapon Group 6.
    3.) Launch the script and run MWO.  It doesn't matter which order you start them in.
    4.) while MWO is active, press Ctrl+Alt+G to toggle on and off the overlay.  If MWO is not active,
        instead press Windows+Alt+G to toggle.  Hold the right mouse button to charge the Gauss and 
        use it just like normal.  On release, Weapon Group 6 will also fire.  Weapon fire sync will
        work whether the overlay is active or not.
    
    
    PROGRESS BAR LEGEND:
    Lime:    Weapons reloading status.
    Blue:    Gauss charge remaining.
    Yellow:  Charge status.
    
    
    
    
    END COMMENTS
    */
    
    
    
    
    #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
    #Warn  ; Recommended for catching common errors.
    SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
    SetWorkingDir %A_ScriptDir%/B  ; Ensures a consistent starting directory.
    #singleinstance Force
    
    
    xMidScrn  := A_ScreenWidth //2
    yMidScrn  := A_ScreenHeight //2
    Gui1X     := xMidScrn - xMidScrn *.1
    Gui1Y     := yMidScrn - yMidScrn *.15
    Gui2X     := xMidScrn
    Gui2Y     := yMidScrn
    Charging  := 0
    MyIndex1  := 0
    MyIndex2  := 100
    MyIndex3  := 100
    Toggle    := 0
    Recycling := 0
    Charging  := 0
    Charged   := 0
    percent   := 0
    
    
    Gui, Destroy
    Gui, +AlwaysOnTop
    Gui, Color, Black
    Gui -Caption
    Gui +ToolWindow
    Gui, Add, Progress, vMyProgress1 h8 w130 cFACC2E Background2E2E2E xp+20 yp+130
    Gui, Add, Progress, vMyProgress2 h8 w130 c2E9AFE Background2E2E2E yp-8
    Gui, Add, Progress, Vertical vMyProgress3 h49 w8 cLime Background2E2E2E xp-22 yp-58
    Gui, Show, Y%Gui1y% X%Gui1X%, MWO_Gauss_Overlay, NoActivate, Title of Window
    WinSet, Transcolor, Black, ahk_class AutoHotkeyGUI
    GuiControl,, MyProgress2, %MyIndex2%
    GuiControl,, MyProgress3, %MyIndex3%
    Gui, Hide
    WinActivate MechWarrior Online
    Return
    
    
    ;When in Windows press Windows+Alt+G to toggle the script on and off
    #!G::
    toggle:=!toggle ;toggles up and down states. 
      if toggle
        {
        Gui, Show 
        WinActivate MechWarrior Online
        }
      Else
        {
        Gui, Hide
        }
    return
    
    
    #IfWinActive MechWarrior Online
    
    
    ;When in MWO press Ctrl+Alt+G to toggle the script on and off
    ^!G:: 
    toggle:=!toggle ;toggles up and down states. 
      if toggle
        {
        Gui, Show 
        WinActivate MechWarrior Online
        }
      Else
        {
        Gui, Hide
        }
    return
    
    
    Rbutton::
    IF (Recycling == 0)
    {
      Charging := 1
      Loop,1
      {
        Settimer, gCharge, 75
      }
    }
    Return
    
    
    Rbutton up::
    settimer, gWindow, off
    if ((Charging == 0) and (charged == 1))
    {
    send, {6 down}
    sleep, 25
    send {6 up}
    Recycling := 1
    settimer, gRecycle, 185
    MyIndex3 := 0
    GuiControl, +CFACC2E, MyProgress3
    GuiControl,, MyProgress3, %MyIndex3%
    }
    charged := 0
    charging := 0
    MyIndex1 := 0
    MyIndex2 := 100
    GuiControl,, MyProgress1, %MyIndex1%
    GuiControl,, MyProgress2, %MyIndex2%
    Return
    
    
    gCharge:
    Loop,1
    {
      GetKeyState, state, Rbutton, P
      if state = U
       break
      MyIndex1 := MyIndex1 + 11.12
      GuiControl,, MyProgress1, %MyIndex1%
    }
    if MyIndex1 >= 100
    {
    settimer,gCharge,off
    Charging := 0
    Charged  := 1
    GuiControl, +CRed, MyProgress1 ;RED
    GuiControl, +CRed, MyProgress3 ;RED
    GuiControl,, MyProgress1, %MyIndex1%
    GuiControl,, MyProgress2, %MyIndex2%
    GuiControl,, MyProgress3, %MyIndex3%
    settimer, gWindow, 125
    }
    Return
    
    
    
    
    gWindow:
    Loop,1
    {
    GetKeyState, state, Rbutton, P
    if state = U
       break
    MyIndex2 := MyIndex2 - 11.12
    GuiControl,, MyProgress2, %MyIndex2%
    }
    if MyIndex2 = 100
    {
    settimer, gRecycle, off
    GuiControl, +CLime, MyProgress3
    GuiControl,, MyProgress3, %MyIndex3%
    Recycling := 0
    }
    Return
    
     
  11. MadBONOBO

    MadBONOBO New Member

    4
    0
    1
    much better now, I can keep F pressed or other buttons, only time it doesn't fire the ppc is when I start charging before cooldown is gone.
    guess what ? I used this to my advantage and got used to it, and when I'm overheating I can fire only the gauss like that :)

    GUI still doesn't work, pressing this combo sends me to desktop.

    EDIT : running the game in full window instead of full screen, the GUI works as well.
    I also found out that when loading only the gauss because of the cooldown overlay, the bar doesn't turn red, even more helpful I think I like it this way now :D

    Great job and thanks !
     
  12. ProtoformX

    ProtoformX Active Member

    84
    3
    12
    Woohoo! I can't tell you how happy I am to see someone else finally having the chance to enjoy this thing. :D


    Changing your MWO setting to Full Window is definitely a requirement for this overlay; nice catch. I should add that to the OP. I'm thinking I might be able to restrict input from the right mouse button until the cool-down timer completes. This way you can hold down the button before the cool-down completes and the script will still activate the PPC's. That's how the hamster on the wheel in my head says it works, anyway. :unsure:


    So here's what's coming down the pipeline:
    *Fix bug where the script doesn't engage when clicking to charge the Gauss rifle before the weapon cool-down is completed.
    *Full GUI interface to configure the overlay location, size, colors, and hotkeys. Kinda like Fire Control.
    *POSSIBLY de-synchronization of the Gauss and PPC trigger pull timing based on the distance of the target. This is going to depend on some kind of OCR software to read the target distance of the HUD. I have a feeling this is going to be tough to process quickly. We'll need to pole the distance something like 10 times a second to make it worthwhile; maybe more.
     
    WVAnonymous likes this.
  13. SniperCzar

    SniperCzar Well-Known Member

    149
    14
    28
    I was just thinking numpad entry or add/subtract range increments, displayed back to the user through an overlay HUD, but reading the HUD would be pretty awesome, too.
     
  14. The Verge

    The Verge Moderator Staff Member

    4,367
    497
    231
    You are beginning to impress me. Do not fail me.
     
  15. ProtoformX

    ProtoformX Active Member

    84
    3
    12
    A tiny glimpse into my work-in-progress. ;) [​IMG]
     
  16. Thiak

    Thiak Well-Known Member

    244
    8
    25
    wow, this is a blast to use, but surely on the edge of the eula, would be nice to have them confirm if its allowed or not

    thank you protoformx
     
  17. Eufa

    Eufa New Member

    3
    0
    2
    Hi ProtoformX,

    nice work! Hope I could use it. The versions hosted here do not activate when i press ctrl-alt-g. Autohotkey is runnig. Saying:

    Script lines most recently executed (oldest first). Press [F5] to refresh. The seconds elapsed between a line and the one after it is in parentheses to the right (if not 0). The bottommost line's elapsed time is the number of seconds since it executed.

    ---- C:\Users\Oliver\Desktop\GaussOverlay.ahk
    040: SendMode,Input
    041: SetWorkingDir,%A_ScriptDir%/B
    045: xMidScrn := A_ScreenWidth //2
    046: yMidScrn := A_ScreenHeight //2
    047: Gui1X := xMidScrn - xMidScrn *.1
    048: Gui1Y := yMidScrn - yMidScrn *.15
    049: Gui2X := xMidScrn
    050: Gui2Y := yMidScrn
    051: Charging := 0
    052: MyIndex1 := 0
    053: MyIndex2 := 100
    054: MyIndex3 := 100
    055: Toggle := 0
    056: Recycling := 0
    057: Charging := 0
    058: Charged := 0
    059: percent := 0
    062: Gui,Destroy
    063: Gui,+AlwaysOnTop
    064: Gui,Color,Black
    065: Gui,-Caption
    066: Gui,+ToolWindow
    067: Gui,Add,Progress,vMyProgress1 h8 w130 cFACC2E Background2E2E2E xp+20 yp+130
    068: Gui,Add,Progress,vMyProgress2 h8 w130 c2E9AFE Background2E2E2E yp-8
    069: Gui,Add,Progress,Vertical vMyProgress3 h49 w8 cLime Background2E2E2E xp-22 yp-58
    070: Gui,Show,Y%Gui1y% X%Gui1X%,MWO_Gauss_Overlay,NoActivate, Title of Window
    071: WinSet,Transcolor,Black,ahk_class AutoHotkeyGUI
    072: GuiControl,,MyProgress2,%MyIndex2%
    073: GuiControl,,MyProgress3,%MyIndex3%
    074: Gui,Hide
    075: Return (15.33)

    Press [F5] to refresh.

    Is the GUI-Version out yet?

    Greetings!
     
  18. Auriga

    Auriga MechSpecs Addict

    599
    5
    27
    I disagree. The info it shows up is the same u have in the lower right weapon bar, also the macro itself doesnt aim for you, it just shows u the info and sincronice weapons firing linked.

    And for the scripter: Im not planning to use the mod, but i do appreciate the effort placed in it. Thanks for expanding the comunity :)
     
  19. enileph

    enileph Star Lord

    4,203
    518
    201
    Imagine a Direwolf with this. o_O
     
  20. Solahma

    Solahma Star Lord

    2,279
    532
    197
    honestly I find no advantage with this and thus no problem. All the information you need is actually right there by your cross-hairs already. I personally have no issues timing a Gauss+PPC without aid.

    Previously I've setup a macro for LMB and RMB where you charge using the RMB, then click the LMB to fire PPC and release gauss. I timed the gauss release just right so that it hit at the exact same time as the PPC @ 600m. Then another macro bound to a button near the LMB that was timed for 400m. Trying to maximize pin-point and all.

    In the end, I didn't like changing my mouse profiles for specific builds and just time it all myself without aid.

    A macro might be a crutch for other players though, making the meta even more dangerous on the battlefield in general, which can be pretty annoying at times.
     
top-fast
top-fast
top-fast
top-fast