Advertisement
t3h_m00kz

AUTOHOTKEY - IronSight

Aug 21st, 2022 (edited)
450
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;;;;;;;;;;;;;;;;;;;;
  2. ;; INITIALIZATION ;;
  3. ;;;;;;;;;;;;;;;;;;;;
  4.  ;Updated 09/26/22
  5. #NoEnv
  6. #Persistent
  7. #SingleInstance,        Force
  8. #MaxHotkeysPerInterval  99000000
  9. #HotkeyInterval         99000000
  10. #KeyHistory             0
  11. #InstallKeybdHook
  12. #UseHook
  13. #MenuMaskKey            vk07
  14. ListLines               Off
  15. SetBatchLines,          -1
  16. SetKeyDelay,            -1, -1
  17. SetMouseDelay,          -1
  18. SetDefaultMouseSpeed    , 0
  19. SetWinDelay,            -1
  20. SetControlDelay,        -1
  21. ;SendMode               Input
  22. DllCall("ntdll\ZwSetTimerResolution","Int",5000,"Int",1,"Int*",MyCurrentTimerResolution) ;setting the Windows Timer Resolution to 0.5ms, THIS IS A GLOBAL CHANGE
  23. SetTitleMatchMode,      2
  24. SetTitleMatchMode,      fast
  25.  
  26. ;Set Icon
  27. IfExist, %A_ScriptDir%\graphics\Icon.png
  28.     {
  29.     Menu,Tray,Icon, %A_ScriptDir%\graphics\Icon.png
  30.     }
  31.  
  32. ;;;;;;;;;;;;;;;;;;;
  33. ;;GLOBAL SETTINGS;;
  34. ;;;;;;;;;;;;;;;;;;;
  35. ;Set default variables to globals
  36. SetDefaults(){
  37.     global
  38.     }
  39.  
  40. ;Time intervals
  41. global framesPerSecond          := "60" ;Game's FPS
  42. global gameTick                 := ((1/framesPerSecond)*1000) ;One gametick / frame
  43.  
  44. ;TOGGLES - Features
  45. global firingMode               := "Default"        ;Currently active firing mode
  46. global firingModeHip            := "Default"        ;Firing mode from the hip
  47. global firingModeADS            := "Default"        ;Firing mode while ADS
  48. global enableBHop               := "1"              ;Enable space bar spam
  49. global enableHoldProne          := "1"              ;Enable hold prone
  50. global enableHoldToMelee        := "1"              ;Enable hold quick melee to switch to melee weapon
  51. global enableHoldToProne        := "0"              ;Enable hold crouch to prone (only if toggle crouch)
  52. global enableAutoBreath         := "0"              ;Enable auto breath hold for snipers
  53. global enableAutoMark           := "0"              ;Enable AutoMark system
  54.  
  55. ;DEBUGGNG
  56. global debugRet                 := "1"
  57.  
  58. ;TOGGLES - UI display
  59. global showUI                   := "1"              ;Display the UI
  60. global showUI_Inputs            := "0"              ;Display the input UI
  61. global showUI_Directionals      := "0"              ;Display the directional input UI
  62. global showUI_InputBG           := "0"              ;Display the input UI backdrop
  63. global showUI_firingMode        := "1"              ;Display the firing mode
  64. global showUI_Ret               := "1"              ;Display the crosshair
  65. global showUI_RetCross          := "1"              ;Display the crosshair cross
  66. global showUI_RetDot            := "1"              ;Display the crosshair dot
  67. global showUI_RetCircle         := "1"              ;Display the crosshair circle
  68. global showUI_RetAnimate        := "1"              ;Display the crosshair animiations
  69. global retOffsetX               := "0"              ;Ret offset X
  70. global retOffsetY               := "0"              ;Ret offset Y
  71.  
  72. ;AutoMark system
  73. global markOut                  := "0"              ;AutoMark is out
  74. global autoMarkCooldown         := "300"            ;AutoMark Cooldown in ticks
  75.  
  76. ;Burst fire system 1
  77. global burst1Ticks              := "4"              ;The number of times burstfire will loop
  78. global burst1FireMax            := "3"              ;The number of times burstfire will loop
  79. global burst1FireCount          := "0"              ;The number of times burstfire has looped
  80. global isBursting1              := "0"              ;The player is firing a burstfire shot
  81.  
  82. ;Burst fire system 2
  83. global burst2Ticks              := "2"              ;The number of times burstfire will loop
  84. global burst2FireMax            := "3"              ;The number of times burstfire will loop
  85. global burst2FireCount          := "0"              ;The number of times burstfire has looped
  86. global isBursting2              := "0"              ;The player is firing a burstfire shot
  87.  
  88. ;Input systems
  89. global isBHopping               := "0"              ;The player is bhopping
  90. global bHopFirstHop             := "0"              ;Handles the first hop before beginning bhop spam
  91. global bHopSwitch               := "0"              ;Bhop down/up flipper
  92. global isHoldingAim             := "0"              ;The player is holding aim
  93. global isHoldingCrouch          := "0"              ;The player is holding crouch
  94. global isHoldingProne           := "0"              ;The player is holding prone
  95. global chargedProne             := "0"              ;(Hold to Prone) The player has charged prone
  96. global isProning                := "0"              ;(Hold to Prone) The player is proning
  97. global proneCount               := "0"              ;(Hold to Prone) Prone Counter
  98. global proneCountMax            := "6"              ;(Hold to Prone) Maximum number of prones to spam
  99. global unProneCount             := "0"              ;(Hold to Prone) UnProne Counter
  100. global unProneCountMax          := "6"              ;(Hold to Prone) Maximum number of unprones to spam
  101. global isHoldingMelee           := "0"              ;The player is holding melee
  102. global chargedMelee             := "0"              ;The player has charged melee
  103. global cancelMelee              := "0"              ;Cancel the melee
  104. global isHoldingFiringMode      := "0"              ;The player is holding firing mode switch
  105. global chargedFiringMode        := "0"              ;The player has charged firing mode switch
  106. global cancelFiringMode         := "0"              ;Cancel the firing mode switch
  107. global firingModeSound          := ""               ;The firing mode sound to play
  108. global isHoldingFire            := "0"              ;The player is holding fire
  109. global isHoldingSprint          := "0"              ;The player is holding sprint
  110. global isHoldingJump            := "0"              ;The player is holding jump
  111.  
  112. ;UI systems
  113. global scrX                     := A_ScreenWidth
  114. global scrY                     := A_ScreenHeight
  115. global GUISizeRet               := "200"            ;Width/Height of ret window
  116. global inputUIGap               := "50"             ;movement key display UI gap
  117. global windowSelected           := "1"              ;Expected game window is in focus
  118.  
  119. ;UI Crosshair animation system
  120. global PI                           := "3.14"       ;... it's pi
  121. global sRetAction                   := "None"       ;Debug string for current ret action
  122. global sRetMotion                   := "None"       ;Debug string for current ret motion
  123. global retAniProgress               := "0"          ;0-1 of Ret progress
  124. global retAniCurved                 := "0"          ;Ret progress with applied ease curve
  125. global aniStepsGrow                 := "0"          ;steps in ticks ret will animate from 0 to 1
  126. global aniStepsDecay                := "0"          ;steps in ticks ret will animate from 1 to 0
  127. global doneGrow                     := "0"          ;Ret animation is finished growing
  128. global doneDecay                    := "0"          ;Ret animation is finised decaying
  129. global aniFrameRate                 := "0"          ;Ret framerate subdivision
  130. global aniOnResetShowCross          := "0"          ;Show the cross on animation reset
  131. global aniOnResetShowDot            := "0"          ;Show the dot on animaton reset
  132. global retWidthOutline              := "0"          ;Ret cross outline width
  133. global retLengthOutline             := "0"          ;Ret cross outline length
  134. global retDotOutlineSize            := "0"          ;Ret dot outline size
  135. global retGap                       := "0"          ;Ret crosshair center gap size
  136. global retLength                    := "0"          ;Ret crosshair bar lengths
  137. global retWidth                     := "0"          ;Ret crosshair bar widths
  138. global retOutline                   := "0"          ;Ret crosshair bar outline size
  139. global retDotSize                   := "0"          ;Ret dot size
  140. global retDotOutline                := "0"          ;Ret dot outline size
  141. global retCircleRadius              := "0"          ;Ret circle radius
  142. global retCircleThickness           := "0"          ;Ret circle thickness
  143. global retCircleOutline             := "0"          ;Ret circle outline size
  144. global retCircleGap                 := "0"          ;Ret circle outline size
  145. global aniRateGrowGap               := "0"          ;Grow rate for ret crosshair center gap
  146. global aniRateGrowLength            := "0"          ;Grow rate for ret crosshair bar length
  147. global aniRateGrowWidth             := "0"          ;Grow rate for ret crosshair bar widths
  148. global aniRateGrowOutline           := "0"          ;Grow rate for ret crosshair bar outlin
  149. global aniRateGrowDotSize           := "0"          ;Grow rate for ret dot size
  150. global aniRateGrowDotOutline        := "0"          ;Grow rate for ret dot outline size
  151. global aniRateGrowCircleRadius      := "0"          ;Grow rate for ret circle radius
  152. global aniRateGrowCircleThickness   := "0"          ;Grow rate for ret circle thickness
  153. global aniRateGrowCircleOutline     := "0"          ;Grow rate for ret circle outline size
  154. global aniRateGrowCircleGap         := "0"          ;Ret circle outline size
  155. global aniRateDecayGap              := "0"          ;Decay rate for ret crosshair center gap
  156. global aniRateDecayLength           := "0"          ;Decay rate for ret crosshair bar length
  157. global aniRateDecayWidth            := "0"          ;Decay rate for ret crosshair bar widths
  158. global aniRateDecayOutline          := "0"          ;Decay rate for ret crosshair bar outlin
  159. global aniRateDecayDotSize          := "0"          ;Decay rate for ret dot size
  160. global aniRateDecayDotOutline       := "0"          ;Decay rate for ret dot outline size
  161. global aniRateDecayCircleRadius     := "0"          ;Decay rate for ret circle radius
  162. global aniRateDecayCircleThickness  := "0"          ;Decay rate for ret circle thickness
  163. global aniRateDecayCircleOutline    := "0"          ;Decay rate for ret circle outline size
  164. global aniRateDecayCircleGap        := "0"          ;Ret circle outline size
  165. global aniMinGap                    := "0"          ;Minimum value for ret crosshair center gap
  166. global aniMinLength                 := "0"          ;Minimum value for ret crosshair bar length
  167. global aniMinWidth                  := "0"          ;Minimum value for ret crosshair bar widths
  168. global aniMinOutline                := "0"          ;Minimum value for ret crosshair bar outlin
  169. global aniMinDotSize                := "0"          ;Minimum value for ret dot size
  170. global aniMinDotOutline             := "0"          ;Minimum value for ret dot outline size
  171. global aniMinCircleRadius           := "0"          ;Minimum value for ret circle radius
  172. global aniMinCircleThickness        := "0"          ;Minimum value for ret circle thickness
  173. global aniMinCircleOutline          := "0"          ;Minimum value for ret circle outline size
  174. global aniMinCircleGap              := "0"          ;Ret circle outline size
  175. global aniMaxGap                    := "0"          ;Maximum value for ret crosshair center gap
  176. global aniMaxLength                 := "0"          ;Maximum value for ret crosshair bar length
  177. global aniMaxWidth                  := "0"          ;Maximum value for ret crosshair bar widths
  178. global aniMaxOutline                := "0"          ;Maximum value for ret crosshair bar outlin
  179. global aniMaxDotSize                := "0"          ;Maximum value for ret dot size
  180. global aniMaxDotOutline             := "0"          ;Maximum value for ret dot outline size
  181. global aniMaxCircleRadius           := "0"          ;Maximum value for ret circle radius
  182. global aniMaxCircleThickness        := "0"          ;Maximum value for ret circle thickness
  183. global aniMaxCircleOutline          := "0"          ;Maximum value for ret circle outline size
  184. global aniMaxCircleGap              := "0"          ;Ret circle outline size
  185. global aniSnapStep                  := "0"          ;Snap ammount  
  186.  
  187. ;Image files
  188. global imgB                 := A_ScriptDir . "\graphics\pixel_BLACK.png"    ;1x1 pixel black
  189. global imgW                 := A_ScriptDir . "\graphics\pixel_WHITE.png"    ;1x1 pixel white
  190. global imgFiringModeOff     := A_ScriptDir . "\graphics\Modes\off.png"      ;Firing Mode - Off (I.E. resetting to defaults)
  191. global imgFiringModeAuto1   := A_ScriptDir . "\graphics\Modes\auto1.png"    ;Firing Mode - Auto1 (Default)
  192. global imgFiringModeAuto2   := A_ScriptDir . "\graphics\Modes\auto2.png"    ;Firing Mode - Auto2 (Off/On switch)
  193. global imgFiringModeBurst1  := A_ScriptDir . "\graphics\Modes\burst1.png"   ;Firing Mode - burst1 (Timer-based)
  194. global imgFiringModeBurst2  := A_ScriptDir . "\graphics\Modes\burst2.png"   ;Firing Mode - burst2 (Looped shots)
  195. global imgFiringModeSemi    := A_ScriptDir . "\graphics\Modes\semi.png"     ;Firing Mode - Semi-Auto
  196.  
  197. ;UI colors
  198. global UIRGB                := "111111"     ;Default (transparent)
  199. global UIKeyOff             := "111111"     ;Input key off color
  200. global UIKeyOn              := "00FF00"     ;Input key on color
  201.  
  202. ;UI initialization
  203. loadUI()
  204. retState("1")
  205. checkWindow()
  206.  
  207. ;;;;;;;;;;;;;;;;;;;;
  208. ;; TIME INTERVALS ;;
  209. ;;;;;;;;;;;;;;;;;;;;
  210. tick(t:="1"){ ;Tick(ticks)
  211.         ticks := gameTick*t
  212.         return ticks
  213.     }
  214.  
  215. wait(t:="1"){ ;Wait(ticks) ;Try to avoid waits/sleeps over subroutine labels
  216.     ticks := (tick*t)
  217.     DllCall("Sleep","UInt", %ticks%)
  218.     return
  219.     }
  220.  
  221. ;;;;;;;;;;;;;;;;;;;;
  222. ;; USER INTERFACE ;;
  223. ;;;;;;;;;;;;;;;;;;;;
  224. if showUI_Ret{ ;Reticle
  225.     if showUI_RetCircle{ ;Globalize HWNDs and coodrinates
  226.         global HWNDCircleB              := "0"
  227.         global HWNDCircleW              := "0"
  228.         global CircleB_Outer            := "0"
  229.         global CircleB_Inner            := "0"
  230.         global CircleW_Outer            := "0"
  231.         global CircleW_Inner            := "0"
  232.         global Circle_UL                := "0"
  233.         global Circle_DR                := "0"
  234.         global CircleW_Outer_UL         := "0"
  235.         global CircleW_Outer_DR         := "0"
  236.         global CircleB_Outer_UL         := "0"
  237.         global CircleB_Outer_DR         := "0"
  238.         global CircleB_Inner_UL         := "0"
  239.         global CircleB_Inner_DR         := "0"     
  240.         global CircleW_GapTL            := "0"
  241.         global CircleW_GapBR            := "0"
  242.         global CircleW_GapH             := "0"
  243.         global CircleW_GapV             := "0"
  244.         global CircleB_GapTL            := "0"
  245.         global CircleB_GapBR            := "0"
  246.         global CircleB_GapH             := "0"
  247.         global CircleB_GapV             := "0"
  248.     }
  249.         if showUI_RetCross{ ;Globalize height/width HWNDs and coordinates
  250.         global retUp_blackH             := "0"
  251.         global retDown_blackH           := "0"
  252.         global retLeft_blackH           := "0"
  253.         global retRight_blackH          := "0"
  254.         global retUp_blackV             := "0"
  255.         global retDown_blackV           := "0"
  256.         global retLeft_blackV           := "0"
  257.         global retRight_blackV          := "0"
  258.         global retUp_white              := "0"
  259.         global retDown_white            := "0"
  260.         global retLeft_white            := "0"
  261.         global retRight_white           := "0"
  262.         global U_blackHX                := "0"
  263.         global U_blackHY                := "0"
  264.         global D_blackHX                := "0"
  265.         global D_blackHY                := "0"
  266.         global L_blackHX                := "0"
  267.         global L_blackHY                := "0"
  268.         global R_blackHX                := "0"
  269.         global R_blackHY                := "0"
  270.         global U_blackVX                := "0"
  271.         global U_blackVY                := "0"
  272.         global D_blackVX                := "0"
  273.         global D_blackVY                := "0"
  274.         global L_blackVX                := "0"
  275.         global L_blackVY                := "0"
  276.         global R_blackVX                := "0"
  277.         global R_blackVY                := "0"     
  278.         global U_whiteX                 := "0"
  279.         global U_whiteY                 := "0"
  280.         global D_whiteX                 := "0"
  281.         global D_whiteY                 := "0"
  282.         global L_whiteX                 := "0"
  283.         global L_whiteY                 := "0"
  284.         global R_whiteX                 := "0"
  285.         global R_whiteY                 := "0"
  286.         }
  287.     if showUI_RetDot{   ;Globalize height/width HWNDs and coodrinates
  288.         global retCenter_blackH         := "0"
  289.         global retCenter_blackV         := "0"
  290.         global retCenter_white          := "0"
  291.         global M_blackHX                := "0"
  292.         global M_blackHY                := "0"
  293.         global M_blackVX                := "0"
  294.         global M_blackVY                := "0"
  295.         global M_whiteX                 := "0"
  296.         global M_whiteY                 := "0"
  297.         }
  298.     }
  299. createGUI_ret()
  300.  
  301. createGUI_ret(){ ;Create ret GUI windows
  302.     if showUI_Ret{
  303.         if debugRet{
  304.             createGUI_retUI_debug()
  305.             }
  306.         createGUI_retUI_CROSSB()
  307.         createGUI_retUI_DOTB()
  308.         createGUI_retUI_CIRCLEB()
  309.         createGUI_retUI_CROSSW()
  310.         createGUI_retUI_DOTW()
  311.         createGUI_retUI_CIRCLEW()
  312.         }
  313.     }
  314.  
  315. createGUI_retUi_debug(){ ;Ret debug
  316.     GLOBAL RetVariables
  317.     GLOBAL RetValues
  318.     Gui,    retUI_DEBUG:    New
  319.     Gui,    retUI_DEBUG:    Color,      FFFFFF
  320.     Gui,    retUI_DEBUG:    Add, Text, vRetVariables x0 y0 w100, Variables`n`nsRetMotion`nsRetAction`nretAniProgress`nretAniCurved`nretGap`nretLength`nretWidth`nretOutline`nretDotSize`nretDotOutline`nretCircleRadius`nretCircleThickness`nretCircleOutline`nretCircleGap
  321.     Gui,    retUI_DEBUG:    Add, Text, vRetValues x100 y0 w100, Values`n`n%sRetMotion%`n%sRetAction%`n%retAniProgress%`n%retAniCurved%`n%retGap%`n%retLength%`n%retWidth%`n%retOutline%`n%retDotSize%`n%retDotOutline%`n%retCircleRadius%`n%retCircleThickness%`n%retCircleOutline%`n%retCircleGap%
  322.     Gui,    retUI_DEBUG:    Show, AutoSize
  323.     updateRetDebugText()
  324.     return
  325.     }
  326.  
  327. updateRetDebugText(){ ;Update ret debug text
  328.     GuiControl retUI_DEBUG:,RetValues,Values`n`n%sRetMotion%`n%sRetAction%`n%retAniProgress%`n%retAniCurved%`n%retGap%`n%retLength%`n%retWidth%`n%retOutline%`n%retDotSize%`n%retDotOutline%`n%retCircleRadius%`n%retCircleThickness%`n%retCircleOutline%`n%retCircleGap%
  329. }
  330.  
  331. createGUI_retUI_CROSSB(){
  332.     if showUI_RetCross{ ;Ret cross
  333.         Gui,    retUI_CROSSB:   Destroy
  334.         Gui,    retUI_CROSSB:   Color,      %UIRGB%
  335.         Gui     retUI_CROSSB:   +LastFound +AlwaysOnTop -Caption +ToolWindow +Disabled +E0x20; +E0x02000000 +E0x00080000
  336.         Gui,    retUI_CROSSB:   Add,    Picture,    hwndretU_blackH +BackgroundTrans,   %imgB%
  337.         Gui,    retUI_CROSSB:   Add,    Picture,    hwndretD_blackH +BackgroundTrans,   %imgB%
  338.         Gui,    retUI_CROSSB:   Add,    Picture,    hwndretL_blackH +BackgroundTrans,   %imgB%
  339.         Gui,    retUI_CROSSB:   Add,    Picture,    hwndretR_blackH +BackgroundTrans,   %imgB%
  340.         Gui,    retUI_CROSSB:   Add,    Picture,    hwndretU_blackV +BackgroundTrans,   %imgB%
  341.         Gui,    retUI_CROSSB:   Add,    Picture,    hwndretD_blackV +BackgroundTrans,   %imgB%
  342.         Gui,    retUI_CROSSB:   Add,    Picture,    hwndretL_blackV +BackgroundTrans,   %imgB%
  343.         Gui,    retUI_CROSSB:   Add,    Picture,    hwndretR_blackV +BackgroundTrans,   %imgB%
  344.         WinSet, TransColor, %UIRGB% 255
  345.         retUp_blackH                    := retU_blackH
  346.         retDown_blackH                  := retD_blackH
  347.         retLeft_blackH                  := retL_blackH
  348.         retRight_blackH                 := retR_blackH
  349.         retUp_blackV                    := retU_blackV
  350.         retDown_blackV                  := retD_blackV
  351.         retLeft_blackV                  := retL_blackV
  352.         retRight_blackV                 := retR_blackV
  353.         }
  354.     return
  355.     }
  356.  
  357. createGUI_retUI_DOTB(){
  358.     if showUI_RetDot{ ;Dot black outline
  359.         Gui,    retUI_DOTB: Destroy
  360.         Gui,    retUI_DOTB: Color,      %UIRGB%
  361.         Gui     retUI_DOTB: +LastFound +AlwaysOnTop -Caption +ToolWindow +Disabled +E0x20; +E0x02000000 +E0x00080000
  362.         Gui,    retUI_DOTB: Add,    Picture,    hwndretM_blackH +BackgroundTrans,   %imgB%
  363.         Gui,    retUI_DOTB: Add,    Picture,    hwndretM_blackV +BackgroundTrans,   %imgB%
  364.         WinSet, TransColor, %UIRGB% 255
  365.         retCenter_blackH                := retM_blackH
  366.         retCenter_blackV                := retM_blackV
  367.         }
  368.     return
  369.     }
  370.  
  371. createGUI_retUI_CIRCLEB(){
  372.     if showUI_RetCircle{ ;Circle black outline
  373.         Gui,    retUI_CIRCLEB:  Hide
  374.         Gui,    retUI_CIRCLEB:  Destroy
  375.         Gui,    retUI_CIRCLEB:  Color,      000000
  376.         Gui     retUI_CIRCLEB:  +LastFound +AlwaysOnTop -Caption +ToolWindow +Disabled +E0x20; +E0x02000000 +E0x00080000
  377.         WinGet, UICircleB
  378.         HWNDCircleB := UICircleB
  379.         }
  380.     return
  381.     }
  382.  
  383.  
  384. createGUI_retUI_CROSSW(){
  385.     if showUI_RetCross{ ;Cross white body
  386.         Gui,    retUI_CROSSW:   Destroy
  387.         Gui,    retUI_CROSSW:   Color,      %UIRGB%
  388.         Gui     retUI_CROSSW:   +LastFound +AlwaysOnTop -Caption +ToolWindow +Disabled +E0x20; +E0x02000000 +E0x00080000
  389.         Gui,    retUI_CROSSW:   Add,    Picture,    hwndretU_white +BackgroundTrans,    %imgW%
  390.         Gui,    retUI_CROSSW:   Add,    Picture,    hwndretD_white +BackgroundTrans,    %imgW%
  391.         Gui,    retUI_CROSSW:   Add,    Picture,    hwndretL_white +BackgroundTrans,    %imgW%
  392.         Gui,    retUI_CROSSW:   Add,    Picture,    hwndretR_white +BackgroundTrans,    %imgW%
  393.         WinSet, TransColor, %UIRGB% 255
  394.         retUp_white                     := retU_white
  395.         retDown_white                   := retD_white
  396.         retLeft_white                   := retL_white
  397.         retRight_white                  := retR_white
  398.         }
  399.     return
  400.     }
  401.  
  402. createGUI_retUI_DOTW(){
  403.     if showUI_RetDot{ ;Dot white body
  404.         Gui,    retUI_DOTW: Destroy
  405.         Gui,    retUI_DOTW: Color,      %UIRGB%
  406.         Gui     retUI_DOTW: +LastFound +AlwaysOnTop -Caption +ToolWindow +Disabled +E0x20; +E0x02000000 +E0x00080000
  407.         Gui,    retUI_DOTW: Add,    Picture,    hwndretM_white +BackgroundTrans,    %imgW%
  408.         WinSet, TransColor, %UIRGB% 255
  409.         retCenter_white     := retM_white
  410.         }
  411.     return
  412.     }
  413.  
  414. createGUI_retUI_CIRCLEW(){
  415.     if showUI_RetCircle{ ;Circle white body
  416.         Gui,    retUI_CIRCLEW:  Hide
  417.         Gui,    retUI_CIRCLEW:  Destroy
  418.         Gui,    retUI_CIRCLEW:  Color,      FFFFFF
  419.         Gui     retUI_CIRCLEW:  +LastFound +AlwaysOnTop -Caption +ToolWindow +Disabled +E0x20; +E0x02000000 +E0x00080000
  420.         WinGet, UICircleW
  421.         HWNDCircleW := UICircleW
  422.         }
  423.     return
  424.     }
  425.  
  426. if showUI_Inputs{ ;Inputs
  427.     if showUI_InputBG{
  428.         Gui,    inputBGUI:          Color,  %UIRGB% ;Input background
  429.         Gui     inputBGUI:          +LastFound +AlwaysOnTop -Caption +ToolWindow +Disabled +E0x20
  430.         Gui,    inputBGUI:          Font,   s36,        Arial
  431.         if showUI_Directionals{ ;Input background directional arrows
  432.             Gui,    inputBGUI:      Add,    Text,       % "center 0x201 BackGroundTrans c00FF00 x" .                                (scrX/2)-25 . " y" .                ((scrY/2)-59)-inputUIGap . " w50",  ^
  433.             Gui,    inputBGUI:      Add,    Text,       % "center 0x201 BackGroundTrans c00FF00 x" .                                ((scrX/2)-67)-inputUIGap . " y" .   (scrY/2)-28 . " w50",               <
  434.             Gui,    inputBGUI:      Add,    Text,       % "center 0x201 BackGroundTrans c00FF00 x" .                                ((scrX/2)+17)+inputUIGap . " y" .   (scrY/2)-28 . " w50",               >
  435.             Gui,    inputBGUI:      Font,   s31,        Arial
  436.             Gui,    inputBGUI:      Add,    Text,       % "center 0x201 BackGroundTrans c00FF00 x" .                                (scrX/2)-24 . " y" .                ((scrY/2)+14)+inputUIGap . " w50",  v
  437.             }
  438.         Gui,    inputBGUI:          Font,   s24,        Arial
  439.         Gui,    inputBGUI:          Add,    Text,       % "center 0x201 BackGroundTrans c00FF00 x" .                                (scrX/2)-40 . " y" .                (scrY/2)+40 . " w50",               Jump
  440.         Gui,    inputBGUI:          Font,   s20,        Arial
  441.         Gui,    inputBGUI:          Add,    Text,       % "center 0x201 BackGroundTrans c00FF00 x" .                                (scrX/2)-40 . " y" .                (scrY/2)-135 . " w50",              Melee
  442.         Gui,    inputBGUI:          Add,    Text,       % "center 0x201 BackGroundTrans c00FF00 x" .                                (scrX/2)-90 . " y" .                (scrY/2)-105 . " w50",              Fire
  443.         Gui,    inputBGUI:          Add,    Text,       % "center 0x201 BackGroundTrans c00FF00 x" .                                (scrX/2)+40 . " y" .                (scrY/2)-105 . " w50",              Aim
  444.         Gui,    inputBGUI:          Add,    Text,       % "center 0x201 BackGroundTrans c00FF00 x" .                                (scrX/2)-115. " y" .                (scrY/2)+70 . " w50",               Crouch
  445.         Gui,    inputBGUI:          Add,    Text,       % "center 0x201 BackGroundTrans c00FF00 x" .                                (scrX/2)-105. " y" .                (scrY/2)+100 . " w50",              Prone
  446.         Gui,    inputBGUI:          Add,    Text,       % "center 0x201 BackGroundTrans c00FF00 x" .                                (scrX/2)+25. " y" .                 (scrY/2)+85 . " w50",               Sprint
  447.         WinSet, TransColor,         %UIRGB% 31
  448.         }
  449.     Gui,    inputUI:            Color,  %UIRGB% ;Inputs
  450.     Gui     inputUI:            +LastFound +AlwaysOnTop -Caption +ToolWindow +Disabled +E0x20
  451.     Gui,    inputUI:            Font,   s36,        Arial
  452.     if showUI_Directionals{ ;Directonal arrows
  453.         Gui,    inputUI:        Add,    Text,       % "center 0x201 BackGroundTrans vmoveForwardText c" .   UIKeyOff . " x" .       (scrX/2)-25 . " y" .                ((scrY/2)-59)-inputUIGap . " w50",  ^
  454.         Gui,    inputUI:        Add,    Text,       % "center 0x201 BackGroundTrans vmoveLeftText c" .      UIKeyOff . " x" .       ((scrX/2)-67)-inputUIGap . " y" .   (scrY/2)-28 . " w50",               <
  455.         Gui,    inputUI:        Add,    Text,       % "center 0x201 BackGroundTrans vmoveRightText c" .     UIKeyOff . " x" .       ((scrX/2)+17)+inputUIGap . " y" .   (scrY/2)-28 . " w50",               >
  456.         Gui,    inputUI:        Font,   s31,        Arial
  457.         Gui,    inputUI:        Add,    Text,       % "center 0x201 BackGroundTrans vmoveBackwardText c" .  UIKeyOff . " x" .       (scrX/2)-24 . " y" .                ((scrY/2)+14)+inputUIGap . " w50",  v
  458.         }
  459.     Gui,    inputUI:            Font,   s24,        Arial
  460.     Gui,    inputUI:            Add,    Text,       % "center 0x201 BackGroundTrans vjumpText c" .          UIKeyOff . " x" .       (scrX/2)-40 . " y" .                (scrY/2)+40 . " w50",               Jump
  461.     Gui,    inputUI:            Font,   s20,        Arial
  462.     Gui,    inputUI:            Add,    Text,       % "center 0x201 BackGroundTrans vmeleeText c" .         UIKeyOff . " x" .       (scrX/2)-40 . " y" .                (scrY/2)-135 . " w50",              Melee
  463.     Gui,    inputUI:            Add,    Text,       % "center 0x201 BackGroundTrans vfireText c" .          UIKeyOff . " x" .       (scrX/2)-90 . " y" .                (scrY/2)-105 . " w50",              Fire
  464.     Gui,    inputUI:            Add,    Text,       % "center 0x201 BackGroundTrans vaimText c" .           UIKeyOff . " x" .       (scrX/2)+40 . " y" .                (scrY/2)-105 . " w50",              Aim
  465.     Gui,    inputUI:            Add,    Text,       % "center 0x201 BackGroundTrans vcrouchText c" .        UIKeyOff . " x" .       (scrX/2)-115. " y" .                (scrY/2)+70 . " w50",               Crouch
  466.     Gui,    inputUI:            Add,    Text,       % "center 0x201 BackGroundTrans vproneText c" .         UIKeyOff . " x" .       (scrX/2)-105. " y" .                (scrY/2)+100 . " w50",              Prone
  467.     Gui,    inputUI:            Add,    Text,       % "center 0x201 BackGroundTrans vsprintText c" .        UIKeyOff . " x" .       (scrX/2)+25. " y" .                 (scrY/2)+85 . " w50",               Sprint
  468.     WinSet, TransColor,         %UIRGB% 255
  469.     }
  470.  
  471. if showUI_firingMode{
  472.     Gui,    firingModeHip:      Color,  %UIRGB% ;Hipfire Firing Mode
  473.     Gui     firingModeHip:      +LastFound +AlwaysOnTop -Caption +ToolWindow     +Disabled +E0x20
  474.     Gui,    firingModeHip:      Add,    Picture,    vfiringModeHipImageOff      +BackgroundTrans X0 Y0 W64 H64, %imgFiringModeOff%
  475.     Gui,    firingModeHip:      Add,    Picture,    vfiringModeHipImageSemi     +BackgroundTrans X0 Y0 W64 H64, %imgFiringModeSemi%
  476.     Gui,    firingModeHip:      Add,    Picture,    vfiringModeHipImageBurst2   +BackgroundTrans X0 Y0 W64 H64, %imgFiringModeBurst2%
  477.     Gui,    firingModeHip:      Add,    Picture,    vfiringModeHipImageBurst1   +BackgroundTrans X0 Y0 W64 H64, %imgFiringModeBurst1%
  478.     Gui,    firingModeHip:      Add,    Picture,    vfiringModeHipImageAuto     +BackgroundTrans X0 Y0 W64 H64, %imgFiringModeAuto2%
  479.     Gui,    firingModeHip:      Add,    Picture,    vfiringModeHipImageDefault  +BackgroundTrans X0 Y0 W64 H64, %imgFiringModeAuto1%
  480.     WinSet, TransColor,     %UIRGB% 255
  481.     Gui,    firingModeADS:      Color,  %UIRGB% ;ADS Firing Mode
  482.     Gui     firingModeADS:      +LastFound +AlwaysOnTop -Caption +ToolWindow     +Disabled +E0x20
  483.     Gui,    firingModeADS:      Add,    Picture,    vfiringModeADSImageOff      +BackgroundTrans X0 Y0 W64 H64, %imgFiringModeOff%
  484.     Gui,    firingModeADS:      Add,    Picture,    vfiringModeADSImageSemi     +BackgroundTrans X0 Y0 W64 H64, %imgFiringModeSemi%
  485.     Gui,    firingModeADS:      Add,    Picture,    vfiringModeADSImageBurst2   +BackgroundTrans X0 Y0 W64 H64, %imgFiringModeBurst2%
  486.     Gui,    firingModeADS:      Add,    Picture,    vfiringModeADSImageBurst1   +BackgroundTrans X0 Y0 W64 H64, %imgFiringModeBurst1%
  487.     Gui,    firingModeADS:      Add,    Picture,    vfiringModeADSImageAuto     +BackgroundTrans X0 Y0 W64 H64, %imgFiringModeAuto2%
  488.     Gui,    firingModeADS:      Add,    Picture,    vfiringModeADSImageDefault  +BackgroundTrans X0 Y0 W64 H64, %imgFiringModeAuto1%
  489.     WinSet, TransColor,     %UIRGB% 255
  490.     Gui,    firingModeHipDark:  Color, 0x000000 ; HipFire darkening
  491.     Gui     firingModeHipDark:  +LastFound +AlwaysOnTop -Caption +ToolWindow +Disabled +E0x20
  492.     WinSet, Transparent, 127
  493.     Gui,    firingModeADSDark:  Color, 0x000000 ; ADS darkening
  494.     Gui     firingModeADSDark:  +LastFound +AlwaysOnTop -Caption +ToolWindow +Disabled +E0x20
  495.     WinSet, Transparent, 127
  496.     }
  497.  
  498. setRetCoords(){ ;UI - Crosshair - re-calculate crosshair coordinates (f this finnicky ass s)
  499.     if showUI_Ret{
  500.         debugRet()
  501.         CircleB_Outer   := "0"
  502.         CircleB_Inner   := "0"
  503.         CircleW_Outer   := "0"
  504.         CircleW_Inner   := "0"
  505.         retLengthOutline    := retLength+(retOutline*2)
  506.         retDotOutlineSize   := retDotSize+(retDotOutline*2)
  507.         retWidthOutline     := retWidth+(retOutline*2)
  508.         U_whiteX            :=Round((((GUISizeRet)-retWidth)        /2))
  509.         U_whiteY            :=Round((((GUISizeRet)-retLength)       /2) -(retLength/2)  -retGap)
  510.         D_whiteX            :=Round((((GUISizeRet)-retWidth)        /2))
  511.         D_whiteY            :=Round((((GUISizeRet)-retLength)       /2) +(retLength/2)  +retGap)
  512.         L_whiteX            :=Round((((GUISizeRet)-retLength)       /2) -(retLength/2)  -retGap)
  513.         L_whiteY            :=Round((((GUISizeRet)-retWidth)        /2))
  514.         R_whiteX            :=Round((((GUISizeRet)-retLength)       /2) +(retLength/2)  +retGap)
  515.         R_whiteY            :=Round((((GUISizeRet)-retWidth)        /2))
  516.         M_whiteX            :=Round((((GUISizeRet)-retDotSize)      /2))
  517.         M_whiteY            :=Round((((GUISizeRet)-retDotSize)      /2))
  518.         U_blackHX           :=Round((((GUISizeRet)-retWidth)        /2)                             -retOutline)
  519.         U_blackHY           :=Round((((GUISizeRet)-retLength)       /2) -(retLength/2)  -retGap)
  520.         D_blackHX           :=Round((((GUISizeRet)-retWidth)        /2)                             -retOutline)
  521.         D_blackHY           :=Round((((GUISizeRet)-retLength)       /2) +(retLength/2)  +retGap)
  522.         L_blackHX           :=Round((((GUISizeRet)-retLength)       /2) -(retLength/2)  -retGap)
  523.         L_blackHY           :=Round((((GUISizeRet)-retWidth)        /2)                             -retOutline)
  524.         R_blackHX           :=Round((((GUISizeRet)-retLength)       /2) +(retLength/2)  +retGap)
  525.         R_blackHY           :=Round((((GUISizeRet)-retWidth)        /2)                             -retOutline)
  526.         U_blackVX           :=Round((((GUISizeRet)-retWidth)        /2))
  527.         U_blackVY           :=Round(((((GUISizeRet)-retLength)      /2) -(retLength/2)  -retGap)    -retOutline)
  528.         D_blackVX           :=Round((((GUISizeRet)-retWidth)        /2))
  529.         D_blackVY           :=Round(((((GUISizeRet)-retLength)      /2) +(retLength/2)  +retGap)    -retOutline)
  530.         L_blackVX           :=Round(((((GUISizeRet)-retLength)      /2) -(retLength/2)  -retGap)    -retOutline)
  531.         L_blackVY           :=Round((((GUISizeRet)-retWidth)        /2))
  532.         R_blackVX           :=Round(((((GUISizeRet)-retLength)      /2) +(retLength/2)  +retGap)    -retOutline)
  533.         R_blackVY           :=Round((((GUISizeRet)-retWidth)        /2))
  534.         M_blackHX           :=Round((((GUISizeRet)-retDotSize)      /2)                             -retDotOutline)
  535.         M_blackHY           :=Round((((GUISizeRet)-retDotSize)      /2))
  536.         M_blackVX           :=Round((((GUISizeRet)-retDotSize)      /2))
  537.         M_blackVY           :=Round((((GUISizeRet)-retDotSize)      /2)                             -retDotOutline)
  538.         Circle_UL           :=Round((((GUISizeRet)                  /2) -(retCircleRadius*2)))
  539.         Circle_DR           :=Round((((GUISizeRet)                  /2) +(retCircleRadius*2)        +1))
  540.         CircleW_Inner       :=Rgn_CreateEllipticRgn(Circle_UL, Circle_UL, Circle_DR, Circle_DR)
  541.         CircleW_Outer_UL    :=Circle_UL-Round(retCircleThickness)
  542.         CircleW_Outer_DR    :=Circle_DR+Round(retCircleThickness)
  543.         CircleW_Outer       :=Rgn_CreateEllipticRgn(CircleW_Outer_UL, CircleW_Outer_UL, CircleW_Outer_DR, CircleW_Outer_DR)
  544.         CircleB_Inner_UL    :=Circle_UL+Round(retCircleOutline)
  545.         CircleB_Inner_DR    :=Circle_DR-Round(retCircleOutline)
  546.         CircleB_Inner       :=Rgn_CreateEllipticRgn(CircleB_Inner_UL, CircleB_Inner_UL, CircleB_Inner_DR, CircleB_Inner_DR)
  547.         CircleB_Outer_UL    :=CircleW_Outer_UL-Round(retCircleOutline)
  548.         CircleB_Outer_DR    :=CircleW_Outer_DR+Round(retCircleOutline)
  549.         CircleB_Outer       :=Rgn_CreateEllipticRgn(CircleB_Outer_UL, CircleB_Outer_UL, CircleB_Outer_DR, CircleB_Outer_DR)
  550.         CircleW_GapTL       :=Round(((GUISizeRet)-retCircleGap) /2)
  551.         CircleW_GapBR       :=Round(((GUISizeRet)+retCircleGap) /2)
  552.         CircleW_GapV        :=Rgn_CreateRectRgn(CircleW_GapTL, 0, CircleW_GapBR, GUISizeRet)
  553.         CircleW_GapH        :=Rgn_CreateRectRgn(0, CircleW_GapTL, GUISizeRet, CircleW_GapBR)
  554.         CircleB_GapTL       :=CircleW_GapTL+Round(retCircleOutline)
  555.         CircleB_GapBR       :=CircleW_GapBR-Round(retCircleOutline)
  556.         CircleB_GapV        :=Rgn_CreateRectRgn(CircleB_GapTL, 0, CircleB_GapBR, GUISizeRet)
  557.         CircleB_GapH        :=Rgn_CreateRectRgn(0, CircleB_GapTL, GUISizeRet, CircleB_GapBR)
  558.        
  559.         drawCrosshair()
  560.         }
  561.     return
  562.     }
  563.  
  564. drawCrosshair(){ ;Draw the crosshar - Black to White, Cross, Dot, to Circle in that order
  565.     GuiControl, Move,   %retUp_blackH%,     W%retWidthOutline%      H%retLength%            X%U_blackHX%    Y%U_blackHY%
  566.     GuiControl, Move,   %retUp_blackV%,     W%retWidth%             H%retLengthOutline%     X%U_blackVX%    Y%U_blackVY%
  567.     GuiControl, Move,   %retDown_blackH%,   W%retWidthOutline%      H%retLength%            X%D_blackHX%    Y%D_blackHY%
  568.     GuiControl, Move,   %retDown_blackV%,   W%retWidth%             H%retLengthOutline%     X%D_blackVX%    Y%D_blackVY%
  569.     GuiControl, Move,   %retLeft_blackV%,   W%retLengthOutline%     H%retWidth%             X%L_blackVX%    Y%L_blackVY%
  570.     GuiControl, Move,   %retLeft_blackH%,   W%retLength%            H%retWidthOutline%      X%L_blackHX%    Y%L_blackHY%
  571.     GuiControl, Move,   %retRight_blackV%,  W%retLengthOutline%     H%retWidth%             X%R_blackVX%    Y%R_blackVY%
  572.     GuiControl, Move,   %retRight_blackH%,  W%retLength%            H%retWidthOutline%      X%R_blackHX%    Y%R_blackHY%
  573.     GuiControl, Move,   %retCenter_blackH%, W%retDotOutlineSize%    H%retDotSize%           X%M_blackHX%    Y%M_blackHY%
  574.     GuiControl, Move,   %retCenter_blackV%, W%retDotSize%           H%retDotOutlineSize%    X%M_blackVX%    Y%M_blackVY%
  575.     GuiControl, Move,   %retUp_white%,      W%retWidth%             H%retLength%            X%U_whiteX%     Y%U_whiteY%
  576.     GuiControl, Move,   %retDown_white%,    W%retWidth%             H%retLength%            X%D_whiteX%     Y%D_whiteY%
  577.     GuiControl, Move,   %retLeft_white%,    W%retLength%            H%retWidth%             X%L_whiteX%     Y%L_whiteY%
  578.     GuiControl, Move,   %retRight_white%,   W%retLength%            H%retWidth%             X%R_whiteX%     Y%R_whiteY%
  579.     GuiControl, Move,   %retCenter_white%,  W%retDotSize%           H%retDotSize%           X%M_whiteX%     Y%M_whiteY%
  580.     Rgn_CombineRgn(CircleB_Outer, CircleB_Outer, CircleB_Inner, 3)  ; Circle outline - Cut out inner circle
  581.     Rgn_CombineRgn(CircleB_Outer, CircleB_Outer, CircleB_GapV, 4)   ; Circle outline - Cut out vertical gap
  582.     Rgn_CombineRgn(CircleB_Outer, CircleB_Outer, CircleB_GapH, 4)   ; Circle outline - Cut out horizontal gap
  583.     Rgn_CombineRgn(CircleW_Outer, CircleW_Outer, CircleW_Inner, 3)  ; Circle - Cut out inner circle
  584.     Rgn_CombineRgn(CircleW_Outer, CircleW_Outer, CircleW_GapV, 4)   ; Circle - Cut out vertical gap
  585.     Rgn_CombineRgn(CircleW_Outer, CircleW_Outer, CircleW_GapH, 4)   ; Circle - Cut out horizontal gap
  586.     Rgn_SetWindowRgn(HWNDCircleB, CircleB_Outer, true)              ; Circle outline - Apply shape to window
  587.     Rgn_SetWindowRgn(HWNDCircleW, CircleW_Outer, true)              ; Circle - Apply shape to window
  588.     Rgn_DeleteRgn(CircleB_Outer)                                    ; Clear the created regions to free system memory
  589.     Rgn_DeleteRgn(CircleB_Inner)
  590.     Rgn_DeleteRgn(CircleW_Outer)
  591.     Rgn_DeleteRgn(CircleW_Inner)
  592.     Rgn_DeleteRgn(CircleB_GapV)
  593.     Rgn_DeleteRgn(CircleB_GapH)
  594.     Rgn_DeleteRgn(CircleW_GapV)
  595.     Rgn_DeleteRgn(CircleW_GapH)
  596.     return
  597.     }
  598.  
  599. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  600. ;; CROSSHAIR CIRCLE DLL CALLS ;;
  601. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  602. ;https://www.autohotkey.com/boards/viewtopic.php?t=30622#p143283
  603. Rgn_CreateEllipticRgn(Left, Top, Right, Bottom) { ;Create an elipse regoin
  604.    Return DllCall("CreateEllipticRgn", "Int", Left, "Int", Top, "Int", Right, "Int", Bottom, "UPtr")
  605. }
  606.  
  607. Rgn_CreateRectRgn(Left, Top, Right, Bottom) { ;Create a rectangle region
  608.    Return DllCall("CreateRectRgn", "Int", Left, "Int", Top, "Int", Right, "Int", Bottom, "UPtr")
  609. }
  610.  
  611. Rgn_CombineRgn(HRGNC, HRGN1, HRGN2, Mode) { ;Combine regions
  612.    Return DllCall("CombineRgn", "Ptr", HRGNC, "Ptr", HRGN1, "Ptr", HRGN2, "Int", Mode, "Int")
  613. }
  614.  
  615. Rgn_SetWindowRgn(HWND, HRGN, Redraw := True) { ;Set window region
  616.    Return DllCall("SetWindowRgn", "Ptr", HWND, "Ptr", HRGN, "UInt", !!Redraw, "Int")
  617. }
  618.  
  619. ;https://www.autohotkey.com/docs/commands/DllCall.htm#ExStructRect
  620. Rgn_DeleteRgn(HRGN) { ;Delete selected region to clear system memory
  621.    Return DllCall("DeleteObject", "Ptr", HRGN, "UInt")
  622. }
  623.  
  624. loadUI(){ ;Load the UI
  625.     setTimer, loadUI1, % tick(90)
  626.     return
  627.     }
  628.  
  629. loadUI1:
  630.     {
  631.     setTimer, loadUI1, off
  632.     setTimer, loadUI2, % tick(90)
  633.     updateFiringModeHipUI()
  634.     updateFiringModeADSUI()
  635.     retState()
  636.     return
  637.     }
  638.  
  639. loadUI2:
  640.     {
  641.     UI_Show()
  642.     UI_forceTop()
  643.     setTimer, loadUI2, off
  644.     return
  645.     }
  646.  
  647. checkWindow(){ ;Check to see if the game window is active
  648.     setTimer, checkWindow, % tick(300)
  649.     return 
  650.     }
  651.  
  652. checkWindow:
  653.     {
  654.     setTimer, checkWindow, Off
  655.     if (WinActive("ironsight")
  656.     OR WinActive("Visual Studio")){
  657.         if !windowSelected{
  658.             windowSelected := "1"
  659.             UI_Show()
  660.             UI_forceTop()
  661.             return
  662.             }
  663.         }
  664.     else{
  665.         windowSelected  := "0"
  666.         UI_hide()
  667.         return
  668.         }
  669.     return
  670.     }
  671.  
  672. UI_show(){ ;Show the UI
  673.     if (showUI){
  674.         UI_showInputs()
  675.         UI_showRet()
  676.         UI_showFiringModes()
  677.         UI_forceTop()
  678.         }
  679.     return
  680.     }
  681.  
  682. UI_showInputs(){ ;Show input overlay
  683.     if showUI_Inputs{
  684.         if showUI_InputBG{
  685.             Gui,        inputBGUI:      Show,% "W" . scrX . " H" . scrY . " X0 Y0 NoActivate"
  686.             }
  687.         if showUI_Inputs{          
  688.             Gui,        inputUI:        Show,% "W" . scrX . " H" . scrY . " X0 Y0 NoActivate"
  689.             }
  690.         }
  691.     Return
  692.     }
  693.  
  694. UI_showRet(){ ;Show reticle: Black to White, Cross, Dot to Circle in that order
  695.     if showUI_Ret{
  696.         if showUI_RetCross{
  697.             Gui     retUI_CROSSB:   +LastFound +AlwaysOnTop -Caption +ToolWindow +Disabled +E0x20
  698.             Gui,    retUI_CROSSB:   Show,% "W" . GUISizeRet . " H" . GUISizeRet . " X" . (((scrx-(GUISizeRet))/2)+retOffsetX) . " Y" . (((scry-(GUISizeRet))/2)+retOffsetY) . " NoActivate"
  699.             }
  700.         if showUI_RetDot{
  701.             Gui     retUI_DOTB:     +LastFound +AlwaysOnTop -Caption +ToolWindow +Disabled +E0x20
  702.             Gui,    retUI_DOTB:     Show,% "W" . GUISizeRet . " H" . GUISizeRet . " X" . (((scrx-(GUISizeRet))/2)+retOffsetX) . " Y" . (((scry-(GUISizeRet))/2)+retOffsetY) . " NoActivate"
  703.             }
  704.         if showUI_RetCircle{
  705.             Gui     retUI_CIRCLEB:  +LastFound +AlwaysOnTop -Caption +ToolWindow +Disabled +E0x20
  706.             Gui,    retUI_CIRCLEB:  Show,% "W" . GUISizeRet . " H" . GUISizeRet . " X" . (((scrx-(GUISizeRet))/2)+retOffsetX) . " Y" . (((scry-(GUISizeRet))/2)+retOffsetY) . " NoActivate"
  707.             }
  708.         if showUI_RetCross{
  709.             Gui     retUI_CROSSW:   +LastFound +AlwaysOnTop -Caption +ToolWindow +Disabled +E0x20
  710.             Gui,    retUI_CROSSW:   Show,% "W" . GUISizeRet . " H" . GUISizeRet . " X" . (((scrx-(GUISizeRet))/2)+retOffsetX) . " Y" . (((scry-(GUISizeRet))/2)+retOffsetY) . " NoActivate"
  711.             }
  712.         if showUI_RetDot{
  713.             Gui     retUI_DOTW:     +LastFound +AlwaysOnTop -Caption +ToolWindow +Disabled +E0x20
  714.             Gui,    retUI_DOTW:     Show,% "W" . GUISizeRet . " H" . GUISizeRet . " X" . (((scrx-(GUISizeRet))/2)+retOffsetX) . " Y" . (((scry-(GUISizeRet))/2)+retOffsetY) . " NoActivate"
  715.             }
  716.         if showUI_RetCircle{
  717.             Gui     retUI_CIRCLEW:  +LastFound +AlwaysOnTop -Caption +ToolWindow +Disabled +E0x20
  718.             Gui,    retUI_CIRCLEW:  Show,% "W" . GUISizeRet . " H" . GUISizeRet . " X" . (((scrx-(GUISizeRet))/2)+retOffsetX) . " Y" . (((scry-(GUISizeRet))/2)+retOffsetY) . " NoActivate"
  719.             }
  720.         }
  721.     return
  722.     }
  723.  
  724. UI_showFiringModes(){ ;Show Firing Modes
  725.     if showUI_firingMode{
  726.         Gui,        firingModeHip:      Show,W64 H64 X1692 Y869 NoActivate
  727.         Gui,        firingModeHipDark:  Show,W64 H64 X1692 Y869 NoActivate
  728.         Gui,        firingModeADS:      Show,W64 H64 X1756 Y869 NoActivate
  729.         Gui,        firingModeADSDark:  Show,W64 H64 X1756 Y869 NoActivate
  730.         }
  731.     return
  732.     }
  733.  
  734. UI_hide(){ ;Hide UI
  735.     UI_hideRet()
  736.     UI_hideInputs()
  737.     UI_hideFiringModes()
  738.     return
  739.     }
  740.  
  741. UI_hideRet(){ ;Hide reticle
  742.     Gui retUI_CIRCLEB:      hide
  743.     Gui retUI_CROSSB:       hide
  744.     Gui retUI_DOTB:         hide
  745.     Gui retUI_CIRCLEW:      hide
  746.     Gui retUI_CROSSW:       hide
  747.     Gui retUI_DOTW:         hide
  748.     return
  749.     }
  750.  
  751. UI_hideInputs(){ ;Hide Input Overlay
  752.     Gui inputBGUI:          hide
  753.     Gui inputUI:            hide
  754.     return
  755.     }
  756.  
  757. UI_hideFiringModes(){ ;Hide Firing Modes
  758.     Gui firingModeHip:      hide
  759.     Gui firingModeADS:      hide
  760.     Gui firingModeHipDark:  hide
  761.     Gui firingModeADSdark:  hide
  762.     }
  763.  
  764. UI_forceTop(){ ;Force the UI to render over active window
  765.     Gui retUI_DOTB:         +AlwaysOnTop
  766.     Gui retUI_CROSSB:       +AlwaysOnTop
  767.     Gui retUI_CIRCLEB:      +AlwaysOnTop
  768.     Gui retUI_DOTW:         +AlwaysOnTop
  769.     Gui retUI_CROSSW:       +AlwaysOnTop
  770.     Gui retUI_CIRCLEW:      +AlwaysOnTop
  771.     Gui inputBGUI:          +AlwaysOnTop
  772.     Gui inputUI:            +AlwaysOnTop
  773.     Gui firingModeHip:      +AlwaysOnTop
  774.     Gui firingModeADS:      +AlwaysOnTop
  775.     Gui firingModeHipDark:  +AlwaysOnTop
  776.     Gui firingModeADSdark:  +AlwaysOnTop
  777.     return
  778.     }
  779.  
  780. UI_refreshCircle(){ ;Refresh the crosshair circle
  781.     Gui,    retUI_CIRCLEB:  Show, W1 H1 X1 Y1 NoActivate
  782.     Gui,    retUI_CIRCLEW:  Show, W1 H1 X1 Y1 NoActivate
  783.     createGUI_retUI_CIRCLEB()
  784.     createGUI_retUI_CIRCLEW()
  785.     Gui     retUI_CIRCLEB:  +LastFound +AlwaysOnTop -Caption +ToolWindow +Disabled +E0x20
  786.     Gui     retUI_CIRCLEW:  +LastFound +AlwaysOnTop -Caption +ToolWindow +Disabled +E0x20
  787.     drawCrosshair()
  788.     Gui,    retUI_CIRCLEB:  Show,% "W" . GUISizeRet . " H" . GUISizeRet . " X" . (((scrx-(GUISizeRet))/2)+retOffsetX) . " Y" . (((scry-(GUISizeRet))/2)+retOffsetY) . " NoActivate"
  789.     Gui,    retUI_CIRCLEW:  Show,% "W" . GUISizeRet . " H" . GUISizeRet . " X" . (((scrx-(GUISizeRet))/2)+retOffsetX) . " Y" . (((scry-(GUISizeRet))/2)+retOffsetY) . " NoActivate"
  790.     return
  791.     }
  792.  
  793. retState(s:=0){ ;Reticle state settings
  794.     aniFrameRate                        := "1"
  795.     switch s{
  796.         case 1:
  797.             enableRetStateAnimation     := "1"
  798.             showUI_RetDot               := "1"
  799.             showUI_RetCross             := "1"
  800.             showUI_RetCircle            := "1"
  801.             aniOnResetShowCross         := "1"
  802.             aniOnResetShowDot           := "1"
  803.             aniStepsGrow                := (36/aniFrameRate)
  804.             aniStepsDecay               := (aniStepsGrow/3)
  805.             retGap                      := "15"
  806.             retLength                   := "25"
  807.             retWidth                    := "2"
  808.             retOutline                  := "1"
  809.             retDotSize                  := "2"
  810.             retDotOutline               := "0"
  811.             retCircleRadius             := "14"
  812.             retCircleThickness          := "2"
  813.             retCircleOutline            := "0"
  814.             retCircleGap                := "7"
  815.             aniMaxGap                   := "40"
  816.             aniMaxLength                := "25"
  817.             aniMaxWidth                 := "2"
  818.             aniMaxOutline               := "1"
  819.             aniMaxDotSize               := "4"
  820.             aniMaxDotOutline            := "1"
  821.             aniMaxCircleRadius          := "20"
  822.             aniMaxCircleThickness       := "2"
  823.             aniMaxCircleOutline         := "1"
  824.             aniMaxCircleGap             := "14"
  825.             aniSnapStep                 := "0.275"
  826.         case 2:
  827.             enableRetStateAnimation     := "1"
  828.             showUI_RetDot               := "1"
  829.             showUI_RetCross             := "1"
  830.             showUI_RetCircle            := "1"
  831.             aniOnResetShowCross         := "1"
  832.             aniOnResetShowDot           := "1"
  833.             aniStepsGrow                := (24/aniFrameRate)
  834.             aniStepsDecay               := (aniStepsGrow/3)
  835.             retGap                      := "13"
  836.             retLength                   := "5"
  837.             retWidth                    := "2"
  838.             retOutline                  := "1"
  839.             retDotSize                  := "2"
  840.             retDotOutline               := "0"
  841.             retCircleRadius             := "8"
  842.             retCircleThickness          := "1"
  843.             retCircleOutline            := "0"
  844.             retCircleGap                := "5"
  845.             aniMaxGap                   := "17"
  846.             aniMaxLength                := "3"
  847.             aniMaxWidth                 := "4"
  848.             aniMaxOutline               := "1"
  849.             aniMaxDotSize               := "2"
  850.             aniMaxDotOutline            := "1"
  851.             aniMaxCircleRadius          := "10"
  852.             aniMaxCircleThickness       := "1"
  853.             aniMaxCircleOutline         := "1"
  854.             aniMaxCircleGap             := "8"
  855.             aniSnapStep                 := "0.3"
  856.         default:
  857.             enableRetStateAnimation     := "1"
  858.             showUI_RetDot               := "1"
  859.             showUI_RetCross             := "1"
  860.             showUI_RetCircle            := "1"
  861.             aniOnResetShowCross         := "1"
  862.             aniOnResetShowDot           := "1"
  863.             aniStepsGrow                := (24/aniFrameRate)
  864.             aniStepsDecay               := (aniStepsGrow/3)
  865.             retGap                      := "1"
  866.             retLength                   := "2"
  867.             retWidth                    := "2"
  868.             retOutline                  := "1"
  869.             retDotSize                  := "2"
  870.             retDotOutline               := "1"
  871.             retCircleRadius             := "5"
  872.             retCircleThickness          := "1"
  873.             retCircleOutline            := "0"
  874.             retCircleGap                := "10"
  875.             aniMaxGap                   := "2"
  876.             aniMaxLength                := "2"
  877.             aniMaxWidth                 := "4"
  878.             aniMaxOutline               := "2"
  879.             aniMaxDotSize               := "4"
  880.             aniMaxDotOutline            := "2"
  881.             aniMaxCircleRadius          := "10"
  882.             aniMaxCircleThickness       := "2"
  883.             aniMaxCircleOutline         := "1"
  884.             aniMaxCircleGap             := "10"
  885.             aniSnapStep                 := "0.2"
  886.         }      
  887.     aniMinGap                       := retGap
  888.     aniMinLength                    := retLength
  889.     aniMinWidth                     := retWidth
  890.     aniMinOutline                   := retOutline  
  891.     aniMinDotSize                   := retDotSize
  892.     aniMinDotOutline                := retDotOutline
  893.     aniMinCircleRadius              := retCircleRadius
  894.     aniMinCircleThickness           := retCircleThickness
  895.     aniMinCircleOutline             := retCircleOutline
  896.     aniMinCircleGap                 := retCircleGap
  897.     aniRateGrowGap                  := round((aniMaxGap             -retGap)                / aniStepsGrow)
  898.     aniRateGrowLength               := round((aniMaxLength          -retLength)             / aniStepsGrow)
  899.     aniRateGrowWidth                := round((aniMaxWidth           -retWidth)              / aniStepsGrow)
  900.     aniRateGrowOutline              := round((aniMaxOutline         -retOutline)            / aniStepsGrow)*8
  901.     aniRateGrowDotSize              := round((aniMaxDotSize         -retDotSize)            / aniStepsGrow)*8
  902.     aniRateGrowDotOutline           := round((aniMaxDotOutline      -retDotOutline)         / aniStepsGrow)*8
  903.     aniRateGrowCircleRadius         := round((aniMaxCircleRadius    -retCircleRadius)       / aniStepsGrow)
  904.     aniRateGrowCircleThickness      := round((aniMaxCircleThickness -retCircleThickness)    / aniStepsGrow)*8
  905.     aniRateGrowCircleOutline        := round((aniMaxCircleOutline   -retCircleOutline)      / aniStepsGrow)*8
  906.     aniRateGrowCircleGap            := round((aniMaxCircleGap       -retCircleGap)          / aniStepsGrow)*8
  907.     aniRateDecayGap                 := round((aniMaxGap             -retGap)                / aniStepsDecay)
  908.     aniRateDecayLength              := round((aniMaxLength          -retLength)             / aniStepsDecay)
  909.     aniRateDecayWidth               := round((aniMaxWidth           -retWidth)              / aniStepsDecay)
  910.     aniRateDecayOutline             := round((aniMaxOutline         -retOutline)            / aniStepsDecay)
  911.     aniRateDecayDotSize             := round((aniMaxDotSize         -retDotSize)            / aniStepsDecay)
  912.     aniRateDecayDotOutline          := round((aniMaxDotOutline      -retDotOutline)         / aniStepsDecay)
  913.     aniRateDecayCircleRadius        := round((aniMaxCircleRadius    -retCircleRadius)       / aniStepsDecay)
  914.     aniRateDecayCircleThickness     := round((aniMaxCircleThickness -retCircleThickness)    / aniStepsDecay)
  915.     aniRateDecayCircleOutline       := round((aniMaxCircleOutline   -retCircleOutline)      / aniStepsDecay)
  916.     aniRateDecayCircleGap           := round((aniMaxCircleGap       -retCircleGap)          / aniStepsDecay)
  917.     setRetCoords() 
  918.     return
  919.     }
  920.  
  921. ani_Snap(){ ;Reticle snap animation
  922.     setTimer, ani_Decay, off
  923.     setTimer, ani_Grow, off
  924.     if showUI_RetAnimate
  925.         {
  926.         retAniProgress := (retAniProgress+(aniSnapStep))
  927.         if (retAniProgress >= "1"){
  928.             retAniProgress := "1"
  929.             }
  930.         setTimer, delayDecay, % tick(aniFrameRate)
  931.         }
  932.     return
  933.     }
  934.  
  935. easeOutSine(x){ ;https://easings.net/#easeOutSine
  936.     sRetMotion := "Sine Ease Out"
  937.     return (sin((x * PI) / 2))
  938.     }
  939.  
  940. easeInOutSine(x){ ;https://easings.net/#easeInOutSine
  941.     sRetMotion := "Sine Ease In/Out"
  942.     return -(cos(PI * x) - 1) / 2
  943.     }
  944.  
  945. Rounding(i1,i2) { ;Round i1 by intervals of i2 https://www.autohotkey.com/board/topic/97252-round-by-05/?p=619632
  946.     return, % (i1-(floor(i1/i2)*i2) >= (i2/2)) ? (floor(i1/i2)*i2)+i2 : (floor(i1/i2)*i2)
  947.     }
  948.  
  949. ani_Grow(){ ;Reticle grow animation
  950.     if showUI_RetAnimate{
  951.         doneGrow := 0
  952.         showUI_RetCross := 1
  953.         showUI_RetDot   := 1
  954.         setTimer, ani_Decay, off
  955.         setTimer, ani_Grow, % tick(aniFrameRate)
  956.         goSub ani_Grow
  957.         }
  958.     return
  959.     }
  960.  
  961. delayDecay:
  962.     {
  963.     setTimer, delayDecay, off
  964.     ani_Decay()
  965.     return
  966.     }
  967.  
  968. ani_Decay(){ ;Reticle decay animation
  969.     if showUI_RetAnimate{
  970.         doneDecay := 0
  971.         showUI_RetCross := 1
  972.         showUI_RetDot   := 1
  973.         setTimer, ani_Grow, off
  974.         setTimer, ani_Decay, % tick(aniFrameRate)
  975.         goSub ani_Decay
  976.         }
  977.     return
  978.     }
  979.  
  980. ani_Grow:
  981.     {
  982.     if (retAniProgress >= "1"){
  983.         doneGrow := "1"
  984.         }
  985.     if !doneGrow{
  986.         retAniProgress := (retAniProgress+(1/aniStepsGrow))
  987.         retAniCurved := (easeOutSine(retAniProgress))
  988.         sRetAction := "Grow"
  989.         setRetValues()
  990.         setTimer, ani_Grow, % tick(aniFrameRate)
  991.         }
  992.     if doneGrow{
  993.         retAniProgress := "1"
  994.         retAniCurved := "1"
  995.         setRetValuesMax()
  996.         setTimer, ani_Grow, off
  997.         }
  998.     setRetValues()
  999.     setRetCoords()
  1000.     return
  1001.     }
  1002.  
  1003. ani_Decay:
  1004.     {
  1005.     if (retAniProgress <= "0"){
  1006.         doneDecay := "1"
  1007.         }
  1008.     if !doneDecay{
  1009.         retAniProgress := (retAniProgress-(1/aniStepsDecay))
  1010.         retAniCurved := (easeInOutSine(retAniProgress))
  1011.         sRetAction := "Decay"
  1012.         setRetValues()
  1013.         setTimer, ani_Decay, % tick(aniFrameRate)
  1014.         }
  1015.     if doneDecay{
  1016.         retAniProgress := "0"
  1017.         retAniCurved := "0"
  1018.         setRetValuesMin()
  1019.         setTimer, ani_Decay, off
  1020.         }
  1021.     setRetCoords()
  1022.     return
  1023.     }
  1024.  
  1025. setRetValuesMin()
  1026.     {
  1027.     sRetMotion          := "None"
  1028.     sRetAction          := "None"
  1029.     retGap              := aniMinGap
  1030.     retLength           := aniMinLength
  1031.     retWidth            := aniMinWidth
  1032.     retOutline          := aniMinOutline
  1033.     retDotSize          := aniMinDotSize
  1034.     retDotOutline       := aniMinDotOutline
  1035.     retCircleRadius     := aniMinCircleRadius
  1036.     retCircleThickness  := aniMinCircleThickness
  1037.     retCircleOutline    := aniMinCircleOutline
  1038.     retCircleGap        := aniMinCircleGap
  1039.     }
  1040.  
  1041. setRetValuesMax()
  1042.     {
  1043.     sRetMotion          := "None"
  1044.     sRetAction          := "None"
  1045.     retGap              := aniMaxGap
  1046.     retLength           := aniMaxLength
  1047.     retWidth            := aniMaxWidth
  1048.     retOutline          := aniMaxOutline
  1049.     retDotSize          := aniMaxDotSize
  1050.     retDotOutline       := aniMaxDotOutline
  1051.     retCircleRadius     := aniMaxCircleRadius
  1052.     retCircleThickness  := aniMaxCircleThickness
  1053.     retCircleOutline    := aniMaxCircleOutline
  1054.     retCircleGap        := aniMaxCircleGap
  1055.     }
  1056.  
  1057. setRetValues(){
  1058.     retGap              := round(aniMinGap+((aniMaxGap-aniMinGap)*retAniCurved))
  1059.     retLength           := round(aniMinLength+((aniMaxLength-aniMinLength)*retAniCurved))
  1060.     retWidth            := Rounding((aniMinWidth+((aniMaxWidth-aniMinWidth)*retAniCurved)), 2)
  1061.     retOutline          := round(aniMinOutline+((aniMaxOutline-aniMinOutline)*retAniCurved))
  1062.     retDotSize          := Rounding((aniMinDotSize+((aniMaxDotSize-aniMinDotSize)*retAniCurved)), 2)
  1063.     retDotOutline       := round(aniMinDotOutline+((aniMaxDotOutline-aniMinDotOutline)*retAniCurved))
  1064.     retCircleRadius     := Rounding((aniMinCircleRadius+((aniMaxCircleRadius-aniMinCircleRadius)*retAniCurved)), 0.5)
  1065.     retCircleThickness  := round(aniMinCircleThickness+((aniMaxCircleThickness-aniMinCircleThickness)*retAniCurved))
  1066.     retCircleOutline    := round(aniMinCircleOutline+((aniMaxCircleOutline-aniMinCircleOutline)*retAniCurved))
  1067.     retCircleGap        := Rounding((aniMinCircleGap+((aniMaxCircleGap-aniMinCircleGap)*retAniCurved)), 2)
  1068.     return
  1069.     }
  1070.  
  1071. debugRet(){
  1072.     if debugRet{
  1073.         updateRetDebugText()
  1074.         }
  1075.     OutputDebug, CROSSHAIR / RETICULE DEBUG
  1076.     OutputDebug, RET DEBUG retAniProgress: %retAniProgress%
  1077.     OutputDebug, RET DEBUG retGap: %retGap%
  1078.     OutputDebug, RET DEBUG retLength: %retLength%
  1079.     OutputDebug, RET DEBUG retWidth: %retWidth%
  1080.     OutputDebug, RET DEBUG retOutline: %retOutline%
  1081.     OutputDebug, RET DEBUG retDotSize: %retDotSize%
  1082.     OutputDebug, RET DEBUG retDotOutline: %retDotOutline%
  1083.     OutputDebug, RET DEBUG retCircleRadius: %retCircleRadius%
  1084.     OutputDebug, RET DEBUG retCircleThickness: %retCircleThickness%
  1085.     OutputDebug, RET DEBUG retCircleOutline: %retCircleOutline%
  1086.     OutputDebug, RET DEBUG retCircleGap: %retCircleGap%
  1087.     return
  1088. }
  1089.  
  1090. updateInputUI(c:="",s:=""){ ;Update the input key text
  1091.     if showUI_Inputs{
  1092.         if ((c = "") || (c = UIKeyOff)){
  1093.                 GuiControl, inputUI: +c%UIKeyOff%, %s%,
  1094.                 gui,        inputUI: color
  1095.             }
  1096.         else{
  1097.                 GuiControl, inputUI: +c%c% +Redraw, %s%,
  1098.             }
  1099.         }
  1100.     return
  1101.     }
  1102.  
  1103. hideFiringModeHip(){ ;Hide firing mode images - HipFire
  1104.     if showUI_firingMode{
  1105.         GuiControl, firingModeHip:  Hide, firingModeHipImageOff
  1106.         GuiControl, firingModeHip:  Hide, firingModeHipImageDefault
  1107.         GuiControl, firingModeHip:  Hide, firingModeHipImageAuto
  1108.         GuiControl, firingModeHip:  Hide, firingModeHipImageBurst1
  1109.         GuiControl, firingModeHip:  Hide, firingModeHipImageBurst2
  1110.         GuiControl, firingModeHip:  Hide, firingModeHipImageSemi
  1111.         }
  1112.     return
  1113.     }
  1114.  
  1115. hideFiringModeADS(){ ;Hide firing mode images - ADS
  1116.     if showUI_firingMode{
  1117.         GuiControl, firingModeADS:  Hide, firingModeADSImageOff
  1118.         GuiControl, firingModeADS:  Hide, firingModeADSImageDefault
  1119.         GuiControl, firingModeADS:  Hide, firingModeADSImageAuto
  1120.         GuiControl, firingModeADS:  Hide, firingModeADSImageBurst1
  1121.         GuiControl, firingModeADS:  Hide, firingModeADSImageBurst2
  1122.         GuiControl, firingModeADS:  Hide, firingModeADSImageSemi
  1123.         }
  1124.     return
  1125.     }
  1126.  
  1127. updateFiringModeHipUI(s:="default"){ ;Update the firing mode image - HipFire
  1128.     if showUI_firingMode{
  1129.         hideFiringModeHip()
  1130.         switch s{
  1131.             case "default":
  1132.                 GuiControl, firingModeHip:  Show, firingModeHipImageDefault
  1133.             case "auto":
  1134.                 GuiControl, firingModeHip:  Show, firingModeHipImageAuto
  1135.             case "burst1":
  1136.                 GuiControl, firingModeHip:  Show, firingModeHipImageBurst1
  1137.             case "burst2":
  1138.                 GuiControl, firingModeHip:  Show, firingModeHipImageBurst2
  1139.  
  1140.             case "semi":
  1141.                 GuiControl, firingModeHip:  Show, firingModeHipImageSemi
  1142.             default:
  1143.                 msgbox ERROR in updateFiringModeHipUI() %firingModeHip%
  1144.             }
  1145.         }
  1146.     return
  1147.     }
  1148.  
  1149. updateFiringModeADSUI(s:="default"){ ;Update the firing mode image - ADS
  1150.     if showUI_firingMode{
  1151.         hideFiringModeADS()
  1152.         switch s{
  1153.             case "default":
  1154.                 GuiControl, firingModeADS:  Show, firingModeADSImageDefault
  1155.             case "auto":
  1156.                 GuiControl, firingModeADS:  Show, firingModeADSImageAuto
  1157.             case "burst1":
  1158.                 GuiControl, firingModeADS:  Show, firingModeADSImageBurst1
  1159.             case "burst2":
  1160.                 GuiControl, firingModeADS:  Show, firingModeADSImageBurst2
  1161.             case "semi":
  1162.                 GuiControl, firingModeADS:  Show, firingModeADSImageSemi
  1163.             default:
  1164.                 msgbox ERROR in updateFiringModeADSUI() %firingModeADS%
  1165.             }
  1166.         }
  1167.     return
  1168.     }
  1169.  
  1170. ;;;;;;;;;;;;;;
  1171. ;;INPUT KEYS;;
  1172. ;;;;;;;;;;;;;;
  1173. ~*f8::
  1174.     ani_Grow()
  1175.     return
  1176.    
  1177. ~*f7::
  1178.     ani_Decay()
  1179.     return
  1180.    
  1181. f9::
  1182.     ;Breakpoint
  1183.     OutputDebug, BREAK
  1184.     return
  1185.  
  1186. #If WinActive("ahk_exe ironsight.exe")
  1187.     {
  1188.     *$~LBUTTON::
  1189.         gosub firePressed
  1190.         return 
  1191.     *$~LBUTTON up::
  1192.         gosub fireReleased
  1193.         return
  1194.        
  1195.     if showUI_Directionals{ ;WASD directionals
  1196.         *$~W::
  1197.             updateInputUI(UIKeyOn, "moveForwardText")
  1198.             return     
  1199.         *$~W up::
  1200.             updateInputUI(UIKeyOff, "moveForwardText")
  1201.             return
  1202.        
  1203.         *$~S::
  1204.             updateInputUI(UIKeyOn, "moveBackwardText")
  1205.             return     
  1206.         *$~S up::
  1207.             updateInputUI(UIKeyOff, "moveBackwardText")
  1208.             return
  1209.        
  1210.         *$~A::
  1211.             updateInputUI(UIKeyOn, "moveLeftText")
  1212.             return     
  1213.         *$~A up::
  1214.             updateInputUI(UIKeyOff, "moveLeftText")
  1215.             return
  1216.        
  1217.         *$~D::
  1218.             updateInputUI(UIKeyOn, "moveRightText")
  1219.             return     
  1220.         *$~D up::
  1221.             updateInputUI(UIKeyOff, "moveRightText")
  1222.             return
  1223.         }
  1224.    
  1225.     *$~RBUTTON::
  1226.         gosub aimPressed
  1227.         return 
  1228.     *$~RBUTTON up::
  1229.         gosub aimReleased
  1230.         return
  1231.    
  1232.     *$~XBUTTON2::
  1233.         gosub meleePressed
  1234.         return 
  1235.     *$~XBUTTON2 up::
  1236.         gosub meleeReleased
  1237.         return
  1238.        
  1239.     *$~WHEELUP::
  1240.     *$~WHEELDOWN::
  1241.         gosub wheelScrolled
  1242.         return
  1243.    
  1244.     *$~LCTRL::
  1245.         gosub pronePressed
  1246.         return 
  1247.     *$~LCTRL up::
  1248.         gosub proneReleased
  1249.         return
  1250.    
  1251.     *$~LSHIFT::
  1252.         gosub sprintPressed
  1253.         return 
  1254.     *$~LSHIFT up::
  1255.         gosub sprintReleased
  1256.         return
  1257.    
  1258.     *$~LALT::
  1259.         gosub crouchPressed
  1260.         return 
  1261.     *$~LALT up::
  1262.         gosub crouchReleased
  1263.         return
  1264.    
  1265.     *$~TAB::
  1266.         gosub tabPressed
  1267.         return 
  1268.     *$~TAB up::
  1269.         return
  1270.    
  1271.     *$~Space::
  1272.         gosub jumpPressed
  1273.         return
  1274.     *$~Space up::
  1275.         gosub jumpReleased
  1276.         return
  1277.    
  1278.     *$~X::
  1279.         gosub firingModePressed
  1280.         return 
  1281.     *$~X up::
  1282.         gosub firingModeRelease
  1283.         return
  1284.     }
  1285.  
  1286. ;;;;;;;;;;;;;;;;;;;
  1287. ;; FIRING SYSTEM ;;
  1288. ;;;;;;;;;;;;;;;;;;;
  1289. firePressed: ;Fire pressed
  1290.     {
  1291.     if !isHoldingFire{
  1292.         isHoldingFire := 1
  1293.         switch firingMode{
  1294.             case "default":
  1295.                 goSub fireDefault1
  1296.             case "auto":
  1297.                 goSub fireAuto1
  1298.             case "burst1":
  1299.                 if !isBursting1{
  1300.                     goSub fireBurst1_1
  1301.                     }
  1302.             case "burst2":
  1303.                 if !isBursting2{
  1304.                     goSub fireBurst2_1
  1305.                     }
  1306.             case "semi":
  1307.                 goSub fireSemi1
  1308.             default:
  1309.                 msgBox ERROR in firePressed() %firingMode%
  1310.             }
  1311.         if enableAutoMark{
  1312.             gosub sendMark1
  1313.             }
  1314.         }
  1315.     return
  1316.     }
  1317.  
  1318. fireReleased: ;Fire released
  1319.     {
  1320.     isHoldingFire := 0
  1321.     if !isBursting1{
  1322.         updateInputUI(UIKeyOff, "fireText")
  1323.         send {insert up}
  1324.         ani_Decay()
  1325.         }
  1326.     setTimer, fireSemi1, off
  1327.     setTimer, fireSemi2, off
  1328.     setTimer, fireAuto1, off
  1329.     setTimer, fireAuto2, off
  1330.     return
  1331.     }
  1332.  
  1333. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1334. ;;FIRING MODE SELECTION SYSTEM;;
  1335. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1336. firingModePressed: ;Firing Mode Switch pressed
  1337.     {
  1338.     if !isHoldingFiringMode{
  1339.         isHoldingFiringMode = 1
  1340.         cancelFiringMode := 0
  1341.         setTimer, resetFiringMode, % tick(20)
  1342.         }
  1343.     return
  1344.     }
  1345.  
  1346. firingModeRelease: ;Firing Mode Switch released
  1347.     {
  1348.     isHoldingFiringMode := 0
  1349.     if !chargedFiringMode{
  1350.         if isHoldingAim{
  1351.             goSub switchFiringModeADS
  1352.             firingMode := firingModeADS
  1353.             updateFiringModeADSUI(firingModeADS)
  1354.             }
  1355.         if !isHoldingAim{
  1356.             goSub switchFiringModeHip
  1357.             firingMode := firingModeHip
  1358.             updateFiringModeHipUI(firingModeHip)
  1359.             }
  1360.         setTimer, resetFiringMode, off
  1361.         }
  1362.     if chargedFiringMode{
  1363.         firingModeSound := "audio\sound_default.AHK"
  1364.         updateFiringModeADSUI(firingModeADS)
  1365.         updateFiringModeHipUI(firingModeHip)
  1366.         }
  1367.     setTimer, playFiringModeSound, % tick(16)
  1368.     chargedFiringMode := 0
  1369.     return
  1370.     }
  1371.  
  1372. switchFiringModeHip: ;Cycle firing modes - HipFire
  1373.     {
  1374.     switch firingModeHip{
  1375.         case "default":
  1376.             firingModeSound := "audio\sound_fullauto.AHK"
  1377.             firingModeHip := "auto"
  1378.         case "auto":
  1379.             firingModeSound := "audio\sound_burst.AHK"
  1380.             firingModeHip := "burst1"
  1381.         case "burst1":
  1382.             firingModeSound := "audio\sound_burst.AHK"
  1383.             firingModeHip := "burst2"
  1384.         case "burst2":
  1385.             firingModeSound := "audio\sound_semiauto.AHK"
  1386.             firingModeHip := "semi"
  1387.         case "semi":
  1388.             firingModeSound := "audio\sound_default.AHK"
  1389.             firingModeHip := "default"
  1390.         default:
  1391.             msgbox ERROR in switchFiringModeHip() firingModeHip: %firingModeHip%
  1392.         }
  1393.     return
  1394.     }
  1395.  
  1396. switchFiringModeADS: ;Cycle firing modes - ADS
  1397.     {
  1398.     switch firingModeADS{
  1399.         case "default":
  1400.             firingModeSound := "audio\sound_fullauto.AHK"
  1401.             firingModeADS := "auto"
  1402.         case "auto":
  1403.             firingModeSound := "audio\sound_burst.AHK"
  1404.             firingModeADS := "burst1"
  1405.         case "burst1":
  1406.             firingModeSound := "audio\sound_burst.AHK"
  1407.             firingModeADS := "burst2"
  1408.         case "burst2":
  1409.             firingModeSound := "audio\sound_semiauto.AHK"
  1410.             firingModeADS := "semi"
  1411.         case "semi":
  1412.             firingModeSound := "audio\sound_default.AHK"
  1413.             firingModeADS := "default"
  1414.         default:
  1415.             msgbox ERROR in switchFiringModeADS() firingModeADS: %firingModeADS%
  1416.         }
  1417.     return
  1418.     }
  1419.  
  1420. playFiringModeSound: ;Play firing mode switch audio
  1421.     {
  1422.     run %firingModeSound%
  1423.     setTimer, playFiringModeSound, off
  1424.     return
  1425.     }
  1426.  
  1427. resetFiringMode: ;Reset the firing mode
  1428.     {
  1429.     if getKeyState("X", "p"){
  1430.         chargedFiringMode := 1
  1431.         firingMode := "default"
  1432.         firingModeHip := "default"
  1433.         firingModeADS := "default"
  1434.             hideFiringModeHip()
  1435.             hideFiringModeADS()
  1436.             GuiControl, firingModeHip:  Show, firingModeHipImageOff
  1437.             GuiControl, firingModeADS:  Show, firingModeADSImageOff
  1438.         }
  1439.     setTimer, resetFiringMode, off
  1440.     return
  1441.     }
  1442.  
  1443. ;;;;;;;;;;;;;;;;;;
  1444. ;; FIRING MODES ;;
  1445. ;;;;;;;;;;;;;;;;;;
  1446. fireDefault1: ;Default
  1447.     {
  1448.     send {insert down}
  1449.     ani_Grow()
  1450.     updateInputUI(UIKeyOn, "fireText")
  1451.     return
  1452.     }
  1453.  
  1454. fireAuto1: ;Auto Phase 1
  1455.     {
  1456.     if isHoldingFire{
  1457.         send {insert down}
  1458.         updateInputUI(UIKeyOn, "fireText")
  1459.         ani_Snap()
  1460.         setTimer, fireAuto1, off
  1461.         setTimer, fireAuto2, % tick()
  1462.         return
  1463.         }
  1464.     else if !isHoldingFire{
  1465.         goSub fireReleased
  1466.         return
  1467.         }
  1468.     return
  1469.     }
  1470.  
  1471. fireAuto2: ;Auto Phase 2
  1472.     {
  1473.     if isHoldingFire{
  1474.         send {insert up}
  1475.         updateInputUI("FF8800", "fireText")
  1476.         setTimer, fireAuto2, off
  1477.         setTimer, fireAuto1, % tick()
  1478.         return
  1479.         }
  1480.     else if !isHoldingFire{
  1481.         gosub fireReleased
  1482.         return
  1483.         }
  1484.     return
  1485.     }
  1486.  
  1487. fireBurst1_1: ;Burst Fire 1 phase 1
  1488.     {
  1489.     isBursting1 := 1
  1490.     updateInputUI(UIKeyOn, "fireText")
  1491.     send {insert down}
  1492.     ani_Grow()
  1493.     setTimer, fireBurst1_1, off
  1494.     setTimer, fireBurst1_2, % ((tick(burst1Ticks))/burst1FireMax)*2
  1495.     setTimer, fireBurst1_3, % ((tick(burst1Ticks))*burst1FireMax)+tick()
  1496.     return
  1497.     }
  1498.  
  1499. fireBurst1_2: ;Burst Fire 1 phase 2
  1500.     {
  1501.     updateInputUI("FF8800", "fireText")
  1502.     setTimer, fireBurst1_2, off
  1503.     setTimer, fireBurst1_2_2, % ((tick(burst1Ticks))/burst1FireMax)*2
  1504.     return
  1505.     }
  1506.  
  1507. fireBurst1_2_2: ;Burst Fire 1 phase 2 and a half
  1508.     {
  1509.     updateInputUI(UIKeyOn, "fireText")
  1510.     setTimer, fireBurst1_2_2, off
  1511.     setTimer, fireBurst1_2, % ((tick(burst1Ticks))/burst1FireMax)*2
  1512.     return
  1513.     }
  1514.  
  1515. fireBurst1_3: ;Burst Fire 1 phase 3
  1516.     {
  1517.     isBursting1 := 0
  1518.     updateInputUI(UIKeyOff, "fireText")
  1519.     if isHoldingFire{
  1520.         updateInputUI("FF8800", "fireText")
  1521.         }
  1522.     send {insert up}
  1523.     ani_Decay()
  1524.     setTimer, fireBurst1_3, off
  1525.     setTimer, fireBurst1_2, off
  1526.     setTimer, fireBurst1_2_2, off
  1527.     return
  1528.     }
  1529.  
  1530. fireBurst2_1: ;Burst Fire 2 phase 1
  1531.     {
  1532.     isBursting2 := 1
  1533.     burst2FireCount ++
  1534.     send {insert down}
  1535.     updateInputUI(UIKeyOn, "fireText")
  1536.     ani_Snap()
  1537.     setTimer, fireBurst2_1, off
  1538.     setTimer, fireBurst2_2, % tick(burst2Ticks)
  1539.     return
  1540.     }
  1541.  
  1542. fireBurst2_2: ;Burst Fire 2 phase 2
  1543.     {
  1544.     send {insert up}
  1545.     setTimer, fireBurst2_2, off
  1546.     if (burst2FireCount < burst2FireMax){
  1547.         updateInputUI("FF8800", "fireText")
  1548.         setTimer, fireBurst2_1, % tick(burst2Ticks)
  1549.         }
  1550.     else if (burst2FireCount >= burst2FireMax){
  1551.         burst2FireCount := 0
  1552.         isBursting2 := 0
  1553.         if isHoldingFire{
  1554.             updateInputUI("FF8800", "fireText")
  1555.             }
  1556.         else if !isHoldingFire{
  1557.             updateInputUI(UIKeyOff, "fireText")
  1558.             }
  1559.         setTimer, fireBurst2_1, off
  1560.         }
  1561.     return
  1562.     }
  1563.  
  1564. fireSemi1: ;Semi Auto phase 1
  1565.     {
  1566.     if isHoldingFire{
  1567.         send {insert down}
  1568.         updateInputUI(UIKeyOn, "fireText")
  1569.         ani_Snap()
  1570.         setTimer, fireSemi2, % tick(2)
  1571.         setTimer, fireSemi1, off
  1572.         return
  1573.         }
  1574.     return
  1575.     }
  1576.  
  1577. fireSemi2: ;Semi Auto phase 2
  1578.     {
  1579.     send {insert up}
  1580.     if isHoldingFire{
  1581.         updateInputUI("FF8800", "fireText")
  1582.         setTimer, fireSemi2, off
  1583.         }
  1584.     return
  1585.     }
  1586.  
  1587. ;;;;;;;;;;;;;;;;;;;;;;;;;;
  1588. ;; HOLD TO PRONE SYSTEM ;;
  1589. ;;;;;;;;;;;;;;;;;;;;;;;;;;
  1590. crouchPressed: ;Crouch pressed
  1591.     {
  1592.     if !isHoldingCrouch{
  1593.         updateInputUI(UIKeyOn, "crouchText")
  1594.         isHoldingCrouch := 1
  1595.         send {PgUp down}
  1596.         if enableHoldToProne{
  1597.             setTimer, goProne1, % tick(16)
  1598.             }
  1599.         }
  1600.     goSub jumpReleased
  1601.     return
  1602.     }
  1603.  
  1604. crouchReleased: ;Crouch released
  1605.     {
  1606.     isHoldingCrouch := 0
  1607.     updateInputUI(UIKeyOff, "crouchText")
  1608.     send {PgUp up}
  1609.     if !getKeyState("LCtrl", "p"){
  1610.         updateInputUI(UIKeyOff, "proneText")
  1611.         }
  1612.     setTimer, goProne1, off
  1613.     setTimer, goProne2, off
  1614.     return
  1615.     }
  1616.  
  1617. goProne1: ;Go Prone phase 1
  1618.     {
  1619.     send {PgDn down}
  1620.     updateInputUI("FFFF00", "proneText")
  1621.     setTimer, goProne2, % tick(4)
  1622.     setTimer, goProne1, off
  1623.     return
  1624.     }
  1625.  
  1626. goProne2: ;Go Prone phase 2
  1627.     {
  1628.     send {PgDn up}
  1629.     updateInputUI("FF8800", "proneText")
  1630.     setTimer, goProne1, % tick(4)
  1631.     setTimer, goProne2, off
  1632.     return
  1633.     }
  1634.  
  1635. ;;;;;;;;;;;;;;;;;;
  1636. ;; PRONE SYSTEM ;;
  1637. ;;;;;;;;;;;;;;;;;;
  1638. pronePressed: ;Prone pressed
  1639.     {
  1640.     if !isHoldingProne{
  1641.         isholdingProne := 1
  1642.         if enableHoldProne{
  1643.             if !isProning{
  1644.                 updateInputUI(UIKeyOn, "proneText")
  1645.                 isProning := 1
  1646.                 goSub proneSpam1
  1647.                 setTimer, holdToProne, % tick(44)
  1648.                 }
  1649.             }
  1650.         else if !enableHoldProne{
  1651.             updateInputUI(UIKeyOn, "proneText")
  1652.             }
  1653.         }
  1654.     goSub jumpReleased
  1655.     return
  1656.     }
  1657.  
  1658. proneReleased: ;Prone released
  1659.     {
  1660.     isHoldingProne := 0
  1661.     if !enableHoldProne{
  1662.         updateInputUI(UIKeyOff, "proneText")
  1663.         isProning := 0
  1664.         return
  1665.         }
  1666.     if (enableHoldProne && chargedProne && isProning){
  1667.         goSub unProneSpam1
  1668.         return
  1669.         }
  1670.     return
  1671.     }
  1672.  
  1673. proneSpam1: ;Prone Spam phase 1
  1674.     {
  1675.     if (proneCount < proneCountMax){
  1676.         proneCount++
  1677.         updateInputUI(UIKeyOn, "proneText")
  1678.         send {PgDn down}
  1679.         setTimer, proneSpam2, % tick(2)
  1680.         setTimer, proneSpam1, off
  1681.         }
  1682.     else if (proneCount >= proneCountMax){
  1683.         setTimer, proneSpam2, off
  1684.         }
  1685.     setTimer, proneSpam1, off
  1686.     return
  1687.     }
  1688.  
  1689. proneSpam2: ;Prone Spam phase 2
  1690.     {
  1691.     send {PgDn up}
  1692.     if (proneCount < proneCountMax){
  1693.         updateInputUI("008800", "proneText")
  1694.         setTimer, proneSpam1, % tick(2)
  1695.         }
  1696.     else if (proneCount >= proneCountMax){
  1697.         updateInputUI("FF8800", "proneText")
  1698.         proneCount := 0
  1699.         setTimer, proneSpam1, off
  1700.         }
  1701.     setTimer, proneSpam2, off
  1702.     return
  1703.     }
  1704.  
  1705. holdToProne: ;Prone held
  1706.     {
  1707.     if isholdingProne{
  1708.         updateInputUI("FFFF00", "proneText")
  1709.         chargedProne := 1
  1710.         setTimer, holdToProne, off
  1711.         return
  1712.         }
  1713.     else if !isholdingProne{
  1714.         updateInputUI(UIKeyOff, "proneText")
  1715.         chargedProne := 0
  1716.         isProning := 0
  1717.         setTimer, holdToProne, off
  1718.         return
  1719.         }
  1720.     setTimer, holdToProne, off
  1721.     return
  1722.     }
  1723.  
  1724. unProneSpam1: ;Unprone Spam phase 1
  1725.     {
  1726.     if (unProneCount < unProneCountMax){
  1727.         unProneCount++
  1728.         updateInputUI("FF8800", "proneText")
  1729.         send {PgUp down}
  1730.         setTimer, unproneSpam2, % tick(2)
  1731.         }
  1732.     else if (unProneCount >= unProneCountMax){
  1733.         setTimer, unproneSpam2, off
  1734.         }
  1735.     setTimer, unproneSpam1, off
  1736.     return
  1737.     }
  1738.  
  1739. unproneSpam2: ;Unprone Spam phase 2
  1740.     {
  1741.     updateInputUI("CC6600", "proneText")
  1742.     send {PgUp up}
  1743.     if (unProneCount < unProneCountMax){
  1744.         setTimer, unproneSpam1, % tick(2)
  1745.         }
  1746.     else if (unProneCount >= unProneCountMax){
  1747.         unProneCount := 0
  1748.         updateInputUI("FF8800", "proneText")
  1749.         setTimer, unproneSpam3, % tick(2)
  1750.         }
  1751.     setTimer, unproneSpam2, off
  1752.     return
  1753.     }
  1754.  
  1755. unProneSpam3: ;Unprone Spam phase 3
  1756.     {
  1757.     updateInputUI(UIKeyOff, "proneText")
  1758.     chargedProne := 0
  1759.     isProning := 0
  1760.     setTimer, unProneSpam1, off
  1761.     setTimer, unProneSpam2, off
  1762.     setTimer, unProneSpam3, off
  1763.     return
  1764.     }
  1765.  
  1766. ;;;;;;;;;;;;;;;;;;
  1767. ;; MELEE SYSTEM ;;
  1768. ;;;;;;;;;;;;;;;;;;
  1769. meleePressed: ;Melee pressed
  1770.     {
  1771.     cancelMelee := 0
  1772.     if !isHoldingMelee{
  1773.         updateInputUI(UIKeyOn, "meleeText")
  1774.         isHoldingMelee := 1
  1775.         if enableHoldToMelee{
  1776.             setTimer, switchMelee1, % tick(16)
  1777.             }
  1778.         }
  1779.     return
  1780.     }
  1781.  
  1782. meleeReleased: ;Melee released
  1783.     {
  1784.     isHoldingMelee := 0
  1785.     updateInputUI(UIKeyOff, "meleeText")
  1786.     send {numpad5 up}
  1787.     if !cancelMelee{
  1788.         if !chargedMelee{
  1789.             goSub fastMelee1
  1790.             }
  1791.         if chargedMelee{
  1792.             setTimer, meleeReleasedSwitchBack1, % tick(2)
  1793.             }
  1794.         }
  1795.     chargedMelee := 0
  1796.     setTimer, switchMelee1, off
  1797.     setTimer, switchMelee2, off
  1798.     setTimer, switchMelee3, off
  1799.     return
  1800.     }
  1801.  
  1802. fastMelee1: ;Fast melee phase 1
  1803.     {
  1804.     send {numpad4 down}
  1805.     setTimer, fastMelee2, % tick(4)
  1806.     setTimer, fastMelee1, off
  1807.     return
  1808.     }
  1809.  
  1810. fastMelee2: ;Fast melee phase 2
  1811.     {
  1812.     send {numpad4 up}
  1813.     setTimer, fastMelee1, off
  1814.     setTimer, fastMelee2, off
  1815.     return
  1816.     }
  1817.  
  1818. switchMelee1: ;Switch to melee weapon phase 1
  1819.     {
  1820.     updateInputUI("FFFF00", "meleeText")
  1821.     chargedMelee := 1
  1822.     goSub switchMelee2
  1823.     setTimer, switchMelee1, off
  1824.     return
  1825.     }
  1826.  
  1827. switchMelee2: ;Switch to melee weapon phase 2
  1828.     {
  1829.     send {numpad5 down}
  1830.     setTimer, switchMelee3, % tick(2)
  1831.     setTimer, switchMelee2, off
  1832.     return
  1833.     }
  1834.  
  1835. switchMelee3: ;Switch to melee weapon phase 3
  1836.     {
  1837.     send {numpad5 up}
  1838.     setTimer, switchMelee2, % tick(2)
  1839.     setTimer, switchMelee3, off
  1840.     return
  1841.     }
  1842.  
  1843. meleeReleasedSwitchBack1: ;Switch from melee weapon to previous phase 1
  1844.     {
  1845.     send {numpad6 down}
  1846.     setTimer, meleeReleasedSwitchBack2, % tick(2)
  1847.     setTimer, meleeReleasedSwitchBack1, off
  1848.     return
  1849.     }
  1850.  
  1851. meleeReleasedSwitchBack2: ;Switch from melee weapon to previous phase 2
  1852.     {
  1853.     send {numpad6 up}
  1854.     setTimer, meleeReleasedSwitchBack2, off
  1855.     return
  1856.     }
  1857.  
  1858. ;;;;;;;;;;;;;;;;;;;;;;;;
  1859. ;; MOUSE WHEEL SYSTEM ;;
  1860. ;;;;;;;;;;;;;;;;;;;;;;;;
  1861. wheelScrolled: ;Mouse Wheel scrolled
  1862.     {
  1863.     if chargedMelee{
  1864.         updateInputUI("CC6600", "meleeText")
  1865.         send {numpad5 up}
  1866.         cancelMelee := 1
  1867.         chargedMelee := 0
  1868.         setTimer, switchMelee1, off
  1869.         setTimer, switchMelee2, off
  1870.         setTimer, switchMelee3, off
  1871.         }
  1872.     return
  1873.     }  
  1874.  
  1875. ;;;;;;;;;;;;;;;;;;;;;;;;;;
  1876. ;; BUNNY HOPPING SYSTEM ;;
  1877. ;;;;;;;;;;;;;;;;;;;;;;;;;;
  1878. jumpPressed: ;Jump pressed
  1879.     {
  1880.     if !isHoldingJump{
  1881.         isHoldingJump := 1
  1882.         if enableBHop{
  1883.             goSub firstHop1
  1884.             setTimer, bHop1, % tick(16)
  1885.             setTimer, bHopHUD, % tick(16)
  1886.             }
  1887.         else if !enableBHop{
  1888.             updateInputUI(UIKeyOn, "jumpText")
  1889.             send {pause down}
  1890.             }
  1891.         }
  1892.     return
  1893.     }
  1894.  
  1895. jumpReleased: ;Jump released
  1896.     {
  1897.     setTimer, firstHop1, off
  1898.     setTimer, firstHop2, off
  1899.     setTimer, bHop1, off
  1900.     setTimer, bHop2, off
  1901.     isHoldingJump := 0
  1902.     updateInputUI(UIKeyOff, "jumpText")
  1903.     send {space up}
  1904.     send {pause up}
  1905.     return
  1906.     }
  1907.  
  1908. firstHop1: ;Initial Bhop Jump phase 1
  1909.     {
  1910.     updateInputUI(UIKeyOn, "jumpText")
  1911.     send {pause down}
  1912.     setTimer, firstHop2, % tick(8)
  1913.     setTimer, firstHop1, off
  1914.     return
  1915.     }
  1916.  
  1917. firstHop2: ;Initial Bhop Jump phase 2
  1918.     {
  1919.     updateInputUI("FF8800", "jumpText")
  1920.     send {pause up}
  1921.     setTimer, firstHop2, off
  1922.     return
  1923.     }
  1924.  
  1925. bHop1: ;Bhop Spam phase 1
  1926.     {
  1927.     ;updateInputUI("FFFF00", "jumpText")
  1928.     send {pause down}
  1929.     setTimer, bHop2, % tick()
  1930.     setTimer, bHop1, off
  1931.     return
  1932.     }
  1933.  
  1934. bHop2: ;Bhop Spam phase 2
  1935.     {
  1936.     send {pause up}
  1937.     setTimer, bHop1, % tick()
  1938.     setTimer, bHop2, off
  1939.     if !getKeyState("Space", "P"){
  1940.         goSub jumpReleased
  1941.         }
  1942.     return
  1943.     }
  1944.  
  1945. bHopHUD: ;Bhop HUD
  1946.     {
  1947.     if getKeyState("Space", "P"){
  1948.         updateInputUI("FFFF00", "jumpText")
  1949.         }
  1950.     setTimer, bHopHUD, off
  1951.     return
  1952.     }
  1953.  
  1954. ;;;;;;;;;;;;;;;;;;;
  1955. ;; AIMING SYSTEM ;;
  1956. ;;;;;;;;;;;;;;;;;;;
  1957. aimPressed: ;Aim pressed
  1958.     {
  1959.     if !isHoldingAim{
  1960.         isHoldingAim := 1
  1961.         if enableAutoBreath{
  1962.             send {numpad7 down}
  1963.             }
  1964.         UI_hideRet()
  1965.         retState(2)
  1966.         UI_showRet()
  1967.         if showUI_firingMode{
  1968.         updateInputUI(UIKeyOn, "aimText")
  1969.             Gui     firingModeADSDark:  +LastFound +AlwaysOnTop -Caption +ToolWindow +Disabled +E0x20
  1970.             WinSet, Transparent, 0
  1971.             Gui     firingModeHipDark:  +LastFound +AlwaysOnTop -Caption +ToolWindow +Disabled +E0x20
  1972.             WinSet, Transparent, 127
  1973.             }
  1974.         if !chargedFiringMode{
  1975.             firingMode := firingModeADS
  1976.             }
  1977.         }
  1978.     goSub jumpReleased
  1979.     return
  1980.     }
  1981.  
  1982. aimReleased: ;Aim released
  1983.     {
  1984.     isHoldingAim := 0
  1985.     updateInputUI(UIKeyOff, "aimText")
  1986.     UI_hideRet()
  1987.     retState(1)
  1988.     UI_showRet()
  1989.     if showUI_firingMode{
  1990.         Gui     firingModeHipDark:  +LastFound +AlwaysOnTop -Caption +ToolWindow +Disabled +E0x20
  1991.         WinSet, Transparent, 0
  1992.         Gui     firingModeADSDark:  +LastFound +AlwaysOnTop -Caption +ToolWindow +Disabled +E0x20
  1993.         WinSet, Transparent, 127
  1994.         }
  1995.     send {numpad7 up}
  1996.     if !chargedFiringMode{
  1997.         firingMode := firingModeHip
  1998.         }
  1999.     return
  2000.     }
  2001.  
  2002. ;;;;;;;;;;;;;;;;;;;
  2003. ;; SPRINT SYSTEM ;;
  2004. ;;;;;;;;;;;;;;;;;;;
  2005. sprintPressed: ;Sprint pressed
  2006.     {
  2007.     if !isHoldingSprint{
  2008.         updateInputUI(UIKeyOn, "sprintText")
  2009.         isHoldingSprint := 1
  2010.         send {numpad7 down}
  2011.         goSub crouchReleased
  2012.         goSub proneReleased
  2013.         goSub jumpReleased
  2014.         proneCount := proneCountMax
  2015.         }
  2016.     return
  2017.     }
  2018.  
  2019. sprintReleased: ;Sprint released
  2020.     {
  2021.     updateInputUI(UIKeyOff, "sprintText")
  2022.     isHoldingSprint := 0
  2023.     if !getKeyState("RBUTTON", "p"){
  2024.         send {numpad7 up}
  2025.         }
  2026.     proneCount := 0
  2027.     return
  2028.     }
  2029.  
  2030. ;;;;;;;;;;;;;;;;;;;;;
  2031. ;; AUTOMARK SYSTEM ;;
  2032. ;;;;;;;;;;;;;;;;;;;;;
  2033. sendMark1: ;Send AutoMark phase 1
  2034.     {
  2035.     setTimer, sendMark1, off
  2036.     if !markOut AND isHoldingAim AND isHoldingFire{
  2037.         setTimer, sendMark2, % tick(2)
  2038.         markOut := "1"
  2039.         send {Q down}
  2040.         setTimer, sendMark3, % tick(autoMarkCooldown)
  2041.         }
  2042.     return
  2043.     }
  2044.  
  2045. sendMark2: ;Send AutoMark phase 2
  2046.     {
  2047.     setTimer, sendMark2, off
  2048.     send {Q Up}
  2049.     return
  2050.     }
  2051.  
  2052. sendMark3: ;Send AutoMark phase 3
  2053.     {
  2054.     setTimer, sendMark3, off
  2055.     markOut := "0"
  2056.     if isHoldingAim AND isHoldingFire{
  2057.         setTimer, sendMark1, % tick(2)
  2058.         }
  2059.     }
  2060.  
  2061. ;;;;;;;;;;;;;;;;
  2062. ;; TAB SYSTEM ;;
  2063. ;;;;;;;;;;;;;;;;
  2064. tabPressed: ;Tab pressed
  2065.     {
  2066.     if getKeyState("LAlt", "p"){
  2067.         keywait LAlt
  2068.         send {LAlt up}
  2069.         reload
  2070.         }
  2071.     return
  2072.     }
  2073.  
  2074. ;;;;;;;;;;;;;;;;;;;
  2075. ;;SCRIPT HANDLING;;
  2076. ;;;;;;;;;;;;;;;;;;;
  2077. Shift & F5:: ;Shift F5 to exit
  2078.     keepscript := "Ironsight.ahk"
  2079.             for process in ComObjGet("winmgmts:").ExecQuery("Select * from Win32_Process where name = 'Autohotkey.exe' and not CommandLine like '%" keepscript "%' "){
  2080.         process, close, % process.ProcessId
  2081.     }  
  2082.     exitapp
  2083.  
  2084. ;#If WinActive("ahk_exe ironsight.exe")
  2085. F5:: ;F5 to refresh
  2086.     send {F5}
  2087.     reload
  2088.     return
  2089.  
  2090. LAlt & Tab:: ;ALT Tab handler
  2091.     goSub crouchReleased
  2092.     send {blind}{Alt up}
  2093.     send {blind}{Tab up}
  2094.     send {Alt down}{tab}
  2095.     keywait LAlt
  2096.     keywait Tab
  2097.     return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement