Skip to content

Instantly share code, notes, and snippets.

@sclark39
Last active June 23, 2018 15:45
Show Gist options
  • Select an option

  • Save sclark39/6ae9f40ec6db8dfa425eeaaf9b4dee54 to your computer and use it in GitHub Desktop.

Select an option

Save sclark39/6ae9f40ec6db8dfa425eeaaf9b4dee54 to your computer and use it in GitHub Desktop.

Revisions

  1. sclark39 revised this gist Jun 23, 2018. 1 changed file with 11 additions and 6 deletions.
    17 changes: 11 additions & 6 deletions 123Fortnite.ahk
    Original file line number Diff line number Diff line change
    @@ -10,6 +10,8 @@ Fortnite.RegisterKey( "x", "WeaponSlotKey" )
    Fortnite.RegisterKey( "q", "BuildKey" )
    Fortnite.RegisterKey( "f", "BuildKey" )
    Fortnite.RegisterKey( "MButton", "BuildKey" )
    Fortnite.RegisterKey( "5", "BuildKey" )
    Fortnite.RegisterKey( "F4", "BuildKey" )
    Fortnite.RegisterKey( "c", "EditKey" )
    Fortnite.RegisterKey( "b", "InventoryKey" )
    Fortnite.RegisterKey( "Esc", "EscKey" )
    @@ -50,8 +52,8 @@ HoldToToggleCrouch() {
    ckey := SanitizeKey( A_ThisHotkey )
    SendInput {%ckey%}
    KeyWait, % ckey
    if ( A_TimeSinceThisHotkey > 150 )
    SendInput {%ckey%}
    ;if ( A_TimeSinceThisHotkey > 150 )
    SendInput {%ckey%}
    return
    }}

    @@ -60,15 +62,18 @@ HoldToToggleCrouch() {
    ConfirmEdit() {
    ConfirmEdit:
    {
    if ( Fortnite.Editing = 1 and Fortnite.InventoryOpen = 0 )
    _editKey:= Fortnite.Keys.EditKey
    if ( Fortnite.Editing = 1 )
    {
    Critical
    Critical
    Sleep, 150
    SendInput % Fortnite.Keys.EditKey
    SendInput {%_editKey% down}
    Fortnite.EditingOff()
    Sleep, 50
    SendInput {%_editKey% up}
    if ( Fortnite.Building = 1 )
    {
    Sleep, 150
    Sleep, 50
    SendInput % Fortnite.ActiveWeapon
    Fortnite.SwitchedToWeapon( Fortnite.ActiveWeapon )
    }
  2. sclark39 revised this gist May 30, 2018. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions 123Fortnite.ahk
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@ Fortnite.RegisterKey( "q", "BuildKey" )
    Fortnite.RegisterKey( "f", "BuildKey" )
    Fortnite.RegisterKey( "MButton", "BuildKey" )
    Fortnite.RegisterKey( "c", "EditKey" )
    Fortnite.RegisterKey( "i", "InventoryKey" )
    Fortnite.RegisterKey( "b", "InventoryKey" )
    Fortnite.RegisterKey( "Esc", "EscKey" )
    Fortnite.RegisterKey( "LCtrl", "Crouch" )
    Fortnite.RegisterKey( "LButton", "PrimaryFire" )
    @@ -50,7 +50,7 @@ HoldToToggleCrouch() {
    ckey := SanitizeKey( A_ThisHotkey )
    SendInput {%ckey%}
    KeyWait, % ckey
    if ( A_TimeSinceThisHotkey > 250 )
    if ( A_TimeSinceThisHotkey > 150 )
    SendInput {%ckey%}
    return
    }}
    @@ -63,12 +63,12 @@ ConfirmEdit() {
    if ( Fortnite.Editing = 1 and Fortnite.InventoryOpen = 0 )
    {
    Critical
    Sleep, 100
    Sleep, 150
    SendInput % Fortnite.Keys.EditKey
    Fortnite.EditingOff()
    if ( Fortnite.Building = 1 )
    {
    Sleep, 100
    Sleep, 150
    SendInput % Fortnite.ActiveWeapon
    Fortnite.SwitchedToWeapon( Fortnite.ActiveWeapon )
    }
  3. sclark39 revised this gist May 27, 2018. 1 changed file with 19 additions and 18 deletions.
    37 changes: 19 additions & 18 deletions 123Fortnite.ahk
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    HotKey, IfWinActive, ahk_class Fortnite
    HotKey, IfWinActive, Fortnite

    ; Fortnite Binds
    Fortnite.RegisterKey( "1", "MeleeSlotKey" )
    @@ -19,10 +19,8 @@ Fortnite.RegisterKey( "RButton", "SecondaryFire" )
    Fortnite.RegisterKey( "XButton1", "SwapBuild" )

    ; Activate Special Custom Binds
    KeySequenceDelay := 100
    QuickPressThreshold := 250
    HotKey, % "*" Fortnite.Keys.SwapBuild, LastInv
    HotKey, % "*" Fortnite.Keys.Crouch, HoldToToggleCrouch
    HotKey, % "*$" Fortnite.Keys.Crouch, HoldToToggleCrouch
    HotKey, % "~*" Fortnite.Keys.PrimaryFire " Up", ConfirmEdit
    HotKey, % "~*" Fortnite.Keys.SecondaryFire " Up", ConfirmEdit

    @@ -49,10 +47,11 @@ LastInv() {
    HoldToToggleCrouch() {
    HoldToToggleCrouch:
    {
    SendInput % SanitizeKey( A_ThisHotkey )
    KeyWait % SanitizeKey( A_ThisHotkey )
    if ( A_TimeSinceThisHotkey > QuickPressThreshold )
    SendInput % SanitizeKey( A_ThisHotkey )
    ckey := SanitizeKey( A_ThisHotkey )
    SendInput {%ckey%}
    KeyWait, % ckey
    if ( A_TimeSinceThisHotkey > 250 )
    SendInput {%ckey%}
    return
    }}

    @@ -64,12 +63,12 @@ ConfirmEdit() {
    if ( Fortnite.Editing = 1 and Fortnite.InventoryOpen = 0 )
    {
    Critical
    Sleep, % KeySequenceDelay
    Sleep, 100
    SendInput % Fortnite.Keys.EditKey
    Fortnite.EditingOff()
    if ( Fortnite.Building = 1 )
    {
    Sleep, % KeySequenceDelay
    Sleep, 100
    SendInput % Fortnite.ActiveWeapon
    Fortnite.SwitchedToWeapon( Fortnite.ActiveWeapon )
    }
    @@ -98,13 +97,17 @@ class Fortnite
    Hotkey, % fullName, % Label
    }}

    SwitchedToWeapon(key) {
    WeaponSlotKey:
    SwitchedToWeapon(key) {
    WeaponSlotKey:
    {
    if ( !key )
    key := SanitizeKey( A_ThisHotkey )
    if ( key = "" )
    {
    Fortnite.SwitchedToWeapon(SanitizeKey( A_ThisHotkey ))
    return
    }
    if ( Fortnite.ActiveWeapon != key )
    {

    Fortnite.PreviousWeapon := Fortnite.ActiveWeapon
    Fortnite.ActiveWeapon := key
    }
    @@ -144,23 +147,21 @@ class Fortnite
    InventoryKey:
    {
    Fortnite.InventoryOpen := !Fortnite.InventoryOpen
    MsgBox % Fortnite.InventoryOpen
    return
    }}

    ClosedInventory() {
    EscKey:
    {
    Fortnite.InventoryOpen := 0
    listvars
    return
    }}
    }

    SanitizeKey(key)
    {
    key := RegExReplace(key,"[^\w]","")
    if ( StrLen(key) > 1 )
    key := "{" key "}"
    ;if ( StrLen(key) > 1 )
    ; key := "{" key "}"
    return key
    }
  4. sclark39 revised this gist May 26, 2018. 1 changed file with 16 additions and 16 deletions.
    32 changes: 16 additions & 16 deletions 123Fortnite.ahk
    Original file line number Diff line number Diff line change
    @@ -1,22 +1,22 @@
    HotKey, IfWinActive, ahk_class Fortnite

    ; Fortnite Binds
    Fortnite.RegisterKey( "1", "MeleeSlotKey" )
    Fortnite.RegisterKey( "2", "WeaponSlotKey" )
    Fortnite.RegisterKey( "3", "WeaponSlotKey" )
    Fortnite.RegisterKey( "4", "WeaponSlotKey" )
    Fortnite.RegisterKey( "z", "WeaponSlotKey" )
    Fortnite.RegisterKey( "x", "WeaponSlotKey" )
    Fortnite.RegisterKey( "MButton", "BuildKey" )
    Fortnite.RegisterKey( "q", "BuildKey" )
    Fortnite.RegisterKey( "f", "BuildKey" )
    Fortnite.RegisterKey( "i", "InventoryKey" )
    Fortnite.RegisterKey( "Esc", "EscKey" )
    Fortnite.RegisterKey( "c", "EditKey" )
    Fortnite.RegisterKey( "LCtrl", "Crouch" )
    Fortnite.RegisterKey( "LButton", "PrimaryFire" )
    Fortnite.RegisterKey( "RButton", "SecondaryFire" )
    Fortnite.RegisterKey( "XButton1", "SwapBuild" )
    Fortnite.RegisterKey( "1", "MeleeSlotKey" )
    Fortnite.RegisterKey( "2", "WeaponSlotKey" )
    Fortnite.RegisterKey( "3", "WeaponSlotKey" )
    Fortnite.RegisterKey( "4", "WeaponSlotKey" )
    Fortnite.RegisterKey( "z", "WeaponSlotKey" )
    Fortnite.RegisterKey( "x", "WeaponSlotKey" )
    Fortnite.RegisterKey( "q", "BuildKey" )
    Fortnite.RegisterKey( "f", "BuildKey" )
    Fortnite.RegisterKey( "MButton", "BuildKey" )
    Fortnite.RegisterKey( "c", "EditKey" )
    Fortnite.RegisterKey( "i", "InventoryKey" )
    Fortnite.RegisterKey( "Esc", "EscKey" )
    Fortnite.RegisterKey( "LCtrl", "Crouch" )
    Fortnite.RegisterKey( "LButton", "PrimaryFire" )
    Fortnite.RegisterKey( "RButton", "SecondaryFire" )
    Fortnite.RegisterKey( "XButton1", "SwapBuild" )

    ; Activate Special Custom Binds
    KeySequenceDelay := 100
  5. sclark39 revised this gist May 26, 2018. 1 changed file with 13 additions and 13 deletions.
    26 changes: 13 additions & 13 deletions 123Fortnite.ahk
    Original file line number Diff line number Diff line change
    @@ -1,19 +1,19 @@
    HotKey, IfWinActive, ahk_class Fortnite

    ; Fortnite Binds
    Fortnite.RegisterKey( "1", "MeleeSlotKey" )
    Fortnite.RegisterKey( "2", "WeaponSlotKey" )
    Fortnite.RegisterKey( "3", "WeaponSlotKey" )
    Fortnite.RegisterKey( "4", "WeaponSlotKey" )
    Fortnite.RegisterKey( "z", "WeaponSlotKey" )
    Fortnite.RegisterKey( "x", "WeaponSlotKey" )
    Fortnite.RegisterKey( "MButton", "BuildKey" )
    Fortnite.RegisterKey( "q", "BuildKey" )
    Fortnite.RegisterKey( "f", "BuildKey" )
    Fortnite.RegisterKey( "i", "InventoryKey" )
    Fortnite.RegisterKey( "Esc", "EscKey" )
    Fortnite.RegisterKey( "c", "EditKey" )
    Fortnite.RegisterKey( "LCtrl", "Crouch" )
    Fortnite.RegisterKey( "1", "MeleeSlotKey" )
    Fortnite.RegisterKey( "2", "WeaponSlotKey" )
    Fortnite.RegisterKey( "3", "WeaponSlotKey" )
    Fortnite.RegisterKey( "4", "WeaponSlotKey" )
    Fortnite.RegisterKey( "z", "WeaponSlotKey" )
    Fortnite.RegisterKey( "x", "WeaponSlotKey" )
    Fortnite.RegisterKey( "MButton", "BuildKey" )
    Fortnite.RegisterKey( "q", "BuildKey" )
    Fortnite.RegisterKey( "f", "BuildKey" )
    Fortnite.RegisterKey( "i", "InventoryKey" )
    Fortnite.RegisterKey( "Esc", "EscKey" )
    Fortnite.RegisterKey( "c", "EditKey" )
    Fortnite.RegisterKey( "LCtrl", "Crouch" )
    Fortnite.RegisterKey( "LButton", "PrimaryFire" )
    Fortnite.RegisterKey( "RButton", "SecondaryFire" )
    Fortnite.RegisterKey( "XButton1", "SwapBuild" )
  6. sclark39 revised this gist May 26, 2018. 1 changed file with 18 additions and 18 deletions.
    36 changes: 18 additions & 18 deletions 123Fortnite.ahk
    Original file line number Diff line number Diff line change
    @@ -1,22 +1,22 @@
    HotKey, IfWinActive, ahk_class Fortnite

    ; Fortnite Binds
    Fortnite.RegisterKey( "1", "MeleeSlotKey" )
    Fortnite.RegisterKey( "2", "WeaponSlotKey" )
    Fortnite.RegisterKey( "3", "WeaponSlotKey" )
    Fortnite.RegisterKey( "4", "WeaponSlotKey" )
    Fortnite.RegisterKey( "z", "WeaponSlotKey" )
    Fortnite.RegisterKey( "x", "WeaponSlotKey" )
    Fortnite.RegisterKey( "MButton", "BuildKey" )
    Fortnite.RegisterKey( "q", "BuildKey" )
    Fortnite.RegisterKey( "f", "BuildKey" )
    Fortnite.RegisterKey( "i", "InventoryKey" )
    Fortnite.RegisterKey( "Esc", "EscKey" )
    Fortnite.RegisterKey( "c", "EditKey" )
    Fortnite.RegisterKey( "LCtrl", "Crouch" )
    Fortnite.RegisterKey( "LButton", "PrimaryFire" )
    Fortnite.RegisterKey( "RButton", "SecondaryFire" )
    Fortnite.RegisterKey( "XButton1", "SwapBuild" )
    Fortnite.RegisterKey( "1", "MeleeSlotKey" )
    Fortnite.RegisterKey( "2", "WeaponSlotKey" )
    Fortnite.RegisterKey( "3", "WeaponSlotKey" )
    Fortnite.RegisterKey( "4", "WeaponSlotKey" )
    Fortnite.RegisterKey( "z", "WeaponSlotKey" )
    Fortnite.RegisterKey( "x", "WeaponSlotKey" )
    Fortnite.RegisterKey( "MButton", "BuildKey" )
    Fortnite.RegisterKey( "q", "BuildKey" )
    Fortnite.RegisterKey( "f", "BuildKey" )
    Fortnite.RegisterKey( "i", "InventoryKey" )
    Fortnite.RegisterKey( "Esc", "EscKey" )
    Fortnite.RegisterKey( "c", "EditKey" )
    Fortnite.RegisterKey( "LCtrl", "Crouch" )
    Fortnite.RegisterKey( "LButton", "PrimaryFire" )
    Fortnite.RegisterKey( "RButton", "SecondaryFire" )
    Fortnite.RegisterKey( "XButton1", "SwapBuild" )

    ; Activate Special Custom Binds
    KeySequenceDelay := 100
    @@ -50,8 +50,8 @@ HoldToToggleCrouch() {
    HoldToToggleCrouch:
    {
    SendInput % SanitizeKey( A_ThisHotkey )
    KeyWait, % A_ThisHotkey
    if ( A_TimeSinceFortniteHotkey > QuickPressThreshold )
    KeyWait % SanitizeKey( A_ThisHotkey )
    if ( A_TimeSinceThisHotkey > QuickPressThreshold )
    SendInput % SanitizeKey( A_ThisHotkey )
    return
    }}
  7. sclark39 revised this gist May 26, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 123Fortnite.ahk
    Original file line number Diff line number Diff line change
    @@ -120,7 +120,7 @@ class Fortnite
    }}

    SwitchedToBuild() {
    BuildKey:
    BuildKey:
    {
    Fortnite.Building := 1
    Fortnite.Editing := 0
  8. sclark39 revised this gist May 26, 2018. 1 changed file with 131 additions and 103 deletions.
    234 changes: 131 additions & 103 deletions 123Fortnite.ahk
    Original file line number Diff line number Diff line change
    @@ -1,105 +1,36 @@
    HotKey, IfWinActive, ahk_class Fortnite

    ; Track Fortnite Binds
    HotKey, ~*1, MeleeSlotKey
    HotKey, ~*2, WeaponSlotKey
    HotKey, ~*3, WeaponSlotKey
    HotKey, ~*4, WeaponSlotKey
    HotKey, ~*z, WeaponSlotKey
    HotKey, ~*x, WeaponSlotKey
    HotKey, ~*MButton, BuildKey
    HotKey, ~*q, BuildKey
    HotKey, ~*f, BuildKey
    HotKey, ~*i, InventoryKey
    HotKey, ~*Esc, EscKey
    EditKey = ~*c
    HotKey, %EditKey%, EditOn
    ; Fortnite Binds
    Fortnite.RegisterKey( "1", "MeleeSlotKey" )
    Fortnite.RegisterKey( "2", "WeaponSlotKey" )
    Fortnite.RegisterKey( "3", "WeaponSlotKey" )
    Fortnite.RegisterKey( "4", "WeaponSlotKey" )
    Fortnite.RegisterKey( "z", "WeaponSlotKey" )
    Fortnite.RegisterKey( "x", "WeaponSlotKey" )
    Fortnite.RegisterKey( "MButton", "BuildKey" )
    Fortnite.RegisterKey( "q", "BuildKey" )
    Fortnite.RegisterKey( "f", "BuildKey" )
    Fortnite.RegisterKey( "i", "InventoryKey" )
    Fortnite.RegisterKey( "Esc", "EscKey" )
    Fortnite.RegisterKey( "c", "EditKey" )
    Fortnite.RegisterKey( "LCtrl", "Crouch" )
    Fortnite.RegisterKey( "LButton", "PrimaryFire" )
    Fortnite.RegisterKey( "RButton", "SecondaryFire" )
    Fortnite.RegisterKey( "XButton1", "SwapBuild" )

    ; Activate Special Custom Binds
    KeySequenceDelay := 100
    QuickPressThreshold := 250
    HotKey, *XButton1, LastInv
    HotKey, *LCtrl, HoldToToggleCrouch
    HotKey, ~*LButton Up, ConfirmEdit
    HotKey, ~*RButton Up, ConfirmEdit
    HotKey, % "*" Fortnite.Keys.SwapBuild, LastInv
    HotKey, % "*" Fortnite.Keys.Crouch, HoldToToggleCrouch
    HotKey, % "~*" Fortnite.Keys.PrimaryFire " Up", ConfirmEdit
    HotKey, % "~*" Fortnite.Keys.SecondaryFire " Up", ConfirmEdit

    ; Tracks the state of the game
    class Fortnite
    ; Alternates between your two most recent weapon slots, and
    ; switches back to a weapon if you're on melee or build mode.
    LastInv() {
    LastInv:
    {
    static ActiveWeapon:=2
    static PreviousWeapon:=3

    static Building:=0
    static InventoryOpen:=0
    static Editing:=0
    static UsingMelee:=0

    SwitchedToWeapon(key)
    {
    if ( this.ActiveWeapon != key )
    {
    this.PreviousWeapon := this.ActiveWeapon
    this.ActiveWeapon := key
    }
    this.Building := this.UsingMelee := this.Editing := 0
    }
    SwitchedToMelee()
    {
    this.UsingMelee:=1
    }
    SwitchedToBuild()
    {
    this.Building := 1
    this.Editing := 0
    }
    EditingOn()
    {
    this.Editing := 1
    }
    EditingOff()
    {
    this.Editing := 0
    }
    ToggledInventory()
    {
    this.InventoryOpen := !this.InventoryOpen
    }
    ClosedInventory()
    {
    this.InventoryOpen := 0
    }

    }
    SanitizeKey(key)
    {
    key := RegExReplace(key,"[^\w]","")
    if ( StrLen(key) > 1 )
    key := "{" . key . "}"
    return key
    }
    Return
    WeaponSlotKey:
    Fortnite.SwitchedToWeapon( SanitizeKey( A_ThisHotkey ) )
    Return
    MeleeSlotKey:
    Fortnite.SwitchedToMelee()
    Return
    InventoryKey:
    Fortnite.ToggledInventory()
    Return
    BuildKey:
    Fortnite.SwitchedToBuild()
    Return
    EscKey:
    Fortnite.ClosedInventory()
    Return
    EditOn:
    Fortnite.EditingOn()
    Return

    ; Alternates between your two most recent weapon slots, and switches
    ; back to a weapon if you're on melee or build mode.
    LastInv:
    if ( Fortnite.Building + Fortnite.UsingMelee > 0 )
    {
    SendInput % Fortnite.ActiveWeapon
    @@ -110,23 +41,31 @@ LastInv:
    SendInput % Fortnite.PreviousWeapon
    Fortnite.SwitchedToWeapon( Fortnite.PreviousWeapon )
    }
    Return
    return
    }}

    ; Quick press will toggle crouch, long press will toggle again when you let go
    HoldToToggleCrouch:
    ; Quick press will toggle crouch, long press will toggle again
    ; when you let go
    HoldToToggleCrouch() {
    HoldToToggleCrouch:
    {
    SendInput % SanitizeKey( A_ThisHotkey )
    KeyWait, % A_ThisHotkey
    if ( A_TimeSinceThisHotkey > QuickPressThreshold )
    if ( A_TimeSinceFortniteHotkey > QuickPressThreshold )
    SendInput % SanitizeKey( A_ThisHotkey )
    Return
    return
    }}

    ; Confirm editing buildings when letting go of primary or secondary fire
    ConfirmEdit:
    ; Confirm editing buildings when letting go of primary or
    ; secondary fire
    ConfirmEdit() {
    ConfirmEdit:
    {
    if ( Fortnite.Editing = 1 and Fortnite.InventoryOpen = 0 )
    {
    Critical
    Sleep, % KeySequenceDelay
    SendInput % SanitizeKey( EditKey )
    SendInput % Fortnite.Keys.EditKey
    Fortnite.EditingOff()
    if ( Fortnite.Building = 1 )
    {
    @@ -135,4 +74,93 @@ ConfirmEdit:
    Fortnite.SwitchedToWeapon( Fortnite.ActiveWeapon )
    }
    }
    Return
    return
    }}

    ; Tracks the state of the game
    class Fortnite
    {
    static Keys:={}

    static ActiveWeapon:=2
    static PreviousWeapon:=3

    static Building:=0
    static InventoryOpen:=0
    static Editing:=0
    static UsingMelee:=0

    RegisterKey( Name, Label ) {
    {
    fullName := "~*" Name
    Fortnite.Keys[Label] := Name
    if ( IsLabel( Label ) )
    Hotkey, % fullName, % Label
    }}

    SwitchedToWeapon(key) {
    WeaponSlotKey:
    {
    if ( !key )
    key := SanitizeKey( A_ThisHotkey )
    if ( Fortnite.ActiveWeapon != key )
    {
    Fortnite.PreviousWeapon := Fortnite.ActiveWeapon
    Fortnite.ActiveWeapon := key
    }
    Fortnite.Building := Fortnite.UsingMelee := Fortnite.Editing := 0
    return
    }}

    SwitchedToMelee() {
    MeleeSlotKey:
    {
    Fortnite.UsingMelee:=1
    return
    }}

    SwitchedToBuild() {
    BuildKey:
    {
    Fortnite.Building := 1
    Fortnite.Editing := 0
    return
    }}

    EditingOn() {
    EditKey:
    {
    Fortnite.Editing := 1
    return
    }}

    EditingOff() {
    {
    Fortnite.Editing := 0
    return
    }}

    ToggledInventory() {
    InventoryKey:
    {
    Fortnite.InventoryOpen := !Fortnite.InventoryOpen
    MsgBox % Fortnite.InventoryOpen
    return
    }}

    ClosedInventory() {
    EscKey:
    {
    Fortnite.InventoryOpen := 0
    listvars
    return
    }}
    }

    SanitizeKey(key)
    {
    key := RegExReplace(key,"[^\w]","")
    if ( StrLen(key) > 1 )
    key := "{" key "}"
    return key
    }
  9. sclark39 revised this gist May 26, 2018. 1 changed file with 6 additions and 6 deletions.
    12 changes: 6 additions & 6 deletions 123Fortnite.ahk
    Original file line number Diff line number Diff line change
    @@ -13,13 +13,13 @@ HotKey, ~*f, BuildKey
    HotKey, ~*i, InventoryKey
    HotKey, ~*Esc, EscKey
    EditKey = ~*c
    HotKey, %EditKey%, EditOn

    ; Activate Special Custom Binds
    KeySequenceDelay := 100
    QuickPressThreshold := 250
    HotKey, *XButton1, LastInv
    HotKey, *LCtrl, HoldToToggleCrouch
    HotKey, %EditKey%, EditOn
    HotKey, ~*LButton Up, ConfirmEdit
    HotKey, ~*RButton Up, ConfirmEdit

    @@ -93,7 +93,10 @@ BuildKey:
    EscKey:
    Fortnite.ClosedInventory()
    Return

    EditOn:
    Fortnite.EditingOn()
    Return

    ; Alternates between your two most recent weapon slots, and switches
    ; back to a weapon if you're on melee or build mode.
    LastInv:
    @@ -118,9 +121,6 @@ HoldToToggleCrouch:
    Return

    ; Confirm editing buildings when letting go of primary or secondary fire
    EditOn:
    Fortnite.EditingOn()
    Return
    ConfirmEdit:
    if ( Fortnite.Editing = 1 and Fortnite.InventoryOpen = 0 )
    {
    @@ -135,4 +135,4 @@ ConfirmEdit:
    Fortnite.SwitchedToWeapon( Fortnite.ActiveWeapon )
    }
    }
    Return
    Return
  10. sclark39 revised this gist May 26, 2018. 1 changed file with 32 additions and 32 deletions.
    64 changes: 32 additions & 32 deletions 123Fortnite.ahk
    Original file line number Diff line number Diff line change
    @@ -15,15 +15,14 @@ HotKey, ~*Esc, EscKey
    EditKey = ~*c

    ; Activate Special Custom Binds
    KeySequenceDelay := 100
    QuickPressThreshold := 250
    HotKey, *XButton1, LastInv
    HotKey, *LCtrl, HoldToToggleCrouch
    HotKey, %EditKey%, EditOn
    HotKey, ~*LButton Up, ConfirmEdit
    HotKey, ~*RButton Up, ConfirmEdit

    ; Init is Over
    Return

    ; Tracks the state of the game
    class Fortnite
    {
    @@ -32,40 +31,40 @@ class Fortnite

    static Building:=0
    static InventoryOpen:=0
    static BuildEdit:=0
    static Melee:=0
    static Editing:=0
    static UsingMelee:=0

    SwitchToWeapon(key)
    SwitchedToWeapon(key)
    {
    if ( this.ActiveWeapon != key )
    {
    this.PreviousWeapon := this.ActiveWeapon
    this.ActiveWeapon := key
    }
    this.Building := this.Melee := this.BuildEdit := 0
    this.Building := this.UsingMelee := this.Editing := 0
    }
    SwitchToMelee()
    SwitchedToMelee()
    {
    this.Melee:=1
    this.UsingMelee:=1
    }
    SwitchToBuild()
    SwitchedToBuild()
    {
    this.Building := 1
    this.Melee := this.BuildEdit := 0
    this.Editing := 0
    }
    EditOn()
    EditingOn()
    {
    this.BuildEdit := 1
    this.Editing := 1
    }
    EditOff()
    EditingOff()
    {
    this.BuildEdit := 0
    this.Editing := 0
    }
    ToggleInventory()
    ToggledInventory()
    {
    this.InventoryOpen := !this.InventoryOpen
    }
    Esc()
    ClosedInventory()
    {
    this.InventoryOpen := 0
    }
    @@ -78,61 +77,62 @@ SanitizeKey(key)
    key := "{" . key . "}"
    return key
    }
    Return
    WeaponSlotKey:
    Fortnite.SwitchToWeapon( SanitizeKey( A_ThisHotkey ) )
    Fortnite.SwitchedToWeapon( SanitizeKey( A_ThisHotkey ) )
    Return
    MeleeSlotKey:
    Fortnite.SwitchToMelee()
    Fortnite.SwitchedToMelee()
    Return
    InventoryKey:
    Fortnite.ToggleInventory()
    Fortnite.ToggledInventory()
    Return
    BuildKey:
    Fortnite.SwitchToBuild()
    Fortnite.SwitchedToBuild()
    Return
    EscKey:
    Fortnite.Esc()
    Fortnite.ClosedInventory()
    Return

    ; Alternates between your two most recent weapon slots, and switches
    ; back to a weapon if you're on melee or build mode.
    LastInv:
    if ( Fortnite.Building + Fortnite.Melee > 0 )
    if ( Fortnite.Building + Fortnite.UsingMelee > 0 )
    {
    SendInput % Fortnite.ActiveWeapon
    Fortnite.SwitchToWeapon( Fortnite.ActiveWeapon )
    Fortnite.SwitchedToWeapon( Fortnite.ActiveWeapon )
    }
    else
    {
    SendInput % Fortnite.PreviousWeapon
    Fortnite.SwitchToWeapon( Fortnite.PreviousWeapon )
    Fortnite.SwitchedToWeapon( Fortnite.PreviousWeapon )
    }
    Return

    ; Quick press will toggle crouch, long press will toggle again when you let go
    HoldToToggleCrouch:
    SendInput % SanitizeKey( A_ThisHotkey )
    KeyWait, % A_ThisHotkey
    if ( A_TimeSinceThisHotkey > 250 )
    if ( A_TimeSinceThisHotkey > QuickPressThreshold )
    SendInput % SanitizeKey( A_ThisHotkey )
    Return

    ; Confirm editing buildings when letting go of primary or secondary fire
    EditOn:
    Fortnite.EditOn()
    Fortnite.EditingOn()
    Return
    ConfirmEdit:
    if ( Fortnite.BuildEdit = 1 and Fortnite.InventoryOpen = 0 )
    if ( Fortnite.Editing = 1 and Fortnite.InventoryOpen = 0 )
    {
    Critical
    Sleep, 100
    Sleep, % KeySequenceDelay
    SendInput % SanitizeKey( EditKey )
    Fortnite.EditOff()
    Fortnite.EditingOff()
    if ( Fortnite.Building = 1 )
    {
    Sleep, 100
    Sleep, % KeySequenceDelay
    SendInput % Fortnite.ActiveWeapon
    Fortnite.SwitchToWeapon( Fortnite.ActiveWeapon )
    Fortnite.SwitchedToWeapon( Fortnite.ActiveWeapon )
    }
    }
    Return
  11. sclark39 revised this gist May 26, 2018. 1 changed file with 18 additions and 21 deletions.
    39 changes: 18 additions & 21 deletions 123Fortnite.ahk
    Original file line number Diff line number Diff line change
    @@ -14,7 +14,7 @@ HotKey, ~*i, InventoryKey
    HotKey, ~*Esc, EscKey
    EditKey = ~*c

    ; Activate Custom Binds
    ; Activate Special Custom Binds
    HotKey, *XButton1, LastInv
    HotKey, *LCtrl, HoldToToggleCrouch
    HotKey, %EditKey%, EditOn
    @@ -71,14 +71,28 @@ class Fortnite
    }

    }

    SanitizeKey(key)
    {
    key := RegExReplace(key,"[^\w]","")
    if ( StrLen(key) > 1 )
    key := "{" . key . "}"
    return key
    }
    WeaponSlotKey:
    Fortnite.SwitchToWeapon( SanitizeKey( A_ThisHotkey ) )
    Return
    MeleeSlotKey:
    Fortnite.SwitchToMelee()
    Return
    InventoryKey:
    Fortnite.ToggleInventory()
    Return
    BuildKey:
    Fortnite.SwitchToBuild()
    Return
    EscKey:
    Fortnite.Esc()
    Return

    ; Alternates between your two most recent weapon slots, and switches
    ; back to a weapon if you're on melee or build mode.
    @@ -95,15 +109,15 @@ LastInv:
    }
    Return

    ; Quick Press will Toggle, Long Press will Toggle twice
    ; Quick press will toggle crouch, long press will toggle again when you let go
    HoldToToggleCrouch:
    SendInput % SanitizeKey( A_ThisHotkey )
    KeyWait, % A_ThisHotkey
    if ( A_TimeSinceThisHotkey > 250 )
    SendInput % SanitizeKey( A_ThisHotkey )
    Return

    ; Confirm Build on Mouse Release
    ; Confirm editing buildings when letting go of primary or secondary fire
    EditOn:
    Fortnite.EditOn()
    Return
    @@ -122,20 +136,3 @@ ConfirmEdit:
    }
    }
    Return

    ; State Tracking
    WeaponSlotKey:
    Fortnite.SwitchToWeapon( SanitizeKey( A_ThisHotkey ) )
    Return
    MeleeSlotKey:
    Fortnite.SwitchToMelee()
    Return
    InventoryKey:
    Fortnite.ToggleInventory()
    Return
    BuildKey:
    Fortnite.SwitchToBuild()
    Return
    EscKey:
    Fortnite.Esc()
    Return
  12. sclark39 revised this gist May 26, 2018. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions 123Fortnite.ahk
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    ; Track Fortnite Binds
    HotKey, IfWinActive, ahk_class Notepad
    HotKey, IfWinActive, ahk_class Fortnite

    ; Track Fortnite Binds
    HotKey, ~*1, MeleeSlotKey
    HotKey, ~*2, WeaponSlotKey
    HotKey, ~*3, WeaponSlotKey
    @@ -14,7 +14,7 @@ HotKey, ~*i, InventoryKey
    HotKey, ~*Esc, EscKey
    EditKey = ~*c

    ; Custom Binds
    ; Activate Custom Binds
    HotKey, *XButton1, LastInv
    HotKey, *LCtrl, HoldToToggleCrouch
    HotKey, %EditKey%, EditOn
  13. sclark39 revised this gist May 26, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 123Fortnite.ahk
    Original file line number Diff line number Diff line change
    @@ -112,8 +112,8 @@ ConfirmEdit:
    {
    Critical
    Sleep, 100
    Fortnite.EditOff()
    SendInput % SanitizeKey( EditKey )
    Fortnite.EditOff()
    if ( Fortnite.Building = 1 )
    {
    Sleep, 100
  14. sclark39 revised this gist May 26, 2018. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions 123Fortnite.ahk
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    ; Track Fortnite Binds
    HotKey, IfWinActive, ahk_class Fortnite
    HotKey, IfWinActive, ahk_class Notepad

    HotKey, ~*1, MeleeSlotKey
    HotKey, ~*2, WeaponSlotKey
    @@ -111,8 +111,8 @@ ConfirmEdit:
    if ( Fortnite.BuildEdit = 1 and Fortnite.InventoryOpen = 0 )
    {
    Critical
    Fortnite.EditOff()
    Sleep, 100
    Fortnite.EditOff()
    SendInput % SanitizeKey( EditKey )
    if ( Fortnite.Building = 1 )
    {
  15. sclark39 revised this gist May 26, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 123Fortnite.ahk
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    ; Track Fortnite Binds
    HotKey, IfWinActive, ahk_class Notepad
    HotKey, IfWinActive, ahk_class Fortnite

    HotKey, ~*1, MeleeSlotKey
    HotKey, ~*2, WeaponSlotKey
  16. sclark39 revised this gist May 26, 2018. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions 123Fortnite.ahk
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    ; Track Fortnite Binds
    HotKey, IfWinActive, ahk_class Fortnite
    HotKey, IfWinActive, ahk_class Notepad

    HotKey, ~*1, MeleeSlotKey
    HotKey, ~*2, WeaponSlotKey
    @@ -108,7 +108,7 @@ EditOn:
    Fortnite.EditOn()
    Return
    ConfirmEdit:
    if ( Fortnite.BuildEdit = 1 )
    if ( Fortnite.BuildEdit = 1 and Fortnite.InventoryOpen = 0 )
    {
    Critical
    Fortnite.EditOff()
  17. sclark39 revised this gist May 26, 2018. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions 123Fortnite.ahk
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,5 @@
    ; Track Fortnite Binds
    HotKey, IfWinActive, ahk_class Notepad
    ;HotKey, IfWinActive, ahk_class Fortnite
    HotKey, IfWinActive, ahk_class Fortnite

    HotKey, ~*1, MeleeSlotKey
    HotKey, ~*2, WeaponSlotKey
  18. sclark39 revised this gist May 26, 2018. 1 changed file with 78 additions and 81 deletions.
    159 changes: 78 additions & 81 deletions 123Fortnite.ahk
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,7 @@
    ; Track Fortnite Binds
    HotKey, IfWinActive, ahk_class Notepad
    ;HotKey, IfWinActive, ahk_class Fortnite

    HotKey, ~*1, MeleeSlotKey
    HotKey, ~*2, WeaponSlotKey
    HotKey, ~*3, WeaponSlotKey
    @@ -10,14 +13,18 @@ HotKey, ~*q, BuildKey
    HotKey, ~*f, BuildKey
    HotKey, ~*i, InventoryKey
    HotKey, ~*Esc, EscKey
    EditKey = ~*c

    ; Custom Binds
    HotKey, *XButton1, LastInv
    HotKey, *LCtrl, HoldToToggleCrouch
    HotKey, ~*c, EditOn
    HotKey, %EditKey%, EditOn
    HotKey, ~*LButton Up, ConfirmEdit
    HotKey, ~*RButton Up, ConfirmEdit

    ; Init is Over
    Return

    ; Tracks the state of the game
    class Fortnite
    {
    @@ -36,28 +43,17 @@ class Fortnite
    this.PreviousWeapon := this.ActiveWeapon
    this.ActiveWeapon := key
    }
    this.Building := 0
    this.Melee := 0
    this.BuildEdit := 0
    this.Building := this.Melee := this.BuildEdit := 0
    }

    SwitchToMelee()
    {
    this.Melee:=1
    }

    SwitchToBuild()
    {
    this.Building := 1
    this.Melee:=0
    this.BuildEdit := 0
    }

    ToggleInventory()
    {
    this.InventoryOpen := !this.InventoryOpen
    this.Melee := this.BuildEdit := 0
    }

    EditOn()
    {
    this.BuildEdit := 1
    @@ -66,80 +62,81 @@ class Fortnite
    {
    this.BuildEdit := 0
    }

    ToggleInventory()
    {
    this.InventoryOpen := !this.InventoryOpen
    }
    Esc()
    {
    this.InventoryOpen := 0
    this.BuildEdit := 0
    }
    }
    Return

    #IfWinActive, Fortnite
    {
    ; Alternates between your two most recent weapon slots, and switches
    ; back to a weapon if you're on melee or build mode.
    LastInv:
    if ( Fortnite.Building + Fortnite.Melee > 0 )
    {
    SendInput % Fortnite.ActiveWeapon
    Fortnite.SwitchToWeapon( Fortnite.ActiveWeapon )
    }
    else
    {
    SendInput % Fortnite.PreviousWeapon
    Fortnite.SwitchToWeapon( Fortnite.PreviousWeapon )
    }
    Return
    }

    ; Quick Press will Toggle, Long Press will Toggle twice
    HoldToToggleCrouch:
    thiskey := SubStr( A_ThisHotkey, 2 )
    SendInput {%thiskey%}
    KeyWait, % thiskey
    if ( A_TimeSinceThisHotkey > 250 )
    SendInput {%thiskey%}
    Return
    SanitizeKey(key)
    {
    key := RegExReplace(key,"[^\w]","")
    if ( StrLen(key) > 1 )
    key := "{" . key . "}"
    return key
    }

    ; Confirm Build on Mouse Release
    EditOn:
    Fortnite.EditOn()
    Return
    ConfirmEdit:
    if ( Fortnite.BuildEdit = 1 )
    ; Alternates between your two most recent weapon slots, and switches
    ; back to a weapon if you're on melee or build mode.
    LastInv:
    if ( Fortnite.Building + Fortnite.Melee > 0 )
    {
    SendInput % Fortnite.ActiveWeapon
    Fortnite.SwitchToWeapon( Fortnite.ActiveWeapon )
    }
    else
    {
    SendInput % Fortnite.PreviousWeapon
    Fortnite.SwitchToWeapon( Fortnite.PreviousWeapon )
    }
    Return

    ; Quick Press will Toggle, Long Press will Toggle twice
    HoldToToggleCrouch:
    SendInput % SanitizeKey( A_ThisHotkey )
    KeyWait, % A_ThisHotkey
    if ( A_TimeSinceThisHotkey > 250 )
    SendInput % SanitizeKey( A_ThisHotkey )
    Return

    ; Confirm Build on Mouse Release
    EditOn:
    Fortnite.EditOn()
    Return
    ConfirmEdit:
    if ( Fortnite.BuildEdit = 1 )
    {
    Critical
    Fortnite.EditOff()
    Sleep, 100
    SendInput % SanitizeKey( EditKey )
    if ( Fortnite.Building = 1 )
    {
    Fortnite.EditOff()
    Sleep, 100
    SendInput {c}
    if ( Fortnite.Building = 1 )
    {
    Sleep, 100
    SendInput % Fortnite.ActiveWeapon
    Fortnite.SwitchToWeapon( Fortnite.ActiveWeapon )
    }
    SendInput % Fortnite.ActiveWeapon
    Fortnite.SwitchToWeapon( Fortnite.ActiveWeapon )
    }
    Return


    ; State Tracking
    WeaponSlotKey:
    Fortnite.SwitchToWeapon( SubStr( A_ThisHotkey, 3 ) )
    Return

    MeleeSlotKey:
    Fortnite.SwitchToMelee()
    Return

    InventoryKey:
    Fortnite.ToggleInventory()
    Return

    BuildKey:
    Fortnite.SwitchToBuild()
    Return

    EscKey:
    Fortnite.Esc()
    Return

    }
    }
    Return

    ; State Tracking
    WeaponSlotKey:
    Fortnite.SwitchToWeapon( SanitizeKey( A_ThisHotkey ) )
    Return
    MeleeSlotKey:
    Fortnite.SwitchToMelee()
    Return
    InventoryKey:
    Fortnite.ToggleInventory()
    Return
    BuildKey:
    Fortnite.SwitchToBuild()
    Return
    EscKey:
    Fortnite.Esc()
    Return
  19. sclark39 revised this gist May 26, 2018. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions 123Fortnite.ahk
    Original file line number Diff line number Diff line change
    @@ -14,9 +14,9 @@ HotKey, ~*Esc, EscKey
    ; Custom Binds
    HotKey, *XButton1, LastInv
    HotKey, *LCtrl, HoldToToggleCrouch
    ;HotKey, ~*c, EditOn
    ;HotKey, ~*LButton Up, ConfirmEdit
    ;HotKey, ~*RButton Up, ConfirmEdit
    HotKey, ~*c, EditOn
    HotKey, ~*LButton Up, ConfirmEdit
    HotKey, ~*RButton Up, ConfirmEdit

    ; Tracks the state of the game
    class Fortnite
  20. sclark39 revised this gist May 26, 2018. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions 123Fortnite.ahk
    Original file line number Diff line number Diff line change
    @@ -14,9 +14,9 @@ HotKey, ~*Esc, EscKey
    ; Custom Binds
    HotKey, *XButton1, LastInv
    HotKey, *LCtrl, HoldToToggleCrouch
    HotKey, ~*c, EditOn
    HotKey, ~*LButton Up, ConfirmEdit
    HotKey, ~*RButton Up, ConfirmEdit
    ;HotKey, ~*c, EditOn
    ;HotKey, ~*LButton Up, ConfirmEdit
    ;HotKey, ~*RButton Up, ConfirmEdit

    ; Tracks the state of the game
    class Fortnite
  21. sclark39 revised this gist May 26, 2018. 1 changed file with 35 additions and 13 deletions.
    48 changes: 35 additions & 13 deletions 123Fortnite.ahk
    Original file line number Diff line number Diff line change
    @@ -13,9 +13,10 @@ HotKey, ~*Esc, EscKey

    ; Custom Binds
    HotKey, *XButton1, LastInv
    HotKey, *c, HoldToToggleCrouch
    HotKey, *LCtrl, HoldToToggleCrouch
    HotKey, *g, HoldToToggleBuildEdit
    HotKey, ~*c, EditOn
    HotKey, ~*LButton Up, ConfirmEdit
    HotKey, ~*RButton Up, ConfirmEdit

    ; Tracks the state of the game
    class Fortnite
    @@ -39,25 +40,33 @@ class Fortnite
    this.Melee := 0
    this.BuildEdit := 0
    }

    SwitchToMelee()
    {
    this.Melee:=1
    }

    SwitchToBuild()
    {
    this.Building := 1
    this.Melee:=0
    this.BuildEdit := 0
    }

    ToggleInventory()
    {
    this.InventoryOpen := !this.InventoryOpen
    }
    ToggleEdit()

    EditOn()
    {
    this.BuildEdit := 1
    }
    EditOff()
    {
    this.BuildEdit := 0
    this.Melee:=0
    }

    Esc()
    {
    this.InventoryOpen := 0
    @@ -91,33 +100,46 @@ Return
    if ( A_TimeSinceThisHotkey > 250 )
    SendInput {%thiskey%}
    Return
    HoldToToggleBuildEdit:
    thiskey := SubStr( A_ThisHotkey, 2 )
    SendInput {%thiskey%}
    Fortnite.ToggleEdit()
    KeyWait, % thiskey
    if ( A_TimeSinceThisHotkey > 250 and Fortnite.BuildEdit = 1 )

    ; Confirm Build on Mouse Release
    EditOn:
    Fortnite.EditOn()
    Return
    ConfirmEdit:
    if ( Fortnite.BuildEdit = 1 )
    {
    SendInput {%thiskey%}
    Fortnite.ToggleEdit()
    Fortnite.EditOff()
    Sleep, 100
    SendInput {c}
    if ( Fortnite.Building = 1 )
    {
    Sleep, 100
    SendInput % Fortnite.ActiveWeapon
    Fortnite.SwitchToWeapon( Fortnite.ActiveWeapon )
    }
    }
    Return


    ; State Tracking
    WeaponSlotKey:
    Fortnite.SwitchToWeapon( SubStr( A_ThisHotkey, 3 ) )
    Return

    MeleeSlotKey:
    Fortnite.SwitchToMelee()
    Return

    InventoryKey:
    Fortnite.ToggleInventory()
    Return

    BuildKey:
    Fortnite.SwitchToBuild()
    Return

    EscKey:
    Fortnite.Esc()
    Return

    }
  22. sclark39 revised this gist May 26, 2018. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion 123Fortnite.ahk
    Original file line number Diff line number Diff line change
    @@ -91,6 +91,7 @@ Return
    if ( A_TimeSinceThisHotkey > 250 )
    SendInput {%thiskey%}
    Return

    HoldToToggleBuildEdit:
    thiskey := SubStr( A_ThisHotkey, 2 )
    SendInput {%thiskey%}
    @@ -119,4 +120,4 @@ Return
    EscKey:
    Fortnite.Esc()
    Return
    }
    }
  23. sclark39 revised this gist May 26, 2018. 1 changed file with 1 addition and 12 deletions.
    13 changes: 1 addition & 12 deletions 123Fortnite.ahk
    Original file line number Diff line number Diff line change
    @@ -39,30 +39,25 @@ class Fortnite
    this.Melee := 0
    this.BuildEdit := 0
    }

    SwitchToMelee()
    {
    this.Melee:=1
    }

    SwitchToBuild()
    {
    this.Building := 1
    this.Melee:=0
    this.BuildEdit := 0
    }

    ToggleInventory()
    {
    this.InventoryOpen := !this.InventoryOpen
    }

    ToggleEdit()
    {
    this.BuildEdit := 0
    this.Melee:=0
    }

    Esc()
    {
    this.InventoryOpen := 0
    @@ -96,7 +91,6 @@ Return
    if ( A_TimeSinceThisHotkey > 250 )
    SendInput {%thiskey%}
    Return

    HoldToToggleBuildEdit:
    thiskey := SubStr( A_ThisHotkey, 2 )
    SendInput {%thiskey%}
    @@ -113,21 +107,16 @@ Return
    WeaponSlotKey:
    Fortnite.SwitchToWeapon( SubStr( A_ThisHotkey, 3 ) )
    Return

    MeleeSlotKey:
    Fortnite.SwitchToMelee()
    Return

    InventoryKey:
    Fortnite.ToggleInventory()
    Return

    BuildKey:
    Fortnite.SwitchToBuild()
    Return

    EscKey:
    Fortnite.Esc()
    Return

    }
    }
  24. sclark39 renamed this gist May 26, 2018. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  25. sclark39 revised this gist May 26, 2018. No changes.
  26. sclark39 revised this gist May 26, 2018. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions Fortnite.ahk
    Original file line number Diff line number Diff line change
    @@ -17,6 +17,7 @@ HotKey, *c, HoldToToggleCrouch
    HotKey, *LCtrl, HoldToToggleCrouch
    HotKey, *g, HoldToToggleBuildEdit

    ; Tracks the state of the game
    class Fortnite
    {
    static ActiveWeapon:=2
  27. sclark39 revised this gist May 26, 2018. 1 changed file with 12 additions and 6 deletions.
    18 changes: 12 additions & 6 deletions Fortnite.ahk
    Original file line number Diff line number Diff line change
    @@ -25,6 +25,7 @@ class Fortnite
    static Building:=0
    static InventoryOpen:=0
    static BuildEdit:=0
    static Melee:=0

    SwitchToWeapon(key)
    {
    @@ -34,12 +35,19 @@ class Fortnite
    this.ActiveWeapon := key
    }
    this.Building := 0
    this.Melee := 0
    this.BuildEdit := 0
    }

    SwitchToMelee()
    {
    this.Melee:=1
    }

    SwitchToBuild()
    {
    this.Building := 1
    this.Melee:=0
    this.BuildEdit := 0
    }

    @@ -51,6 +59,7 @@ class Fortnite
    ToggleEdit()
    {
    this.BuildEdit := 0
    this.Melee:=0
    }

    Esc()
    @@ -66,7 +75,7 @@ Return
    ; Alternates between your two most recent weapon slots, and switches
    ; back to a weapon if you're on melee or build mode.
    LastInv:
    if ( Fortnite.Building = 1 )
    if ( Fortnite.Building + Fortnite.Melee > 0 )
    {
    SendInput % Fortnite.ActiveWeapon
    Fortnite.SwitchToWeapon( Fortnite.ActiveWeapon )
    @@ -83,7 +92,7 @@ Return
    thiskey := SubStr( A_ThisHotkey, 2 )
    SendInput {%thiskey%}
    KeyWait, % thiskey
    if ( A_TimeSinceThisHotkey > 250 )
    if ( A_TimeSinceThisHotkey > 250 )
    SendInput {%thiskey%}
    Return

    @@ -104,11 +113,8 @@ Return
    Fortnite.SwitchToWeapon( SubStr( A_ThisHotkey, 3 ) )
    Return

    ; Don't Track Melee
    MeleeSlotKey:
    ; Swap which weapon is your active vs previous so when we switch
    ; back we return to the right one
    Fortnite.SwitchToWeapon(Fortnite.PreviousWeapon)
    Fortnite.SwitchToMelee()
    Return

    InventoryKey:
  28. sclark39 revised this gist May 26, 2018. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions Fortnite.ahk
    Original file line number Diff line number Diff line change
    @@ -106,6 +106,8 @@ Return

    ; Don't Track Melee
    MeleeSlotKey:
    ; Swap which weapon is your active vs previous so when we switch
    ; back we return to the right one
    Fortnite.SwitchToWeapon(Fortnite.PreviousWeapon)
    Return

  29. sclark39 revised this gist May 26, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Fortnite.ahk
    Original file line number Diff line number Diff line change
    @@ -83,7 +83,7 @@ Return
    thiskey := SubStr( A_ThisHotkey, 2 )
    SendInput {%thiskey%}
    KeyWait, % thiskey
    if ( A_TimeSinceThisHotkey > 250 )
    if ( A_TimeSinceThisHotkey > 250 )
    SendInput {%thiskey%}
    Return

  30. sclark39 revised this gist May 26, 2018. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion Fortnite.ahk
    Original file line number Diff line number Diff line change
    @@ -63,7 +63,8 @@ Return

    #IfWinActive, Fortnite
    {
    ; Switch to previous weapon slot
    ; Alternates between your two most recent weapon slots, and switches
    ; back to a weapon if you're on melee or build mode.
    LastInv:
    if ( Fortnite.Building = 1 )
    {