AHK coders lounge - discuss and share code menu

User Tag List

Page 1 of 6 12345 ... LastLast
Results 1 to 15 of 77
  1. #1
    phansawat's Avatar Knight-Lieutenant
    Reputation
    43
    Join Date
    Mar 2010
    Posts
    344
    Thanks G/R
    14/18
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    AHK coders lounge - discuss and share code

    I'll be dumping all AHK scripts. This is for anyone interested in building their own to avoid Blizzard banwave in the future.
    Remember to NOT compile these scripts. Always run these scripts as .ahk instead of .exe, this will reduce your chances of ever getting banned significantly.
    For those who haven't already, install ahk from autohotkey.com
    OVERWATCH NEEDS TO BE RUN IN BORDERLESS MODE TO HAVE THE AIMBOTS FUNCTION! AERO THEME HAS TO BE DISABLED AND THIS PROB WONT WORK WITH WINDOWS 10! MAKE SURE YOUR HAVE THE COLOR SETTINGS IN THE VIDEO MENU TO DEFAULT

    IF AIMBOT IS JUMPING AROUND, GET A BETTER PC! THIS IS CPU INTENSIVE

    If the code doesn't work, then you have done something wrong, please do not use this thread for support or complaints. This is for experienced users only.

    Korean Aimbot Modified with minor AHK scripts by Stinkyjoint
    Click here to give him +rep
    Code:
    ; <COMPILER: v1.1.24.01>
    guif:
    #NoEnv
    #SingleInstance force
    SkinForm(Apply, A_ScriptDir . "\USkin.dll", A_ScriptDir . "\Milikymac.msstyles")
    Gui, Add, Text, x12 y40 w200 h30 , 1280*720  Run Aim[F1]
    Gui, Add, Text, x12 y60 w200 h30 , 1920*1080 Run Aim[F2]
    Gui, Add, Text, x12 y80 w200 h30 ,  Restart Program[F3]
    Gui, Add, Text, x12 y100 w200 h30 ,  Pause/Resume[ALT]
    Gui, Add, CheckBox, x12 y130 w180 h40 vmccree, Mccree Right Click No Recoil
    Gui, Add, CheckBox, x12 y160 w150 h40 vtorbjorn, Torbjorn Fast Reload
    Gui, Add, CheckBox, x12 y190 w150 h40 vpharah, Pharah Fast Reload
    Gui, Add, CheckBox, x12 y220 w150 h40 vreaper, Reaper Fast Reload
    Gui, Add, CheckBox, x12 y250 w150 h40 vroadhog, RoadHog Fast Reload
    Gui, Add, CheckBox, x292 y25 w150 h40 vaimtype Checked, Left Click AimLock
    Gui, Add, CheckBox, x292 y55 w150 h40 vaimtype1, Right Click Aimlock
    Gui, Add, Text, x232 y110 w120 h30 , Aim speed control
    Gui, Add, Edit, x362 y110 w100 h30 vrx, 3
    Gui, Add, Button, x232 y150 w230 h90 gchange1, Apply settings
    gui, add, button, x5 y5 h20 w70 gsub1, Issues?
    gui, add, button, x80 y5 h20 w70 gsub2, How-to
    gui, add, button, x155 y5 h20 w70 gsub3, Best Settings
    gui, add, button, x225 y5 h20 w100 gsub4, About Aim Speed!
    Gui, Show
    Loop {
    Gui, Submit, NoHide
    Sleep -1
    }
    Return
    #If roadhog=1
    $r::
    Send {r}
    Sleep 1880
    Send {v}
    Return
    #If
    Return
    #If torbjorn=1
    $r::
    Send {r}
    Sleep 1780
    Send {v}
    Return
    #If
    Return
    #If pharah=1
    $r::
    Send {r}
    Sleep 1200
    Send {v}
    Return
    #If
    return
    #If reaper=1
    $r::
    Send {r}
    Sleep 300
    Send {v}
    Return
    #If
    return
    #If mccree=1
    ~RButton::
    Loop
    If GetKeyState("RButton") {
    Sleep, 5
    moveAmount := (moveAmount = 2) ? 3 : 0
    mouseXY(moveAmount,3.4)
    }
    else
    break
    Return
    mouseXY(x,y)
    {
    DllCall("mouse_event",int,1,int,x,int,y,uint,0,uint,0)
    }
    #If
    return
    sub1:
    {
    msgbox, Having issues?`n`nMccree Right Click No Recoil Does NOT!!! work with right click aimlock`nHOLD DOWN RIGHT CLICK FOR IT TO WORK DONT JUST PRESS BUTTON`n`nCheat is CPU intensive and only uses math.`n`nLowFPS: Lower Aim speed to 3.`nLowFPS: Lower resolution to 720p and play on low.`nLowFPS: If you get low fps after a playthrough, press F3 to restart the cheat.`n`nCursor jumping left or right when using Aim key?`n`nJumpBug:Your PC is lagging out when using Aimkey. Check LowFPS solution.`nJumpBug: Switch your resolution to 720p but use F2(1080p) with Aim Speed 3.`n`nAlways try the cheat out in Practice Range to find your best settings.
    }
    return
    sub2:
    {
    msgbox, How-to:`n`nLaunch Game. Switch to Borderless Windowed mode.`nResolution has to be 720p or 1080p. As precaution, set your quality settings to Low.`n`nTo-use:`nPress F1 or F2 depending on your resolution.`nShoot an Enemy. When the Health Bar is visible press the aimkey to snap onto the target.`n`nIf nothing is happening make sure you are not using any desktop applications that alter your color settings or are recording your gameplay such as W10 DVR or Fraps.
    }
    return
    sub3:
    {
    msgbox, Best Settings for the cheat (Legit):`n`nResolution: 1280x720`nAim Speed: 3
    }
    return
    sub4:
    {
    msgbox, Higher the number, Faster the it locks on. `n`Lower the number, The slower it locks on.
    }
    return
    GuiClose:
    ExitApp
    return
    SkinForm(Param1 = "Apply", DLL = "", SkinName = ""){
    if(Param1 = Apply){
    DllCall("LoadLibrary", str, DLL)
    DllCall(DLL . "\USkinInit", Int,0, Int,0, AStr, SkinName)
    }else if(Param1 = 0){
    DllCall(DLL . "\USkinExit")
    }
    }
    Change1:
    MsgBox,  Applied
    Gui,Submit, Nohide
    return
    F1::
    #Persistent
    #KeyHistory, 0
    #NoEnv
    #HotKeyInterval 1
    #MaxHotkeysPerInterval 127
    #InstallKeybdHook
    #UseHook
    #SingleInstance, Force
    SetKeyDelay,-1, 8
    SetControlDelay, -1
    SetMouseDelay, 0
    SetWinDelay,-1
    SendMode, InputThenPlay
    SetBatchLines,-1
    ListLines, Off
    CoordMode, Mouse, Screen
    PID := DllCall("GetCurrentProcessId")
    Process, Priority, %PID%, Normal
    ZeroX := 640
    ZeroY := 360
    CFovX := 320
    CFovY := 200
    ScanL := 500
    ScanR := 800
    ScanT := 180
    ScanB := 400
    GuiControlget, rX
    Loop, {
    if (aimtype=1)
    {
    GetKeyState, Mouse2, LButton, P
    GoSub MouseMoves2
    }
    Gui,Submit, Nohide
    if (aimtype1=1)
    {
    GetKeyState, Mouse2, RButton, P
    GoSub MouseMoves2
    }
    ImageSearch, AimPixelX, AimPixelY,ScanL, ScanT, ScanR, ScanB,  *4 hhp.bmp
    GoSub GetAimOffset
    GoSub GetAimMoves
    }
    MouseMoves:
    If ( Mouse2 == "D" ) {
    DllCall("mouse_event", uint, 1, int, MoveX, int, MoveY, uint, 0, int, 0)
    }
    Return
    MouseMoves1:
    If ( Mouse2 == "U" ) {
    DllCall("mouse_event", uint, 1, int, MoveX, int, MoveY, uint, 0, int, 0)
    }
    Return
    GetAimOffset:
    Gui,Submit, Nohide
    AimX := AimPixelX - ZeroX +41
    AimY := AimPixelY - ZeroY +63
    If ( AimX+5 > 0) {
    DirX := rx / 10
    }
    If ( AimX+5 < 0) {
    DirX := (-rx) / 10
    }
    If ( AimY+2 > 0 ) {
    DirY := rX /10 *0.5
    }
    If ( AimY+2 < 0 ) {
    DirY := (-rx) /10 *0.5
    }
    AimOffsetX := AimX * DirX
    AimOffsetY := AimY * DirY
    Return
    GetAimMoves:
    RootX := Ceil(( AimOffsetX ** ( 1/2 )))
    RootY := Ceil(( AimOffsetY ** ( 1/2 )))
    MoveX := RootX * DirX
    MoveY := RootY * DirY
    Return
    SleepF:
    SleepDuration = 1
    TimePeriod = 1
    DllCall("Winmm\timeBeginPeriod", uint, TimePeriod)
    Iterations = 1
    StartTime := A_TickCount
    Loop, %Iterations% {
    DllCall("Sleep", UInt, TimePeriod)
    }
    DllCall("Winmm\timeEndPeriod", UInt, TimePeriod)
    Return
    DebugTool:
    MouseGetPos, MX, MY
    ToolTip, %AimOffsetX% | %AimOffsetY%
    ToolTip, %AimX% | %AimY%
    ToolTip, %IntAimX% | %IntAimY%
    ToolTip, %RootX% | %RootY%
    ToolTip, %MoveX% | %MoveY% || %MX% %MY%
    Return
    F2::
    #Persistent
    #KeyHistory, 0
    #NoEnv
    #HotKeyInterval 1
    #MaxHotkeysPerInterval 2000
    #InstallKeybdHook
    #UseHook
    #SingleInstance, Force
    SetKeyDelay,-1, 8
    SetControlDelay, -1
    SetMouseDelay, 0
    SetWinDelay,-1
    SendMode, InputThenPlay
    SetBatchLines,-1
    ListLines, Off
    CoordMode, Mouse, Screen
    PID := DllCall("GetCurrentProcessId")
    Process, Priority, %PID%, Normal
    ZeroX := 960
    ZeroY := 540
    CFovX := 80
    CFovY := 200
    ScanL := 660
    ScanR := 1250
    ScanT := 280
    ScanB := 610
    GuiControlget, rX
    Loop, {
    Gui,Submit, Nohide
    if (aimtype=1)
    {
    GetKeyState, Mouse2, LButton, P
    GoSub MouseMoves2
    }
    if (aimtype1=1)
    {
    GetKeyState, Mouse2, RButton, P
    GoSub MouseMoves2
    }
    ImageSearch, AimPixelX, AimPixelY, ScanL, ScanT, ScanR, ScanB,  *4 hhp2.bmp
    GoSub GetAimOffset1
    GoSub GetAimMoves1
    }
    MouseMoves2:
    If ( Mouse2 == "D" ) {
    DllCall("mouse_event", uint, 1, int, MoveX, int, MoveY, uint, 0, int, 0)
    }
    Return
    MouseMoves11:
    If ( Mouse2 == "U" ) {
    DllCall("mouse_event", uint, 1, int, MoveX, int, MoveY, uint, 0, int, 0)
    }
    GetAimOffset1:
    Gui,Submit, Nohide
    AimX := AimPixelX - ZeroX +58
    AimY := AimPixelY - ZeroY +85
    If ( AimX+10 > 0) {
    DirX := rx / 10
    }
    If ( AimX+10 < 0) {
    DirX := (-rx) / 10
    }
    If ( AimY+5 > 0 ) {
    DirY := rX /10 *0.5
    }
    If ( AimY+5 < 0 ) {
    DirY := (-rx) /10 *0.5
    }
    AimOffsetX := AimX * DirX
    AimOffsetY := AimY * DirY
    Return
    GetAimMoves1:
    RootX := Ceil(( AimOffsetX ** ( 1 )))
    RootY := Ceil(( AimOffsetY ** ( 1 )))
    MoveX := RootX * DirX
    MoveY := RootY * DirY
    Return
    reload:
    SleepF1:
    SleepDuration = 1
    TimePeriod = 1
    DllCall("Winmm\timeBeginPeriod", uint, TimePeriod)
    Iterations = 1
    StartTime := A_TickCount
    Loop, %Iterations% {
    DllCall("Sleep", UInt, TimePeriod)
    }
    DllCall("Winmm\timeEndPeriod", UInt, TimePeriod)
    Return
    DebugTool1:
    MouseGetPos, MX, MY
    ToolTip, %AimOffsetX% | %AimOffsetY%
    ToolTip, %AimX% | %AimY%
    ToolTip, %IntAimX% | %IntAimY%
    ToolTip, %RootX% | %RootY%
    ToolTip, %MoveX% | %MoveY% || %MX% %MY%
    Return
    ALT::
    pause
    SoundBEEP
    return
    F3::
    Reload
    Return
    Save these as hhp.bmp hhp2.bmp hhp3.bmp hhp4.bmp
    MUST BE IN THE SAME FOLDER AS THE .ahk SCRIPT
    Attachment 35962
    Attachment 35963
    Attachment 35964
    Attachment 35965

    ========================================

    One of the first AHK pixelbots
    Code:
    ; <COMPILER: v1.1.22.04>
    #NoTrayIcon
    #SingleInstance, Force
    #NoEnv
    UpdateLayeredWindow(hwnd, hdc, x="", y="", w="", h="", Alpha=255)
    {
    if ((x != "") && (y != ""))
    VarSetCapacity(pt, 8), NumPut(x, pt, 0), NumPut(y, pt, 4)
    if (w = "") ||(h = "")
    WinGetPos,,, w, h, ahk_id %hwnd%
    return DllCall("UpdateLayeredWindow", "uint", hwnd, "uint", 0, "uint", ((x = "") && (y = "")) ? 0 : &pt
    , "int64*", w|h<<32, "uint", hdc, "int64*", 0, "uint", 0, "uint*", Alpha<<16|1<<24, "uint", 2)
    }
    BitBlt(ddc, dx, dy, dw, dh, sdc, sx, sy, Raster="")
    {
    return DllCall("gdi32\BitBlt", "uint", dDC, "int", dx, "int", dy, "int", dw, "int", dh
    , "uint", sDC, "int", sx, "int", sy, "uint", Raster ? Raster : 0x00CC0020)
    }
    StretchBlt(ddc, dx, dy, dw, dh, sdc, sx, sy, sw, sh, Raster="")
    {
    return DllCall("gdi32\StretchBlt", "uint", ddc, "int", dx, "int", dy, "int", dw, "int", dh
    , "uint", sdc, "int", sx, "int", sy, "int", sw, "int", sh, "uint", Raster ? Raster : 0x00CC0020)
    }
    SetStretchBltMode(hdc, iStretchMode=4)
    {
    return DllCall("gdi32\SetStretchBltMode", "uint", hdc, "int", iStretchMode)
    }
    SetImage(hwnd, hBitmap)
    {
    SendMessage, 0x172, 0x0, hBitmap,, ahk_id %hwnd%
    E := ErrorLevel
    DeleteObject(E)
    return E
    }
    SetSysColorToControl(hwnd, SysColor=15)
    {
    WinGetPos,,, w, h, ahk_id %hwnd%
    bc := DllCall("GetSysColor", "Int", SysColor)
    pBrushClear := Gdip_BrushCreateSolid(0xff000000 | (bc >> 16 | bc & 0xff00 | (bc & 0xff) << 16))
    pBitmap := Gdip_CreateBitmap(w, h), G := Gdip_GraphicsFromImage(pBitmap)
    Gdip_FillRectangle(G, pBrushClear, 0, 0, w, h)
    hBitmap := Gdip_CreateHBITMAPFromBitmap(pBitmap)
    SetImage(hwnd, hBitmap)
    Gdip_DeleteBrush(pBrushClear)
    Gdip_DeleteGraphics(G), Gdip_DisposeImage(pBitmap), DeleteObject(hBitmap)
    return 0
    }
    Gdip_BitmapFromScreen(Screen=0, Raster="")
    {
    if (Screen = 0)
    {
    Sysget, x, 76
    Sysget, y, 77
    Sysget, w, 78
    Sysget, h, 79
    }
    else if (SubStr(Screen, 1, 5) = "hwnd:")
    {
    Screen := SubStr(Screen, 6)
    if !WinExist( "ahk_id " Screen)
    return -2
    WinGetPos,,, w, h, ahk_id %Screen%
    x := y := 0
    hhdc := GetDCEx(Screen, 3)
    }
    else if (Screen&1 != "")
    {
    Sysget, M, Monitor, %Screen%
    x := MLeft, y := MTop, w := MRight-MLeft, h := MBottom-MTop
    }
    else
    {
    StringSplit, S, Screen, |
    x := S1, y := S2, w := S3, h := S4
    }
    if (x = "") || (y = "") || (w = "") || (h = "")
    return -1
    chdc := CreateCompatibleDC(), hbm := CreateDIBSection(w, h, chdc), obm := SelectObject(chdc, hbm), hhdc := hhdc ? hhdc : GetDC()
    BitBlt(chdc, 0, 0, w, h, hhdc, x, y, Raster)
    ReleaseDC(hhdc)
    pBitmap := Gdip_CreateBitmapFromHBITMAP(hbm)
    SelectObject(chdc, obm), DeleteObject(hbm), DeleteDC(hhdc), DeleteDC(chdc)
    return pBitmap
    }
    Gdip_BitmapFromHWND(hwnd)
    {
    WinGetPos,,, Width, Height, ahk_id %hwnd%
    hbm := CreateDIBSection(Width, Height), hdc := CreateCompatibleDC(), obm := SelectObject(hdc, hbm)
    PrintWindow(hwnd, hdc)
    pBitmap := Gdip_CreateBitmapFromHBITMAP(hbm)
    SelectObject(hdc, obm), DeleteObject(hbm), DeleteDC(hdc)
    return pBitmap
    }
    CreateRectF(ByRef RectF, x, y, w, h)
    {
    VarSetCapacity(RectF, 16)
    NumPut(x, RectF, 0, "float"), NumPut(y, RectF, 4, "float"), NumPut(w, RectF, 8, "float"), NumPut(h, RectF, 12, "float")
    }
    CreateRect(ByRef Rect, x, y, w, h)
    {
    VarSetCapacity(Rect, 16)
    NumPut(x, Rect, 0, "uint"), NumPut(y, Rect, 4, "uint"), NumPut(w, Rect, 8, "uint"), NumPut(h, Rect, 12, "uint")
    }
    CreateSizeF(ByRef SizeF, w, h)
    {
    VarSetCapacity(SizeF, 8)
    NumPut(w, SizeF, 0, "float"), NumPut(h, SizeF, 4, "float")
    }
    CreatePointF(ByRef PointF, x, y)
    {
    VarSetCapacity(PointF, 8)
    NumPut(x, PointF, 0, "float"), NumPut(y, PointF, 4, "float")
    }
    CreateDIBSection(w, h, hdc="", bpp=32, ByRef ppvBits=0)
    {
    hdc2 := hdc ? hdc : GetDC()
    VarSetCapacity(bi, 40, 0)
    NumPut(w, bi, 4), NumPut(h, bi, 8), NumPut(40, bi, 0), NumPut(1, bi, 12, "ushort"), NumPut(0, bi, 16), NumPut(bpp, bi, 14, "ushort")
    hbm := DllCall("CreateDIBSection", "uint" , hdc2, "uint" , &bi, "uint" , 0, "uint*", ppvBits, "uint" , 0, "uint" , 0)
    if !hdc
    ReleaseDC(hdc2)
    return hbm
    }
    PrintWindow(hwnd, hdc, Flags=0)
    {
    return DllCall("PrintWindow", "uint", hwnd, "uint", hdc, "uint", Flags)
    }
    DestroyIcon(hIcon)
    {
    return DllCall("DestroyIcon", "uint", hIcon)
    }
    PaintDesktop(hdc)
    {
    return DllCall("PaintDesktop", "uint", hdc)
    }
    CreateCompatibleBitmap(hdc, w, h)
    {
    return DllCall("gdi32\CreateCompatibleBitmap", "uint", hdc, "int", w, "int", h)
    }
    CreateCompatibleDC(hdc=0)
    {
    return DllCall("CreateCompatibleDC", "uint", hdc)
    }
    SelectObject(hdc, hgdiobj)
    {
    return DllCall("SelectObject", "uint", hdc, "uint", hgdiobj)
    }
    DeleteObject(hObject)
    {
    return DllCall("DeleteObject", "uint", hObject)
    }
    GetDC(hwnd=0)
    {
    return DllCall("GetDC", "uint", hwnd)
    }
    GetDCEx(hwnd, flags=0, hrgnClip=0)
    {
    return DllCall("GetDCEx", "uint", hwnd, "uint", hrgnClip, "int", flags)
    }
    ReleaseDC(hdc, hwnd=0)
    {
    return DllCall("ReleaseDC", "uint", hwnd, "uint", hdc)
    }
    DeleteDC(hdc)
    {
    return DllCall("DeleteDC", "uint", hdc)
    }
    Gdip_LibraryVersion()
    {
    return 1.45
    }
    Gdip_BitmapFromBRA(ByRef BRAFromMemIn, File, Alternate=0)
    {
    if !BRAFromMemIn
    return -1
    Loop, Parse, BRAFromMemIn, `n
    {
    if (A_Index = 1)
    {
    StringSplit, Header, A_LoopField, |
    if (Header0 != 4 || Header2 != "BRA!")
    return -2
    }
    else if (A_Index = 2)
    {
    StringSplit, Info, A_LoopField, |
    if (Info0 != 3)
    return -3
    }
    else
    break
    }
    if !Alternate
    StringReplace, File, File, \, \\, All
    RegExMatch(BRAFromMemIn, "mi`n)^" (Alternate ? File "\|.+?\|(\d+)\|(\d+)" : "\d+\|" File "\|(\d+)\|(\d+)") "$", FileInfo)
    if !FileInfo
    return -4
    hData := DllCall("GlobalAlloc", "uint", 2, "uint", FileInfo2)
    pData := DllCall("GlobalLock", "uint", hData)
    DllCall("RtlMoveMemory", "uint", pData, "uint", &BRAFromMemIn+Info2+FileInfo1, "uint", FileInfo2)
    DllCall("GlobalUnlock", "uint", hData)
    DllCall("ole32\CreateStreamOnHGlobal", "uint", hData, "int", 1, "uint*", pStream)
    DllCall("gdiplus\GdipCreateBitmapFromStream", "uint", pStream, "uint*", pBitmap)
    DllCall(NumGet(NumGet(1*pStream)+8), "uint", pStream)
    return pBitmap
    }
    Gdip_DrawRectangle(pGraphics, pPen, x, y, w, h)
    {
    return DllCall("gdiplus\GdipDrawRectangle", "uint", pGraphics, "uint", pPen, "float", x, "float", y, "float", w, "float", h)
    }
    Gdip_DrawRoundedRectangle(pGraphics, pPen, x, y, w, h, r)
    {
    Gdip_SetClipRect(pGraphics, x-r, y-r, 2*r, 2*r, 4)
    Gdip_SetClipRect(pGraphics, x+w-r, y-r, 2*r, 2*r, 4)
    Gdip_SetClipRect(pGraphics, x-r, y+h-r, 2*r, 2*r, 4)
    Gdip_SetClipRect(pGraphics, x+w-r, y+h-r, 2*r, 2*r, 4)
    E := Gdip_DrawRectangle(pGraphics, pPen, x, y, w, h)
    Gdip_ResetClip(pGraphics)
    Gdip_SetClipRect(pGraphics, x-(2*r), y+r, w+(4*r), h-(2*r), 4)
    Gdip_SetClipRect(pGraphics, x+r, y-(2*r), w-(2*r), h+(4*r), 4)
    Gdip_DrawEllipse(pGraphics, pPen, x, y, 2*r, 2*r)
    Gdip_DrawEllipse(pGraphics, pPen, x+w-(2*r), y, 2*r, 2*r)
    Gdip_DrawEllipse(pGraphics, pPen, x, y+h-(2*r), 2*r, 2*r)
    Gdip_DrawEllipse(pGraphics, pPen, x+w-(2*r), y+h-(2*r), 2*r, 2*r)
    Gdip_ResetClip(pGraphics)
    return E
    }
    Gdip_DrawEllipse(pGraphics, pPen, x, y, w, h)
    {
    return DllCall("gdiplus\GdipDrawEllipse", "uint", pGraphics, "uint", pPen, "float", x, "float", y, "float", w, "float", h)
    }
    Gdip_DrawBezier(pGraphics, pPen, x1, y1, x2, y2, x3, y3, x4, y4)
    {
    return DllCall("gdiplus\GdipDrawBezier", "uint", pgraphics, "uint", pPen
    , "float", x1, "float", y1, "float", x2, "float", y2
    , "float", x3, "float", y3, "float", x4, "float", y4)
    }
    Gdip_DrawArc(pGraphics, pPen, x, y, w, h, StartAngle, SweepAngle)
    {
    return DllCall("gdiplus\GdipDrawArc", "uint", pGraphics, "uint", pPen, "float", x
    , "float", y, "float", w, "float", h, "float", StartAngle, "float", SweepAngle)
    }
    Gdip_DrawPie(pGraphics, pPen, x, y, w, h, StartAngle, SweepAngle)
    {
    return DllCall("gdiplus\GdipDrawPie", "uint", pGraphics, "uint", pPen, "float", x, "float", y, "float", w, "float", h, "float", StartAngle, "float", SweepAngle)
    }
    Gdip_DrawLine(pGraphics, pPen, x1, y1, x2, y2)
    {
    return DllCall("gdiplus\GdipDrawLine", "uint", pGraphics, "uint", pPen
    , "float", x1, "float", y1, "float", x2, "float", y2)
    }
    Gdip_DrawLines(pGraphics, pPen, Points)
    {
    StringSplit, Points, Points, |
    VarSetCapacity(PointF, 8*Points0)
    Loop, %Points0%
    {
    StringSplit, Coord, Points%A_Index%, `,
    NumPut(Coord1, PointF, 8*(A_Index-1), "float"), NumPut(Coord2, PointF, (8*(A_Index-1))+4, "float")
    }
    return DllCall("gdiplus\GdipDrawLines", "uint", pGraphics, "uint", pPen, "uint", &PointF, "int", Points0)
    }
    Gdip_FillRectangle(pGraphics, pBrush, x, y, w, h)
    {
    return DllCall("gdiplus\GdipFillRectangle", "uint", pGraphics, "int", pBrush
    , "float", x, "float", y, "float", w, "float", h)
    }
    Gdip_FillRoundedRectangle(pGraphics, pBrush, x, y, w, h, r)
    {
    Region := Gdip_GetClipRegion(pGraphics)
    Gdip_SetClipRect(pGraphics, x-r, y-r, 2*r, 2*r, 4)
    Gdip_SetClipRect(pGraphics, x+w-r, y-r, 2*r, 2*r, 4)
    Gdip_SetClipRect(pGraphics, x-r, y+h-r, 2*r, 2*r, 4)
    Gdip_SetClipRect(pGraphics, x+w-r, y+h-r, 2*r, 2*r, 4)
    E := Gdip_FillRectangle(pGraphics, pBrush, x, y, w, h)
    Gdip_SetClipRegion(pGraphics, Region, 0)
    Gdip_SetClipRect(pGraphics, x-(2*r), y+r, w+(4*r), h-(2*r), 4)
    Gdip_SetClipRect(pGraphics, x+r, y-(2*r), w-(2*r), h+(4*r), 4)
    Gdip_FillEllipse(pGraphics, pBrush, x, y, 2*r, 2*r)
    Gdip_FillEllipse(pGraphics, pBrush, x+w-(2*r), y, 2*r, 2*r)
    Gdip_FillEllipse(pGraphics, pBrush, x, y+h-(2*r), 2*r, 2*r)
    Gdip_FillEllipse(pGraphics, pBrush, x+w-(2*r), y+h-(2*r), 2*r, 2*r)
    Gdip_SetClipRegion(pGraphics, Region, 0)
    Gdip_DeleteRegion(Region)
    return E
    }
    Gdip_FillPolygon(pGraphics, pBrush, Points, FillMode=0)
    {
    StringSplit, Points, Points, |
    VarSetCapacity(PointF, 8*Points0)
    Loop, %Points0%
    {
    StringSplit, Coord, Points%A_Index%, `,
    NumPut(Coord1, PointF, 8*(A_Index-1), "float"), NumPut(Coord2, PointF, (8*(A_Index-1))+4, "float")
    }
    return DllCall("gdiplus\GdipFillPolygon", "uint", pGraphics, "uint", pBrush, "uint", &PointF, "int", Points0, "int", FillMode)
    }
    Gdip_FillPie(pGraphics, pBrush, x, y, w, h, StartAngle, SweepAngle)
    {
    return DllCall("gdiplus\GdipFillPie", "uint", pGraphics, "uint", pBrush
    , "float", x, "float", y, "float", w, "float", h, "float", StartAngle, "float", SweepAngle)
    }
    Gdip_FillEllipse(pGraphics, pBrush, x, y, w, h)
    {
    return DllCall("gdiplus\GdipFillEllipse", "uint", pGraphics, "uint", pBrush, "float", x, "float", y, "float", w, "float", h)
    }
    Gdip_FillRegion(pGraphics, pBrush, Region)
    {
    return DllCall("gdiplus\GdipFillRegion", "uint", pGraphics, "uint", pBrush, "uint", Region)
    }
    Gdip_FillPath(pGraphics, pBrush, Path)
    {
    return DllCall("gdiplus\GdipFillPath", "uint", pGraphics, "uint", pBrush, "uint", Path)
    }
    Gdip_DrawImagePointsRect(pGraphics, pBitmap, Points, sx="", sy="", sw="", sh="", Matrix=1)
    {
    StringSplit, Points, Points, |
    VarSetCapacity(PointF, 8*Points0)
    Loop, %Points0%
    {
    StringSplit, Coord, Points%A_Index%, `,
    NumPut(Coord1, PointF, 8*(A_Index-1), "float"), NumPut(Coord2, PointF, (8*(A_Index-1))+4, "float")
    }
    if (Matrix&1 = "")
    ImageAttr := Gdip_SetImageAttributesColorMatrix(Matrix)
    else if (Matrix != 1)
    ImageAttr := Gdip_SetImageAttributesColorMatrix("1|0|0|0|0|0|1|0|0|0|0|0|1|0|0|0|0|0|" Matrix "|0|0|0|0|0|1")
    if (sx = "" && sy = "" && sw = "" && sh = "")
    {
    sx := 0, sy := 0
    sw := Gdip_GetImageWidth(pBitmap)
    sh := Gdip_GetImageHeight(pBitmap)
    }
    E := DllCall("gdiplus\GdipDrawImagePointsRect", "uint", pGraphics, "uint", pBitmap
    , "uint", &PointF, "int", Points0, "float", sx, "float", sy, "float", sw, "float", sh
    , "int", 2, "uint", ImageAttr, "uint", 0, "uint", 0)
    if ImageAttr
    Gdip_DisposeImageAttributes(ImageAttr)
    return E
    }
    Gdip_DrawImage(pGraphics, pBitmap, dx="", dy="", dw="", dh="", sx="", sy="", sw="", sh="", Matrix=1)
    {
    if (Matrix&1 = "")
    ImageAttr := Gdip_SetImageAttributesColorMatrix(Matrix)
    else if (Matrix != 1)
    ImageAttr := Gdip_SetImageAttributesColorMatrix("1|0|0|0|0|0|1|0|0|0|0|0|1|0|0|0|0|0|" Matrix "|0|0|0|0|0|1")
    if (sx = "" && sy = "" && sw = "" && sh = "")
    {
    if (dx = "" && dy = "" && dw = "" && dh = "")
    {
    sx := dx := 0, sy := dy := 0
    sw := dw := Gdip_GetImageWidth(pBitmap)
    sh := dh := Gdip_GetImageHeight(pBitmap)
    }
    else
    {
    sx := sy := 0
    sw := Gdip_GetImageWidth(pBitmap)
    sh := Gdip_GetImageHeight(pBitmap)
    }
    }
    E := DllCall("gdiplus\GdipDrawImageRectRect", "uint", pGraphics, "uint", pBitmap
    , "float", dx, "float", dy, "float", dw, "float", dh
    , "float", sx, "float", sy, "float", sw, "float", sh
    , "int", 2, "uint", ImageAttr, "uint", 0, "uint", 0)
    if ImageAttr
    Gdip_DisposeImageAttributes(ImageAttr)
    return E
    }
    Gdip_SetImageAttributesColorMatrix(Matrix)
    {
    VarSetCapacity(ColourMatrix, 100, 0)
    Matrix := RegExReplace(RegExReplace(Matrix, "^[^\d-\.]+([\d\.])", "$1", "", 1), "[^\d-\.]+", "|")
    StringSplit, Matrix, Matrix, |
    Loop, 25
    {
    Matrix := (Matrix%A_Index% != "") ? Matrix%A_Index% : Mod(A_Index-1, 6) ? 0 : 1
    NumPut(Matrix, ColourMatrix, (A_Index-1)*4, "float")
    }
    DllCall("gdiplus\GdipCreateImageAttributes", "uint*", ImageAttr)
    DllCall("gdiplus\GdipSetImageAttributesColorMatrix", "uint", ImageAttr, "int", 1, "int", 1, "uint", &ColourMatrix, "int", 0, "int", 0)
    return ImageAttr
    }
    Gdip_GraphicsFromImage(pBitmap)
    {
    DllCall("gdiplus\GdipGetImageGraphicsContext", "uint", pBitmap, "uint*", pGraphics)
    return pGraphics
    }
    Gdip_GraphicsFromHDC(hdc)
    {
    DllCall("gdiplus\GdipCreateFromHDC", "uint", hdc, "uint*", pGraphics)
    return pGraphics
    }
    Gdip_GetDC(pGraphics)
    {
    DllCall("gdiplus\GdipGetDC", "uint", pGraphics, "uint*", hdc)
    return hdc
    }
    Gdip_ReleaseDC(pGraphics, hdc)
    {
    return DllCall("gdiplus\GdipReleaseDC", "uint", pGraphics, "uint", hdc)
    }
    Gdip_GraphicsClear(pGraphics, ARGB=0x00ffffff)
    {
    return DllCall("gdiplus\GdipGraphicsClear", "uint", pGraphics, "int", ARGB)
    }
    Gdip_BlurBitmap(pBitmap, Blur)
    {
    if (Blur > 100) || (Blur < 1)
    return -1
    sWidth := Gdip_GetImageWidth(pBitmap), sHeight := Gdip_GetImageHeight(pBitmap)
    dWidth := sWidth//Blur, dHeight := sHeight//Blur
    pBitmap1 := Gdip_CreateBitmap(dWidth, dHeight)
    G1 := Gdip_GraphicsFromImage(pBitmap1)
    Gdip_SetInterpolationMode(G1, 7)
    Gdip_DrawImage(G1, pBitmap, 0, 0, dWidth, dHeight, 0, 0, sWidth, sHeight)
    Gdip_DeleteGraphics(G1)
    pBitmap2 := Gdip_CreateBitmap(sWidth, sHeight)
    G2 := Gdip_GraphicsFromImage(pBitmap2)
    Gdip_SetInterpolationMode(G2, 7)
    Gdip_DrawImage(G2, pBitmap1, 0, 0, sWidth, sHeight, 0, 0, dWidth, dHeight)
    Gdip_DeleteGraphics(G2)
    Gdip_DisposeImage(pBitmap1)
    return pBitmap2
    }
    Gdip_SaveBitmapToFile(pBitmap, sOutput, Quality=75)
    {
    SplitPath, sOutput,,, Extension
    if Extension not in BMP,DIB,RLE,JPG,JPEG,JPE,JFIF,GIF,TIF,TIFF,PNG
    return -1
    Extension := "." Extension
    DllCall("gdiplus\GdipGetImageEncodersSize", "uint*", nCount, "uint*", nSize)
    VarSetCapacity(ci, nSize)
    DllCall("gdiplus\GdipGetImageEncoders", "uint", nCount, "uint", nSize, "uint", &ci)
    if !(nCount && nSize)
    return -2
    Loop, %nCount%
    {
    Location := NumGet(ci, 76*(A_Index-1)+44)
    if !A_IsUnicode
    {
    nSize := DllCall("WideCharToMultiByte", "uint", 0, "uint", 0, "uint", Location, "int", -1, "uint", 0, "int",  0, "uint", 0, "uint", 0)
    VarSetCapacity(sString, nSize)
    DllCall("WideCharToMultiByte", "uint", 0, "uint", 0, "uint", Location, "int", -1, "str", sString, "int", nSize, "uint", 0, "uint", 0)
    if !InStr(sString, "*" Extension)
    continue
    }
    else
    {
    nSize := DllCall("WideCharToMultiByte", "uint", 0, "uint", 0, "uint", Location, "int", -1, "uint", 0, "int",  0, "uint", 0, "uint", 0)
    sString := ""
    Loop, %nSize%
    sString .= Chr(NumGet(Location+0, 2*(A_Index-1), "char"))
    if !InStr(sString, "*" Extension)
    continue
    }
    pCodec := &ci+76*(A_Index-1)
    break
    }
    if !pCodec
    return -3
    if (Quality != 75)
    {
    Quality := (Quality < 0) ? 0 : (Quality > 100) ? 100 : Quality
    if Extension in .JPG,.JPEG,.JPE,.JFIF
    {
    DllCall("gdiplus\GdipGetEncoderParameterListSize", "uint", pBitmap, "uint", pCodec, "uint*", nSize)
    VarSetCapacity(EncoderParameters, nSize, 0)
    DllCall("gdiplus\GdipGetEncoderParameterList", "uint", pBitmap, "uint", pCodec, "uint", nSize, "uint", &EncoderParameters)
    Loop, % NumGet(EncoderParameters)
    {
    if (NumGet(EncoderParameters, (28*(A_Index-1))+20) = 1) && (NumGet(EncoderParameters, (28*(A_Index-1))+24) = 6)
    {
    p := (28*(A_Index-1))+&EncoderParameters
    NumPut(Quality, NumGet(NumPut(4, NumPut(1, p+0)+20)))
    break
    }
    }
    }
    }
    if !A_IsUnicode
    {
    nSize := DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, "uint", &sOutput, "int", -1, "uint", 0, "int", 0)
    VarSetCapacity(wOutput, nSize*2)
    DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, "uint", &sOutput, "int", -1, "uint", &wOutput, "int", nSize)
    VarSetCapacity(wOutput, -1)
    if !VarSetCapacity(wOutput)
    return -4
    E := DllCall("gdiplus\GdipSaveImageToFile", "uint", pBitmap, "uint", &wOutput, "uint", pCodec, "uint", p ? p : 0)
    }
    else
    E := DllCall("gdiplus\GdipSaveImageToFile", "uint", pBitmap, "uint", &sOutput, "uint", pCodec, "uint", p ? p : 0)
    return E ? -5 : 0
    }
    Gdip_GetPixel(pBitmap, x, y)
    {
    DllCall("gdiplus\GdipBitmapGetPixel", "uint", pBitmap, "int", x, "int", y, "uint*", ARGB)
    return ARGB
    }
    Gdip_SetPixel(pBitmap, x, y, ARGB)
    {
    return DllCall("gdiplus\GdipBitmapSetPixel", "uint", pBitmap, "int", x, "int", y, "int", ARGB)
    }
    Gdip_GetImageWidth(pBitmap)
    {
    DllCall("gdiplus\GdipGetImageWidth", "uint", pBitmap, "uint*", Width)
    return Width
    }
    Gdip_GetImageHeight(pBitmap)
    {
    DllCall("gdiplus\GdipGetImageHeight", "uint", pBitmap, "uint*", Height)
    return Height
    }
    Gdip_GetImageDimensions(pBitmap, ByRef Width, ByRef Height)
    {
    DllCall("gdiplus\GdipGetImageWidth", "uint", pBitmap, "uint*", Width)
    DllCall("gdiplus\GdipGetImageHeight", "uint", pBitmap, "uint*", Height)
    }
    Gdip_GetDimensions(pBitmap, ByRef Width, ByRef Height)
    {
    Gdip_GetImageDimensions(pBitmap, Width, Height)
    }
    Gdip_GetImagePixelFormat(pBitmap)
    {
    DllCall("gdiplus\GdipGetImagePixelFormat", "uint", pBitmap, "uint*", Format)
    return Format
    }
    Gdip_GetDpiX(pGraphics)
    {
    DllCall("gdiplus\GdipGetDpiX", "uint", pGraphics, "float*", dpix)
    return Round(dpix)
    }
    Gdip_GetDpiY(pGraphics)
    {
    DllCall("gdiplus\GdipGetDpiY", "uint", pGraphics, "float*", dpiy)
    return Round(dpiy)
    }
    Gdip_GetImageHorizontalResolution(pBitmap)
    {
    DllCall("gdiplus\GdipGetImageHorizontalResolution", "uint", pBitmap, "float*", dpix)
    return Round(dpix)
    }
    Gdip_GetImageVerticalResolution(pBitmap)
    {
    DllCall("gdiplus\GdipGetImageVerticalResolution", "uint", pBitmap, "float*", dpiy)
    return Round(dpiy)
    }
    Gdip_BitmapSetResolution(pBitmap, dpix, dpiy)
    {
    return DllCall("gdiplus\GdipBitmapSetResolution", "uint", pBitmap, "float", dpix, "float", dpiy)
    }
    Gdip_CreateBitmapFromFile(sFile, IconNumber=1, IconSize="")
    {
    SplitPath, sFile,,, ext
    if ext in exe,dll
    {
    Sizes := IconSize ? IconSize : 256 "|" 128 "|" 64 "|" 48 "|" 32 "|" 16
    VarSetCapacity(buf, 40)
    Loop, Parse, Sizes, |
    {
    DllCall("PrivateExtractIcons", "str", sFile, "int", IconNumber-1, "int", A_LoopField, "int", A_LoopField, "uint*", hIcon, "uint*", 0, "uint", 1, "uint", 0)
    if !hIcon
    continue
    if !DllCall("GetIconInfo", "uint", hIcon, "uint", &buf)
    {
    DestroyIcon(hIcon)
    continue
    }
    hbmColor := NumGet(buf, 16)
    hbmMask  := NumGet(buf, 12)
    if !(hbmColor && DllCall("GetObject", "uint", hbmColor, "int", 24, "uint", &buf))
    {
    DestroyIcon(hIcon)
    continue
    }
    break
    }
    if !hIcon
    return -1
    Width := NumGet(buf, 4, "int"),  Height := NumGet(buf, 8, "int")
    hbm := CreateDIBSection(Width, -Height), hdc := CreateCompatibleDC(), obm := SelectObject(hdc, hbm)
    if !DllCall("DrawIconEx", "uint", hdc, "int", 0, "int", 0, "uint", hIcon, "uint", Width, "uint", Height, "uint", 0, "uint", 0, "uint", 3)
    {
    DestroyIcon(hIcon)
    return -2
    }
    VarSetCapacity(dib, 84)
    DllCall("GetObject", "uint", hbm, "int", 84, "uint", &dib)
    Stride := NumGet(dib, 12), Bits := NumGet(dib, 20)
    DllCall("gdiplus\GdipCreateBitmapFromScan0", "int", Width, "int", Height, "int", Stride, "int", 0x26200A, "uint", Bits, "uint*", pBitmapOld)
    pBitmap := Gdip_CreateBitmap(Width, Height), G := Gdip_GraphicsFromImage(pBitmap)
    Gdip_DrawImage(G, pBitmapOld, 0, 0, Width, Height, 0, 0, Width, Height)
    SelectObject(hdc, obm), DeleteObject(hbm), DeleteDC(hdc)
    Gdip_DeleteGraphics(G), Gdip_DisposeImage(pBitmapOld)
    DestroyIcon(hIcon)
    }
    else
    {
    if !A_IsUnicode
    {
    VarSetCapacity(wFile, 1023)
    DllCall("kernel32\MultiByteToWideChar", "uint", 0, "uint", 0, "uint", &sFile, "int", -1, "uint", &wFile, "int", 512)
    DllCall("gdiplus\GdipCreateBitmapFromFile", "uint", &wFile, "uint*", pBitmap)
    }
    else
    DllCall("gdiplus\GdipCreateBitmapFromFile", "uint", &sFile, "uint*", pBitmap)
    }
    return pBitmap
    }
    Gdip_CreateBitmapFromHBITMAP(hBitmap, Palette=0)
    {
    DllCall("gdiplus\GdipCreateBitmapFromHBITMAP", "uint", hBitmap, "uint", Palette, "uint*", pBitmap)
    return pBitmap
    }
    Gdip_CreateHBITMAPFromBitmap(pBitmap, Background=0xffffffff)
    {
    DllCall("gdiplus\GdipCreateHBITMAPFromBitmap", "uint", pBitmap, "uint*", hbm, "int", Background)
    return hbm
    }
    Gdip_CreateBitmapFromHICON(hIcon)
    {
    DllCall("gdiplus\GdipCreateBitmapFromHICON", "uint", hIcon, "uint*", pBitmap)
    return pBitmap
    }
    Gdip_CreateHICONFromBitmap(pBitmap)
    {
    DllCall("gdiplus\GdipCreateHICONFromBitmap", "uint", pBitmap, "uint*", hIcon)
    return hIcon
    }
    Gdip_CreateBitmap(Width, Height, Format=0x26200A)
    {
    DllCall("gdiplus\GdipCreateBitmapFromScan0", "int", Width, "int", Height, "int", 0, "int", Format, "uint", 0, "uint*", pBitmap)
    Return pBitmap
    }
    Gdip_CreateBitmapFromClipboard()
    {
    if !DllCall("OpenClipboard", "uint", 0)
    return -1
    if !DllCall("IsClipboardFormatAvailable", "uint", 8)
    return -2
    if !hBitmap := DllCall("GetClipboardData", "uint", 2)
    return -3
    if !pBitmap := Gdip_CreateBitmapFromHBITMAP(hBitmap)
    return -4
    if !DllCall("CloseClipboard")
    return -5
    DeleteObject(hBitmap)
    return pBitmap
    }
    Gdip_SetBitmapToClipboard(pBitmap)
    {
    hBitmap := Gdip_CreateHBITMAPFromBitmap(pBitmap)
    DllCall("GetObject", "uint", hBitmap, "int", VarSetCapacity(oi, 84, 0), "uint", &oi)
    hdib := DllCall("GlobalAlloc", "uint", 2, "uint", 40+NumGet(oi, 44))
    pdib := DllCall("GlobalLock", "uint", hdib)
    DllCall("RtlMoveMemory", "uint", pdib, "uint", &oi+24, "uint", 40)
    DllCall("RtlMoveMemory", "Uint", pdib+40, "Uint", NumGet(oi, 20), "uint", NumGet(oi, 44))
    DllCall("GlobalUnlock", "uint", hdib)
    DllCall("DeleteObject", "uint", hBitmap)
    DllCall("OpenClipboard", "uint", 0)
    DllCall("EmptyClipboard")
    DllCall("SetClipboardData", "uint", 8, "uint", hdib)
    DllCall("CloseClipboard")
    }
    Gdip_CloneBitmapArea(pBitmap, x, y, w, h, Format=0x26200A)
    {
    DllCall("gdiplus\GdipCloneBitmapArea", "float", x, "float", y, "float", w, "float", h
    , "int", Format, "uint", pBitmap, "uint*", pBitmapDest)
    return pBitmapDest
    }
    Gdip_CreatePen(ARGB, w)
    {
    DllCall("gdiplus\GdipCreatePen1", "int", ARGB, "float", w, "int", 2, "uint*", pPen)
    return pPen
    }
    Gdip_CreatePenFromBrush(pBrush, w)
    {
    DllCall("gdiplus\GdipCreatePen2", "uint", pBrush, "float", w, "int", 2, "uint*", pPen)
    return pPen
    }
    Gdip_BrushCreateSolid(ARGB=0xff000000)
    {
    DllCall("gdiplus\GdipCreateSolidFill", "int", ARGB, "uint*", pBrush)
    return pBrush
    }
    Gdip_BrushCreateHatch(ARGBfront, ARGBback, HatchStyle=0)
    {
    DllCall("gdiplus\GdipCreateHatchBrush", "int", HatchStyle, "int", ARGBfront, "int", ARGBback, "uint*", pBrush)
    return pBrush
    }
    Gdip_CreateTextureBrush(pBitmap, WrapMode=1, x=0, y=0, w="", h="")
    {
    if !(w && h)
    DllCall("gdiplus\GdipCreateTexture", "uint", pBitmap, "int", WrapMode, "uint*", pBrush)
    else
    DllCall("gdiplus\GdipCreateTexture2", "uint", pBitmap, "int", WrapMode, "float", x, "float", y, "float", w, "float", h, "uint*", pBrush)
    return pBrush
    }
    Gdip_CreateLineBrush(x1, y1, x2, y2, ARGB1, ARGB2, WrapMode=1)
    {
    CreatePointF(PointF1, x1, y1), CreatePointF(PointF2, x2, y2)
    DllCall("gdiplus\GdipCreateLineBrush", "uint", &PointF1, "uint", &PointF2, "int", ARGB1, "int", ARGB2, "int", WrapMode, "uint*", LGpBrush)
    return LGpBrush
    }
    Gdip_CreateLineBrushFromRect(x, y, w, h, ARGB1, ARGB2, LinearGradientMode=1, WrapMode=1)
    {
    CreateRectF(RectF, x, y, w, h)
    DllCall("gdiplus\GdipCreateLineBrushFromRect", "uint", &RectF, "int", ARGB1, "int", ARGB2, "int", LinearGradientMode, "int", WrapMode, "uint*", LGpBrush)
    return LGpBrush
    }
    Gdip_CloneBrush(pBrush)
    {
    DllCall("gdiplus\GdipCloneBrush", "uint", pBrush, "uint*", pBrushClone)
    return pBrushClone
    }
    Gdip_DeletePen(pPen)
    {
    return DllCall("gdiplus\GdipDeletePen", "uint", pPen)
    }
    Gdip_DeleteBrush(pBrush)
    {
    return DllCall("gdiplus\GdipDeleteBrush", "uint", pBrush)
    }
    Gdip_DisposeImage(pBitmap)
    {
    return DllCall("gdiplus\GdipDisposeImage", "uint", pBitmap)
    }
    Gdip_DeleteGraphics(pGraphics)
    {
    return DllCall("gdiplus\GdipDeleteGraphics", "uint", pGraphics)
    }
    Gdip_DisposeImageAttributes(ImageAttr)
    {
    return DllCall("gdiplus\GdipDisposeImageAttributes", "uint", ImageAttr)
    }
    Gdip_DeleteFont(hFont)
    {
    return DllCall("gdiplus\GdipDeleteFont", "uint", hFont)
    }
    Gdip_DeleteStringFormat(hFormat)
    {
    return DllCall("gdiplus\GdipDeleteStringFormat", "uint", hFormat)
    }
    Gdip_DeleteFontFamily(hFamily)
    {
    return DllCall("gdiplus\GdipDeleteFontFamily", "uint", hFamily)
    }
    Gdip_DeleteMatrix(Matrix)
    {
    return DllCall("gdiplus\GdipDeleteMatrix", "uint", Matrix)
    }
    Gdip_TextToGraphics(pGraphics, Text, Options, Font="Arial", Width="", Height="", Measure=0)
    {
    IWidth := Width, IHeight:= Height
    RegExMatch(Options, "i)X([\-\d\.]+)(p*)", xpos)
    RegExMatch(Options, "i)Y([\-\d\.]+)(p*)", ypos)
    RegExMatch(Options, "i)W([\-\d\.]+)(p*)", Width)
    RegExMatch(Options, "i)H([\-\d\.]+)(p*)", Height)
    RegExMatch(Options, "i)C(?!(entre|enter))([a-f\d]+)", Colour)
    RegExMatch(Options, "i)Top|Up|Bottom|Down|vCentre|vCenter", vPos)
    RegExMatch(Options, "i)NoWrap", NoWrap)
    RegExMatch(Options, "i)R(\d)", Rendering)
    RegExMatch(Options, "i)S(\d+)(p*)", Size)
    if !Gdip_DeleteBrush(Gdip_CloneBrush(Colour2))
    PassBrush := 1, pBrush := Colour2
    if !(IWidth && IHeight) && (xpos2 || ypos2 || Width2 || Height2 || Size2)
    return -1
    Style := 0, Styles := "Regular|Bold|Italic|BoldItalic|Underline|Strikeout"
    Loop, Parse, Styles, |
    {
    if RegExMatch(Options, "\b" A_loopField)
    Style |= (A_LoopField != "StrikeOut") ? (A_Index-1) : 8
    }
    Align := 0, Alignments := "Near|Left|Centre|Center|Far|Right"
    Loop, Parse, Alignments, |
    {
    if RegExMatch(Options, "\b" A_loopField)
    Align |= A_Index//2.1
    }
    xpos := (xpos1 != "") ? xpos2 ? IWidth*(xpos1/100) : xpos1 : 0
    ypos := (ypos1 != "") ? ypos2 ? IHeight*(ypos1/100) : ypos1 : 0
    Width := Width1 ? Width2 ? IWidth*(Width1/100) : Width1 : IWidth
    Height := Height1 ? Height2 ? IHeight*(Height1/100) : Height1 : IHeight
    if !PassBrush
    Colour := "0x" (Colour2 ? Colour2 : "ff000000")
    Rendering := ((Rendering1 >= 0) && (Rendering1 <= 5)) ? Rendering1 : 4
    Size := (Size1 > 0) ? Size2 ? IHeight*(Size1/100) : Size1 : 12
    hFamily := Gdip_FontFamilyCreate(Font)
    hFont := Gdip_FontCreate(hFamily, Size, Style)
    FormatStyle := NoWrap ? 0x4000 | 0x1000 : 0x4000
    hFormat := Gdip_StringFormatCreate(FormatStyle)
    pBrush := PassBrush ? pBrush : Gdip_BrushCreateSolid(Colour)
    if !(hFamily && hFont && hFormat && pBrush && pGraphics)
    return !pGraphics ? -2 : !hFamily ? -3 : !hFont ? -4 : !hFormat ? -5 : !pBrush ? -6 : 0
    CreateRectF(RC, xpos, ypos, Width, Height)
    Gdip_SetStringFormatAlign(hFormat, Align)
    Gdip_SetTextRenderingHint(pGraphics, Rendering)
    ReturnRC := Gdip_MeasureString(pGraphics, Text, hFont, hFormat, RC)
    if vPos
    {
    StringSplit, ReturnRC, ReturnRC, |
    if (vPos = "vCentre") || (vPos = "vCenter")
    ypos += (Height-ReturnRC4)//2
    else if (vPos = "Top") || (vPos = "Up")
    ypos := 0
    else if (vPos = "Bottom") || (vPos = "Down")
    ypos := Height-ReturnRC4
    CreateRectF(RC, xpos, ypos, Width, ReturnRC4)
    ReturnRC := Gdip_MeasureString(pGraphics, Text, hFont, hFormat, RC)
    }
    if !Measure
    E := Gdip_DrawString(pGraphics, Text, hFont, hFormat, pBrush, RC)
    if !PassBrush
    Gdip_DeleteBrush(pBrush)
    Gdip_DeleteStringFormat(hFormat)
    Gdip_DeleteFont(hFont)
    Gdip_DeleteFontFamily(hFamily)
    return E ? E : ReturnRC
    }
    Gdip_DrawString(pGraphics, sString, hFont, hFormat, pBrush, ByRef RectF)
    {
    if !A_IsUnicode
    {
    nSize := DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, "uint", &sString, "int", -1, "uint", 0, "int", 0)
    VarSetCapacity(wString, nSize*2)
    DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, "uint", &sString, "int", -1, "uint", &wString, "int", nSize)
    return DllCall("gdiplus\GdipDrawString", "uint", pGraphics
    , "uint", &wString, "int", -1, "uint", hFont, "uint", &RectF, "uint", hFormat, "uint", pBrush)
    }
    else
    {
    return DllCall("gdiplus\GdipDrawString", "uint", pGraphics
    , "uint", &sString, "int", -1, "uint", hFont, "uint", &RectF, "uint", hFormat, "uint", pBrush)
    }
    }
    Gdip_MeasureString(pGraphics, sString, hFont, hFormat, ByRef RectF)
    {
    VarSetCapacity(RC, 16)
    if !A_IsUnicode
    {
    nSize := DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, "uint", &sString, "int", -1, "uint", 0, "int", 0)
    VarSetCapacity(wString, nSize*2)
    DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, "uint", &sString, "int", -1, "uint", &wString, "int", nSize)
    DllCall("gdiplus\GdipMeasureString", "uint", pGraphics
    , "uint", &wString, "int", -1, "uint", hFont, "uint", &RectF, "uint", hFormat, "uint", &RC, "uint*", Chars, "uint*", Lines)
    }
    else
    {
    DllCall("gdiplus\GdipMeasureString", "uint", pGraphics
    , "uint", &sString, "int", -1, "uint", hFont, "uint", &RectF, "uint", hFormat, "uint", &RC, "uint*", Chars, "uint*", Lines)
    }
    return &RC ? NumGet(RC, 0, "float") "|" NumGet(RC, 4, "float") "|" NumGet(RC, 8, "float") "|" NumGet(RC, 12, "float") "|" Chars "|" Lines : 0
    }
    Gdip_SetStringFormatAlign(hFormat, Align)
    {
    return DllCall("gdiplus\GdipSetStringFormatAlign", "uint", hFormat, "int", Align)
    }
    Gdip_StringFormatCreate(Format=0, Lang=0)
    {
    DllCall("gdiplus\GdipCreateStringFormat", "int", Format, "int", Lang, "uint*", hFormat)
    return hFormat
    }
    Gdip_FontCreate(hFamily, Size, Style=0)
    {
    DllCall("gdiplus\GdipCreateFont", "uint", hFamily, "float", Size, "int", Style, "int", 0, "uint*", hFont)
    return hFont
    }
    Gdip_FontFamilyCreate(Font)
    {
    if !A_IsUnicode
    {
    nSize := DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, "uint", &Font, "int", -1, "uint", 0, "int", 0)
    VarSetCapacity(wFont, nSize*2)
    DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, "uint", &Font, "int", -1, "uint", &wFont, "int", nSize)
    DllCall("gdiplus\GdipCreateFontFamilyFromName", "uint", &wFont, "uint", 0, "uint*", hFamily)
    }
    else
    DllCall("gdiplus\GdipCreateFontFamilyFromName", "uint", &Font, "uint", 0, "uint*", hFamily)
    return hFamily
    }
    Gdip_CreateAffineMatrix(m11, m12, m21, m22, x, y)
    {
    DllCall("gdiplus\GdipCreateMatrix2", "float", m11, "float", m12, "float", m21, "float", m22, "float", x, "float", y, "uint*", Matrix)
    return Matrix
    }
    Gdip_CreateMatrix()
    {
    DllCall("gdiplus\GdipCreateMatrix", "uint*", Matrix)
    return Matrix
    }
    Gdip_CreatePath(BrushMode=0)
    {
    DllCall("gdiplus\GdipCreatePath", "int", BrushMode, "uint*", Path)
    return Path
    }
    Gdip_AddPathEllipse(Path, x, y, w, h)
    {
    return DllCall("gdiplus\GdipAddPathEllipse", "uint", Path, "float", x, "float", y, "float", w, "float", h)
    }
    Gdip_AddPathPolygon(Path, Points)
    {
    StringSplit, Points, Points, |
    VarSetCapacity(PointF, 8*Points0)
    Loop, %Points0%
    {
    StringSplit, Coord, Points%A_Index%, `,
    NumPut(Coord1, PointF, 8*(A_Index-1), "float"), NumPut(Coord2, PointF, (8*(A_Index-1))+4, "float")
    }
    return DllCall("gdiplus\GdipAddPathPolygon", "uint", Path, "uint", &PointF, "int", Points0)
    }
    Gdip_DeletePath(Path)
    {
    return DllCall("gdiplus\GdipDeletePath", "uint", Path)
    }
    Gdip_SetTextRenderingHint(pGraphics, RenderingHint)
    {
    return DllCall("gdiplus\GdipSetTextRenderingHint", "uint", pGraphics, "int", RenderingHint)
    }
    Gdip_SetInterpolationMode(pGraphics, InterpolationMode)
    {
    return DllCall("gdiplus\GdipSetInterpolationMode", "uint", pGraphics, "int", InterpolationMode)
    }
    Gdip_SetSmoothingMode(pGraphics, SmoothingMode)
    {
    return DllCall("gdiplus\GdipSetSmoothingMode", "uint", pGraphics, "int", SmoothingMode)
    }
    Gdip_SetCompositingMode(pGraphics, CompositingMode=0)
    {
    return DllCall("gdiplus\GdipSetCompositingMode", "uint", pGraphics, "int", CompositingMode)
    }
    Gdip_Startup()
    {
    if !DllCall("GetModuleHandle", "str", "gdiplus")
    DllCall("LoadLibrary", "str", "gdiplus")
    VarSetCapacity(si, 16, 0), si := Chr(1)
    DllCall("gdiplus\GdiplusStartup", "uint*", pToken, "uint", &si, "uint", 0)
    return pToken
    }
    Gdip_Shutdown(pToken)
    {
    DllCall("gdiplus\GdiplusShutdown", "uint", pToken)
    if hModule := DllCall("GetModuleHandle", "str", "gdiplus")
    DllCall("FreeLibrary", "uint", hModule)
    return 0
    }
    Gdip_RotateWorldTransform(pGraphics, Angle, MatrixOrder=0)
    {
    return DllCall("gdiplus\GdipRotateWorldTransform", "uint", pGraphics, "float", Angle, "int", MatrixOrder)
    }
    Gdip_ScaleWorldTransform(pGraphics, x, y, MatrixOrder=0)
    {
    return DllCall("gdiplus\GdipScaleWorldTransform", "uint", pGraphics, "float", x, "float", y, "int", MatrixOrder)
    }
    Gdip_TranslateWorldTransform(pGraphics, x, y, MatrixOrder=0)
    {
    return DllCall("gdiplus\GdipTranslateWorldTransform", "uint", pGraphics, "float", x, "float", y, "int", MatrixOrder)
    }
    Gdip_ResetWorldTransform(pGraphics)
    {
    return DllCall("gdiplus\GdipResetWorldTransform", "uint", pGraphics)
    }
    Gdip_GetRotatedTranslation(Width, Height, Angle, ByRef xTranslation, ByRef yTranslation)
    {
    pi := 3.14159, TAngle := Angle*(pi/180)
    Bound := (Angle >= 0) ? Mod(Angle, 360) : 360-Mod(-Angle, -360)
    if ((Bound >= 0) && (Bound <= 90))
    xTranslation := Height*Sin(TAngle), yTranslation := 0
    else if ((Bound > 90) && (Bound <= 180))
    xTranslation := (Height*Sin(TAngle))-(Width*Cos(TAngle)), yTranslation := -Height*Cos(TAngle)
    else if ((Bound > 180) && (Bound <= 270))
    xTranslation := -(Width*Cos(TAngle)), yTranslation := -(Height*Cos(TAngle))-(Width*Sin(TAngle))
    else if ((Bound > 270) && (Bound <= 360))
    xTranslation := 0, yTranslation := -Width*Sin(TAngle)
    }
    Gdip_GetRotatedDimensions(Width, Height, Angle, ByRef RWidth, ByRef RHeight)
    {
    pi := 3.14159, TAngle := Angle*(pi/180)
    if !(Width && Height)
    return -1
    RWidth := Ceil(Abs(Width*Cos(TAngle))+Abs(Height*Sin(TAngle)))
    RHeight := Ceil(Abs(Width*Sin(TAngle))+Abs(Height*Cos(Tangle)))
    }
    Gdip_ImageRotateFlip(pBitmap, RotateFlipType=1)
    {
    return DllCall("gdiplus\GdipImageRotateFlip", "uint", pBitmap, "int", RotateFlipType)
    }
    Gdip_SetClipRect(pGraphics, x, y, w, h, CombineMode=0)
    {
    return DllCall("gdiplus\GdipSetClipRect", "uint", pGraphics, "float", x, "float", y, "float", w, "float", h, "int", CombineMode)
    }
    Gdip_SetClipPath(pGraphics, Path, CombineMode=0)
    {
    return DllCall("gdiplus\GdipSetClipPath", "uint", pGraphics, "uint", Path, "int", CombineMode)
    }
    Gdip_ResetClip(pGraphics)
    {
    return DllCall("gdiplus\GdipResetClip", "uint", pGraphics)
    }
    Gdip_GetClipRegion(pGraphics)
    {
    Region := Gdip_CreateRegion()
    DllCall("gdiplus\GdipGetClip", "uint" pGraphics, "uint*", Region)
    return Region
    }
    Gdip_SetClipRegion(pGraphics, Region, CombineMode=0)
    {
    return DllCall("gdiplus\GdipSetClipRegion", "uint", pGraphics, "uint", Region, "int", CombineMode)
    }
    Gdip_CreateRegion()
    {
    DllCall("gdiplus\GdipCreateRegion", "uint*", Region)
    return Region
    }
    Gdip_DeleteRegion(Region)
    {
    return DllCall("gdiplus\GdipDeleteRegion", "uint", Region)
    }
    Gdip_LockBits(pBitmap, x, y, w, h, ByRef Stride, ByRef Scan0, ByRef BitmapData, LockMode = 3, PixelFormat = 0x26200a)
    {
    CreateRect(Rect, x, y, w, h)
    VarSetCapacity(BitmapData, 21, 0)
    E := DllCall("Gdiplus\GdipBitmapLockBits", "uint", pBitmap, "uint", &Rect, "uint", LockMode, "int", PixelFormat, "uint", &BitmapData)
    Stride := NumGet(BitmapData, 8)
    Scan0 := NumGet(BitmapData, 16)
    return E
    }
    Gdip_UnlockBits(pBitmap, ByRef BitmapData)
    {
    return DllCall("Gdiplus\GdipBitmapUnlockBits", "uint", pBitmap, "uint", &BitmapData)
    }
    Gdip_SetLockBitPixel(ARGB, Scan0, x, y, Stride)
    {
    Numput(ARGB, Scan0+0, (x*4)+(y*Stride))
    }
    Gdip_GetLockBitPixel(Scan0, x, y, Stride)
    {
    return NumGet(Scan0+0, (x*4)+(y*Stride))
    }
    Gdip_PixelateBitmap(pBitmap, ByRef pBitmapOut, BlockSize)
    {
    static PixelateBitmap
    if !PixelateBitmap
    {
    MCode_PixelateBitmap := "83EC388B4424485355568B74245C99F7FE8B5C244C8B6C2448578BF88BCA894C241C897C243485FF0F8E2E0300008B44245"
    . "499F7FE897C24448944242833C089542418894424308944242CEB038D490033FF397C2428897C24380F8E750100008BCE0FAFCE894C24408DA4240000"
    . "000033C03BF08944241089442460894424580F8E8A0000008B5C242C8D4D028BD52BD183C203895424208D3CBB0FAFFE8BD52BD142895424248BD52BD"
    . "103F9897C24148974243C8BCF8BFE8DA424000000008B5C24200FB61C0B03C30FB619015C24588B5C24240FB61C0B015C24600FB61C11015C241083C1"
    . "0483EF0175D38B7C2414037C245C836C243C01897C241475B58B7C24388B6C244C8B5C24508B4C244099F7F9894424148B44245899F7F9894424588B4"
    . "4246099F7F9894424608B44241099F7F98944241085F60F8E820000008D4B028BC32BC18D68038B44242C8D04B80FAFC68BD32BD142895424248BD32B"
    . "D103C18944243C89742420EB038D49008BC88BFE0FB64424148B5C24248804290FB644245888010FB644246088040B0FB644241088040A83C10483EF0"
    . "175D58B44243C0344245C836C2420018944243C75BE8B4C24408B5C24508B6C244C8B7C2438473B7C2428897C24380F8C9FFEFFFF8B4C241C33D23954"
    . "24180F846401000033C03BF2895424108954246089542458895424148944243C0F8E82000000EB0233D2395424187E6F8B4C243003C80FAF4C245C8B4"
    . "424280FAFC68D550203CA8D0C818BC52BC283C003894424208BC52BC2408BFD2BFA8B54241889442424895424408B4424200FB614080FB60101542414"
    . "8B542424014424580FB6040A0FB61439014424600154241083C104836C24400175CF8B44243C403BC68944243C7C808B4C24188B4424140FAFCE99F7F"
    . "9894424148B44245899F7F9894424588B44246099F7F9894424608B44241099F7F98944241033C08944243C85F60F8E7F000000837C2418007E6F8B4C"
    . "243003C80FAF4C245C8B4424280FAFC68D530203CA8D0C818BC32BC283C003894424208BC32BC2408BFB2BFA8B54241889442424895424400FB644241"
    . "48B5424208804110FB64424580FB654246088018B4424248814010FB654241088143983C104836C24400175CF8B44243C403BC68944243C7C818B4C24"
    . "1C8B44245C0144242C01742430836C2444010F85F4FCFFFF8B44245499F7FE895424188944242885C00F8E890100008BF90FAFFE33D2897C243C89542"
    . "45489442438EB0233D233C03BCA89542410895424608954245889542414894424400F8E840000003BF27E738B4C24340FAFCE03C80FAF4C245C034C24"
    . "548D55028BC52BC283C003894424208BC52BC2408BFD03CA894424242BFA89742444908B5424200FB6040A0FB611014424148B442424015424580FB61"
    . "4080FB6040F015424600144241083C104836C24440175CF8B4424408B7C243C8B4C241C33D2403BC1894424400F8C7CFFFFFF8B44241499F7FF894424"
    . "148B44245899F7FF894424588B44246099F7FF894424608B44241099F7FF8944241033C08944244085C90F8E8000000085F67E738B4C24340FAFCE03C"
    . "80FAF4C245C034C24548D53028BC32BC283C003894424208BC32BC2408BFB03CA894424242BFA897424448D49000FB65424148B4424208814010FB654"
    . "24580FB644246088118B5424248804110FB644241088043983C104836C24440175CF8B4424408B7C243C8B4C241C403BC1894424407C808D04B500000"
    . "00001442454836C2438010F858CFEFFFF33D233C03BCA89542410895424608954245889542414894424440F8E9A000000EB048BFF33D2395424180F8E"
    . "7D0000008B4C24340FAFCE03C80FAF4C245C8B4424280FAFC68D550203CA8D0C818BC52BC283C003894424208BC52BC240894424248BC52BC28B54241"
    . "8895424548DA424000000008B5424200FB6140A015424140FB611015424588B5424240FB6140A015424600FB614010154241083C104836C24540175CF"
    . "8B4424448B4C241C403BC1894424440F8C6AFFFFFF0FAF4C24188B44241499F7F9894424148B44245899F7F9894424588B44246099F7F9894424608B4"
    . "4241099F7F98944241033C03944241C894424540F8E7B0000008B7C241885FF7E688B4C24340FAFCE03C80FAF4C245C8B4424280FAFC68D530203CA8D"
    . "0C818BC32BC283C003894424208BC32BC2408BEB894424242BEA0FB65424148B4424208814010FB65424580FB644246088118B5424248804110FB6442"
    . "41088042983C10483EF0175D18B442454403B44241C894424547C855F5E5D33C05B83C438C3"
    VarSetCapacity(PixelateBitmap, StrLen(MCode_PixelateBitmap)//2)
    Loop % StrLen(MCode_PixelateBitmap)//2
    NumPut("0x" SubStr(MCode_PixelateBitmap, (2*A_Index)-1, 2), PixelateBitmap, A_Index-1, "char")
    }
    Gdip_GetImageDimensions(pBitmap, Width, Height)
    if (Width != Gdip_GetImageWidth(pBitmapOut) || Height != Gdip_GetImageHeight(pBitmapOut))
    return -1
    if (BlockSize > Width || BlockSize > Height)
    return -2
    E1 := Gdip_LockBits(pBitmap, 0, 0, Width, Height, Stride1, Scan01, BitmapData1)
    E2 := Gdip_LockBits(pBitmapOut, 0, 0, Width, Height, Stride2, Scan02, BitmapData2)
    if (E1 || E2)
    return -3
    E := DllCall(&PixelateBitmap, "uint", Scan01, "uint", Scan02, "int", Width, "int", Height, "int", Stride1, "int", BlockSize)
    Gdip_UnlockBits(pBitmap, BitmapData1), Gdip_UnlockBits(pBitmapOut, BitmapData2)
    return 0
    }
    Gdip_ToARGB(A, R, G, B)
    {
    return (A << 24) | (R << 16) | (G << 8) | B
    }
    Gdip_FromARGB(ARGB, ByRef A, ByRef R, ByRef G, ByRef B)
    {
    A := (0xff000000 & ARGB) >> 24
    R := (0x00ff0000 & ARGB) >> 16
    G := (0x0000ff00 & ARGB) >> 8
    B := 0x000000ff & ARGB
    }
    Gdip_AFromARGB(ARGB)
    {
    return (0xff000000 & ARGB) >> 24
    }
    Gdip_RFromARGB(ARGB)
    {
    return (0x00ff0000 & ARGB) >> 16
    }
    Gdip_GFromARGB(ARGB)
    {
    return (0x0000ff00 & ARGB) >> 8
    }
    Gdip_BFromARGB(ARGB)
    {
    return 0x000000ff & ARGB
    }
    global layout, tooltipArray, pToken, Scan0, Stride, ts
    SetBatchLines,-1
    SetMouseDelay,-1
    coordmode,mouse,screen
    coordmode,tooltip,screen
    LoadLayout()
    Tooltip()
    ts := new TempSettings()
    ts.Refresh()
    altMouse := 1
    return
    ~F12::
    ~home::
    ~delete::
    Tooltip()
    return
    ~up::Tooltip(,-1)
    ~down::Tooltip(,1)
    ~right::Tooltip(1)
    ~left::Tooltip(-1)
    aim:
    if (!active) {
    active := true
    while (GetKeyState(strreplace(a_thishotkey,"~"),"P")) {
    match := false
    QPX(True)
    movepoint := new point(0,0)
    movepoint2 := new point(0,-1)
    if (ts.alternative == 1) {
    pbmp := Gdip_BitmapFromScreen(ts.search_offset.x "|" ts.search_offset.y "|" ts.dimensions.x "|" ts.dimensions.y)
    E1 := Gdip_LockBits(pbmp, 0, 0, ts.dimensions.x, ts.dimensions.y, Stride, Scan0, BitmapData,1)
    }
    else if (ts.alternative == 2) {
    }
    else {
    pbmp := BitmapFromScreen2(ts.search_offset.x, ts.search_offset.y, ts.dimensions.x, ts.dimensions.y,ts.dc)
    E1 := Gdip_LockBits(pbmp, 0, 0, ts.dimensions.x, ts.dimensions.y, Stride, Scan0, BitmapData,1,0x21808)
    }
    loop % (ts.dimensions.max()/ts.spread)**2 {
    if ((-ts.dimensions.x/2 < movepoint.x) <= ts.dimensions.x/2) && ((-ts.dimensions.y/2 < movepoint.y) <= ts.dimensions.y/2) {
    search_point := new point((movepoint.x*ts.spread) + (ts.dimensions.x/2), (movepoint.y*ts.spread) + (ts.dimensions.y/2))
    if (search_point.x >= 0 && search_point.x < ts.dimensions.x) && (search_point.y >= 0 && search_point.y < ts.dimensions.y) {
    GetRGB(search_point,"",r,g,b)
    if (r > 240 && g < 20 && b < 20) && (b > 0) && (g == 0) {
    match := true
    found_point := new point(search_point.x-3,search_point.y)
    FindLeftEdge(found_point)
    mouse_point := new point((ts.search_offset.x+found_point.x)-ts.window_center.x, (ts.search_offset.y+found_point.y-ts.offset_y)-ts.window_center.y)
    DllCall("mouse_event", "UInt", 0x01, "UInt", (mouse_point.x+ts.mouse_offset.x)/ts.ingame_sens, "UInt", (mouse_point.y+ts.mouse_offset.y)/(ts.ingame_sens*2.41))
    match_search_offset := new point(ts.window_center.x+(mouse_point.x)-ts.match_dimensions.x+ts.mouse_offset.x, ts.window_center.y+(mouse_point.y)-ts.match_dimensions.y+ts.mouse_offset.y+ts.offset_y)
    }
    }
    }
    if (!match) {
    if (movepoint.x == movepoint.y || (movepoint.x < 0 && movepoint.x == -movepoint.y) || (movepoint.x > 0 && movepoint.x == 1-movepoint.y)) {
    movepoint2.swap()
    }
    movepoint.add(movepoint2.x,movepoint2.y)
    }
    } until (match)
    if (match) {
    ts.dimensions := new point(ts.match_dimensions.x,ts.match_dimensions.y)
    ts.search_offset := match_search_offset
    if (ts.overlayShow)
    overlay(ts.search_offset.x, ts.search_offset.y, ts.dimensions.x, ts.dimensions.y,,1)
    dur := QPX(false)
    if (dur < 0.008) {
    delay(0.008-dur)
    }
    }
    else {
    if (ts.dimensions.max() < ts.start_dimensions.min()) {
    ts.dimensions.x += 200
    ts.dimensions.y += 100
    ts.search_offset.sub(100,50)
    if (ts.overlayShow)
    overlay(ts.search_offset.x, ts.search_offset.y, ts.dimensions.x, ts.dimensions.y,,1)
    }
    else {
    ts.dimensions := ts.start_dimensions
    ts.search_offset := ts.start_search_offset
    if (ts.overlayShow)
    overlay(ts.search_offset.x, ts.search_offset.y, ts.dimensions.x, ts.dimensions.y)
    }
    dur := QPX(false)
    if (dur < 0.008) {
    delay(0.008-dur)
    }
    }
    Gdip_UnlockBits(pbmp, BitmapData)
    Gdip_DisposeImage(pbmp)
    }
    active := false
    }
    ts.dimensions := ts.start_dimensions
    ts.search_offset := ts.start_search_offset
    overlay(ts.search_offset.x, ts.search_offset.y, ts.dimensions.x, ts.dimensions.y)
    return
    FindHPBar() {
    }
    GetRGB(point,mode,byref r, byref g, byref b) {
    mode := strsplit(mode,"|")
    if (mode[1] == "dwm") {
    Gdip_FromRGB(DllCall("gdi32.dll\GetPixel", "UInt", ts.dc, "Int", point.x, "Int", point.y, "UInt"),b,g,r)
    }
    else
    Gdip_FromRGB(NumGet(Scan0+0, (point.x*3)+(point.y*Stride)),r,g,b)
    }
    FindLeftEdge(byref found_point) {
    mismatch := 0
    loop 100{
    if (found_point.x < 0 || found_point.x > dimensions.x)
    mismatch := 9
    GetRGB(search_point,"",r,g,b)
    if !((r > 200 && g < 100 && b < 100))
    mismatch++
    else
    mismatch := 0
    found_point.x-=2
    } until % mismatch > 8
    }
    BitmapFromScreen2(s_x,s_y,s_w,s_h,dc) {
    chdc := CreateCompatibleDC(dc), hbm := CreateDIBSection(s_w, s_h, chdc), obm := SelectObject(chdc, hbm)
    BitBlt(chdc, 0, 0, s_w, s_h, dc, s_x, s_y)
    pbmp := Gdip_CreateBitmapFromHBITMAP(hbm)
    SelectObject(chdc, obm), DeleteObject(hbm), DeleteDC(chdc)
    return pbmp
    }
    Gdip_FromRGB(RGB, ByRef R, ByRef G, ByRef B)
    {
    R := (0x00ff0000 & RGB) >> 16
    G := (0x0000ff00 & RGB) >> 8
    B := 0x000000ff & RGB
    }
    Delay( D=0.001 ) {
    Static F
    Critical
    F ? F : DllCall( "QueryPerformanceFrequency", Int64P,F )
    DllCall( "QueryPerformanceCounter", Int64P,pTick ), cTick := pTick
    While( ( (Tick:=(pTick-cTick)/F)) <D ) {
    DllCall( "QueryPerformanceCounter", Int64P,pTick )
    Sleep -1
    }
    Return Round( Tick,3 )
    }
    QPX( N=0 ) {
    Static F,A,Q,P,X
    If	( N && !P )
    Return	DllCall("QueryPerformanceFrequency",Int64P,F) + (X:=A:=0) + DllCall("QueryPerformanceCounter",Int64P,P)
    DllCall("QueryPerformanceCounter",Int64P,Q), A:=A+Q-P, P:=Q, X:=X+1
    Return	( N && X=N ) ? (X:=X-1)<<64 : ( N=0 && (R:=A/X/F) ) ? ( R + (A:=P:=X:=0) ) : 1
    }
    overlay(x ,y ,w ,h, create=0,c=0) {
    static overlay_ID
    if (!overlay_ID) {
    Gui, 2: +E0x20 -Caption +E0x80000 +LastFound +AlwaysOnTop +ToolWindow +OwnDialogs
    Gui, 2: Show,,Window
    overlay_ID := WinExist()
    }
    overlay_dib := CreateDIBSection(w, h)
    overlay_dc := CreateCompatibleDC()
    overlay_obm := SelectObject(overlay_dc, overlay_dib)
    G := Gdip_GraphicsFromHDC(overlay_dc)
    if (!c)
    overlay_pen := Gdip_CreatePen(Gdip_ToARGB(255,255,0,0), 2)
    else
    overlay_pen := Gdip_CreatePen(Gdip_ToARGB(255,0,255,0), 2)
    Gdip_DrawRectangle(G, overlay_pen, 0, 0, w, h)
    Gdip_DeletePen(overlay_pen)
    UpdateLayeredWindow(overlay_ID, overlay_dc, x, y, w, h)
    SelectObject(overlay_dc, overlay_obm)
    DeleteObject(overlay_dib)
    DeleteDC(overlay_dc)
    Gdip_DeleteGraphics(G)
    }
    class point {
    __new(x,y) {
    this.x := x
    this.y := y
    }
    swap() {
    ty := -this.y
    this.y := this.x
    this.x := ty
    }
    max() {
    if (this.x > this.y)
    return  % this.x
    else
    return % this.y
    }
    min() {
    if (this.x < this.y)
    return  % this.x
    else
    return % this.y
    }
    add(x,y) {
    this.x += x
    this.y += y
    }
    sub(x,y) {
    this.x -= x
    this.y -= y
    }
    }
    pickItem(subs,val=0) {
    temp := strsplit(layout[subs],"|")
    if (instr(temp[1],"num")) {
    temp2 := strsplit(temp[1],":")
    newVal := temp[2]+(temp2[2]*val)
    if (newVal >= 0) {
    if (temp2[2] < 1)
    temp[2] := round(newVal,2)
    else
    temp[2] := round(newVal,0)
    }
    layout[subs] := temp[1] "|" temp[2]
    return % temp[2]
    }
    else if (instr(temp[1],"bool")) {
    temp2 := strsplit(temp[1],":")
    temp[1] := temp2[1] ":" !temp2[2]
    temp[2] := (temp2[2]) ? "Enabled" : "Disabled"
    layout[subs] := temp[1] "|" temp[2]
    return % temp[2]
    }
    else {
    temp[1] += val
    retStr := strsplit(temp[2],";")[temp[1]]
    if (!retStr)
    temp[1] -= val
    else if (subs == "1a. Mode" && val) {
    LoadLayout(temp[1],temp[1]-val)
    }
    layout[subs] := temp[1] "|" temp[2]
    return % strsplit(temp[2],";")[temp[1]]
    }
    }
    Tooltip(newTab=0,newItem=0) {
    static activeTab, activeItem, toggle, x, y
    if (toggle == "")
    toggle := 1
    if (!newTab && !newItem) {
    toggle := ! toggle
    mousegetpos,x,y
    }
    if (toggle) {
    activeItem := (!newItem && !activeItem) ? 1 : activeItem+newItem
    if (activeItem == 1)
    activeTab := (!newTab && !activeTab) ? 1 : (activeTab+newTab > 0 && activeTab+newTab <= tooltipArray["tabCount"]) ? activeTab+newTab : activeTab
    else
    addItem := newTab
    for tabName in tooltipArray {
    if (a_index == activeTab) {
    for t in tooltipArray[tabName]
    itemCount := a_index
    if (activeItem < 1 || activeItem > itemCount+1)
    activeItem := activeItem-newItem
    if (activeItem == 1)
    nText .= "|[" strsplit(tabName,".")[2] "]|`n"
    else
    nText .= strsplit(tabName,".")[2] "`n"
    for subs in tooltipArray[tabName] {
    if (a_index+1 == activeItem) {
    if (addItem) {
    tooltipArray[tabName,subs] := pickItem(subs,addItem)
    }
    if (!tooltipArray[tabName,subs])
    nText .= "|[" strsplit(subs,".")[2] "]|"
    else
    nText .= strsplit(subs,".")[2] ": " "|[" tooltipArray[tabName,subs] "]|`n"
    }
    else {
    if (!tooltipArray[tabName,subs])
    nText .= strsplit(subs,".")[2]
    else
    nText .= strsplit(subs,".")[2] ": " tooltipArray[tabName,subs] "`n"
    }
    }
    }
    }
    tooltip, % rTrim(nText,"`n"), % x, % y
    }
    else
    tooltip,
    if (ts.overwatch) {
    ts.Refresh()
    }
    }
    LoadLayout(num=1,pnum=0) {
    if (pnum) {
    SaveLayout(pnum)
    }
    layout := array(), tooltipArray := array()
    if (!fileexist("layout.dat")) {
    loop 23 {
    fileappend, % a_index ";1;15.00;70;30;8;400;300;200;100;1;0`r`n",layout.dat
    }
    }
    fileread,strIn,layout.dat
    loop,parse,strIn,`r`n
    {
    if (a_loopfield) {
    temp := strsplit(a_loopfield,";")
    if (temp[1] == num) {
    layout["1a. Mode"] := num "|Default;Ana;Bastion;D.V.A;Genji;Hanzo;Junkrat;Lúcio;McCree;Mei;Mercy;Pharah;Reaper;Reinhardt;Roadhog;Soldier: 76;Symmetra;Tracer;Torbjörn;Widowmaker;Winston;Zarya;Zenyatta"
    layout["1b. Hotkeys"] := temp[2] "|LButton;RButton;LAlt;LButton, RButton;LButton, RButton, LAlt"
    layout["2a. Ingame sensitivity"] := "num:0.05|" temp[3]
    layout["2b. Mouse offset X"] := "num:1|" temp[4]
    layout["2c. Mouse offset Y"] := "num:1|" temp[5]
    layout["3a. Search spread"] := "num:1|" temp[6]
    layout["3b. Start width"] := "num:20|" temp[7]
    layout["3c. Start height"] := "num:20|" temp[8]
    layout["3d. Match width"] := "num:20|" temp[9]
    layout["3f. Match height"] := "num:20|" temp[10]
    layout["4a. Display overlay"] := "bool:" temp[11] "|Disabled"
    layout["4b. Alternative search"] := "bool:" temp[12] "|Disabled"
    }
    }
    }
    menuLayout := "1.Profile|1a. Mode,1b. Hotkeys;"
    . "2.Mouse Settings|2a. Ingame sensitivity,2b. Mouse offset X,2c. Mouse offset Y;"
    . "3.Search Settings|3a. Search spread,3b. Start width,3c. Start height,3d. Match width,3f. Match height;"
    . "4.General Settings|4a. Display overlay,4b. Alternative search"
    loop,parse,menuLayout,`;
    {
    tabName := strsplit(a_loopfield,"|")
    subs := strsplit(tabName[2],",")
    loop % subs.length(){
    tooltipArray[tabName[1],subs[a_index]] := pickItem(subs[a_index])
    }
    len := a_index
    }
    tooltipArray["tabCount"] := len
    }
    class TempSettings {
    Refresh() {
    static hotkeys
    if (winexist("ahk_class TankWindowClass") && !ts.overwatch) {
    this.overwatch := true
    }
    else {
    while !(winexist("ahk_class TankWindowClass")) {
    tooltip, Run overwatch
    sleep, 50
    }
    }
    if (!ptoken)
    pToken := Gdip_Startup()
    this.handle := winexist("ahk_class TankWindowClass")
    this.dc := GetDC(this.handle)
    pbmp := Gdip_BitmapFromHWND(this.handle)
    Gdip_GetDimensions(pbmp, w, h)
    Gdip_DisposeImage(pbmp)
    ts.window_center := new point(w/2,h/2)
    this.active := strsplit(layout["1a. Mode"],"|")[1]
    ingame_sens := strsplit(layout["2a. Ingame sensitivity"],"|")[2]
    this.mouse_offset := new point(strsplit(layout["2b. Mouse offset X"],"|")[2], strsplit(layout["2c. Mouse offset Y"],"|")[2])
    this.spread := strsplit(layout["3a. Search spread"],"|")[2]
    this.start_dimensions := new point(strsplit(layout["3b. Start width"],"|")[2], strsplit(layout["3c. Start height"],"|")[2])
    this.dimensions := this.start_dimensions
    this.match_dimensions := new point(strsplit(layout["3d. Match width"],"|")[2], strsplit(layout["3f. Match height"],"|")[2])
    this.overlayShow := !(strsplit(strsplit(layout["4a. Display overlay"],":")[2],"|")[1])
    this.alternative := !(strsplit(strsplit(layout["4b. Alternative search"],":")[2],"|")[1])
    this.offset_y := -this.dimensions.max()*0.125
    this.start_search_offset := new point(this.window_center.x-(this.dimensions.x/2),(this.window_center.y-(this.dimensions.y/2))+this.offset_y)
    this.search_offset := this.start_search_offset
    cappedFPS := 5
    this.ingame_sens := 0.116*(ingame_sens*(16/cappedFPS))
    if (hotkeys)
    loop,parse,hotkeys,`,
    hotkey, % strreplace("~" a_loopfield,a_space,""), aim, off
    temp := strsplit(layout["1b. Hotkeys"],"|")
    hotkeys := strsplit(temp[2],";")[temp[1]]
    loop,parse,hotkeys,`,
    hotkey, % strreplace("~" a_loopfield,a_space,""), aim, on
    if (this.overlayShow)
    overlay(this.search_offset.x, this.search_offset.y, this.start_dimensions.x, this.start_dimensions.y,1)
    }
    }
    SaveLayout(num) {
    for k, v in layout {
    if (a_index <= 2)
    out .= strsplit(v,"|")[1] ";"
    else if (a_index <= 10)
    out .= strsplit(v,"|")[2] ";"
    else
    out .= !strsplit(strsplit(v,":")[2],"|")[1] ";"
    }
    out := rTrim(out,";")
    fileread,strIn,layout.dat
    filedelete,layout.dat
    loop, parse, strIn, `r`n
    {
    if (a_loopfield) {
    temp := strsplit(a_loopfield,";")
    if (temp[1] == num)
    strOut .= out "`r`n"
    else
    strOut .= a_loopfield "`r`n"
    }
    }
    fileappend, % strOut, layout.dat
    }
    rshift::
    GuiClose:
    SaveLayout(ts.active)
    Gdip_DisposeImage(pbmp)
    Gdip_Shutdown(pToken)
    ExitApp
    ================

    Korean Aimbot Clean, add your own improvements
    Compiled test version upon request:
    Zippyshare.com - test.rar
    Code:
    ; <COMPILER: v1.1.24.00>
    guif:
    #NoEnv
    #SingleInstance force
    SkinForm(Apply, A_ScriptDir . "\USkin.dll", A_ScriptDir . "\Milikymac.msstyles")
    Gui, Add, Text, x12 y40 w200 h30 , 1280*720  Run Aim[F1]
    Gui, Add, Text, x12 y70 w200 h30 , 1920*1080 Run Aim[F2]
    Gui, Add, Text, x12 y120 w200 h30 ,  Restart Program[F3]
    Gui, Add, Text, x12 y170 w200 h30 ,  Pause/Resume[ALT]
    Gui, Add, CheckBox, x292 y10 w150 h40 vaimtype Checked, Aimlock only on key press
    Gui, Add, Text, x232 y70 w120 h30 , Aim speed control
    Gui, Add, Edit, x362 y70 w100 h30 vrx, 5
    Gui, Add, Button, x232 y110 w230 h90 gchange1, Apply settings for v0.2
    gui, add, button, x5 y5 h20 w70 gsub1, Issues?
    gui, add, button, x80 y5 h20 w70 gsub2, How-to
    gui, add, button, x155 y5 h20 w70 gsub3, Best Settings
    gui, show
    
    return
    sub1:
     {
       msgbox, Having issues?`nCheat is CPU intensive and only uses math.`n`nLowFPS: Lower Aim speed to 3.`nLowFPS: Lower resolution to 720p and play on low.`nLowFPS: If you get low fps after a playthrough, press F3 to restart the cheat.`n`nCursor jumping left or right when using Aim key?`n`nJumpBug:Your PC is lagging out when using Aimkey. Check LowFPS solution.`nJumpBug: Switch your resolution to 720p but use F2(1080p) with Aim Speed 3.`n`nAlways try the cheat out in Practice Range to find your best settings.
     }
    return
    sub2:
     {
       msgbox, How-to:`n`nLaunch Game. Switch to Borderless Windowed mode.`nResolution has to be 720p or 1080p. As precaution, set your quality settings to Low.`n`nTo-use:`nPress F1 or F2 depending on your resolution.`nShoot an Enemy. When the Health Bar is visible press the aimkey to snap onto the target.`n`nIf nothing is happening make sure you are not using any desktop applications that alter your color settings or are recording your gameplay such as W10 DVR or Fraps.
     }
     sub3:
     {
       msgbox, Best Settings for the cheat (Legit):`n`nResolution: 1280x720`nAim Speed: 3
     }
    return
    GuiClose:
    ExitApp
    return
    SkinForm(Param1 = "Apply", DLL = "", SkinName = ""){
    if(Param1 = Apply){
    DllCall("LoadLibrary", str, DLL)
    DllCall(DLL . "\USkinInit", Int,0, Int,0, AStr, SkinName)
    }else if(Param1 = 0){
    DllCall(DLL . "\USkinExit")
    }
    }
    Change1:
    MsgBox,  Applied
    Gui,Submit, Nohide
    return
    F1::
    #Persistent
    #KeyHistory, 0
    #NoEnv
    #HotKeyInterval 1
    #MaxHotkeysPerInterval 127
    #InstallKeybdHook
    #UseHook
    #SingleInstance, Force
    SetKeyDelay,-1, 8
    SetControlDelay, -1
    SetMouseDelay, 0
    SetWinDelay,-1
    SendMode, InputThenPlay
    SetBatchLines,-1
    ListLines, Off
    CoordMode, Mouse, Screen
    PID := DllCall("GetCurrentProcessId")
    Process, Priority, %PID%, Normal
    ZeroX := 640
    ZeroY := 360
    CFovX := 320
    CFovY := 200
    ScanL := 500
    ScanR := 800
    ScanT := 180
    ScanB := 400
    GuiControlget, rX
    Loop, {
    Gui,Submit, Nohide
    if (aimtype=1)
    {
    GetKeyState, Mouse2, LButton, P
    GoSub MouseMoves
    }
    if (aimtype=0)
    {
    GetKeyState, Mouse2, Rbutton, P
    GoSub MouseMoves1
    }
    ImageSearch, AimPixelX, AimPixelY,ScanL, ScanT, ScanR, ScanB,  *4 hhp.bmp
    GoSub GetAimOffset
    GoSub GetAimMoves
    }
    MouseMoves:
    If ( Mouse2 == "D" ) {
    DllCall("mouse_event", uint, 1, int, MoveX, int, MoveY, uint, 0, int, 0)
    }
    Return
    MouseMoves1:
    If ( Mouse2 == "U" ) {
    DllCall("mouse_event", uint, 1, int, MoveX, int, MoveY, uint, 0, int, 0)
    }
    Return
    GetAimOffset:
    Gui,Submit, Nohide
    AimX := AimPixelX - ZeroX +41
    AimY := AimPixelY - ZeroY +63
    If ( AimX+5 > 0) {
    DirX := rx / 10
    }
    If ( AimX+5 < 0) {
    DirX := (-rx) / 10
    }
    If ( AimY+2 > 0 ) {
    DirY := rX /10 *0.5
    }
    If ( AimY+2 < 0 ) {
    DirY := (-rx) /10 *0.5
    }
    AimOffsetX := AimX * DirX
    AimOffsetY := AimY * DirY
    Return
    GetAimMoves:
    RootX := Ceil(( AimOffsetX ** ( 1/2 )))
    RootY := Ceil(( AimOffsetY ** ( 1/2 )))
    MoveX := RootX * DirX
    MoveY := RootY * DirY
    Return
    SleepF:
    SleepDuration = 1
    TimePeriod = 1
    DllCall("Winmm\timeBeginPeriod", uint, TimePeriod)
    Iterations = 1
    StartTime := A_TickCount
    Loop, %Iterations% {
    DllCall("Sleep", UInt, TimePeriod)
    }
    DllCall("Winmm\timeEndPeriod", UInt, TimePeriod)
    Return
    DebugTool:
    MouseGetPos, MX, MY
    ToolTip, %AimOffsetX% | %AimOffsetY%
    ToolTip, %AimX% | %AimY%
    ToolTip, %IntAimX% | %IntAimY%
    ToolTip, %RootX% | %RootY%
    ToolTip, %MoveX% | %MoveY% || %MX% %MY%
    Return
    F2::
    #Persistent
    #KeyHistory, 0
    #NoEnv
    #HotKeyInterval 1
    #MaxHotkeysPerInterval 127
    #InstallKeybdHook
    #UseHook
    #SingleInstance, Force
    SetKeyDelay,-1, 8
    SetControlDelay, -1
    SetMouseDelay, 0
    SetWinDelay,-1
    SendMode, InputThenPlay
    SetBatchLines,-1
    ListLines, Off
    CoordMode, Mouse, Screen
    PID := DllCall("GetCurrentProcessId")
    Process, Priority, %PID%, Normal
    ZeroX := 960
    ZeroY := 540
    CFovX := 80
    CFovY := 200
    ScanL := 660
    ScanR := 1250
    ScanT := 280
    ScanB := 610
    GuiControlget, rX
    Loop, {
    Gui,Submit, Nohide
    if (aimtype=1)
    {
    GetKeyState, Mouse2, LButton, P
    GoSub MouseMoves2
    }
    if (aimtype=0)
    {
    GetKeyState, Mouse2, Rbutton, P
    GoSub MouseMoves11
    }
    ImageSearch, AimPixelX, AimPixelY, ScanL, ScanT, ScanR, ScanB,  *4 hhp2.bmp
    GoSub GetAimOffset1
    GoSub GetAimMoves1
    }
    MouseMoves2:
    If ( Mouse2 == "D" ) {
    DllCall("mouse_event", uint, 1, int, MoveX, int, MoveY, uint, 0, int, 0)
    }
    Return
    MouseMoves11:
    If ( Mouse2 == "U" ) {
    DllCall("mouse_event", uint, 1, int, MoveX, int, MoveY, uint, 0, int, 0)
    }
    Return
    GetAimOffset1:
    Gui,Submit, Nohide
    AimX := AimPixelX - ZeroX +58
    AimY := AimPixelY - ZeroY +85
    If ( AimX+10 > 0) {
    DirX := rx / 10
    }
    If ( AimX+10 < 0) {
    DirX := (-rx) / 10
    }
    If ( AimY+5 > 0 ) {
    DirY := rX /10 *0.5
    }
    If ( AimY+5 < 0 ) {
    DirY := (-rx) /10 *0.5
    }
    AimOffsetX := AimX * DirX
    AimOffsetY := AimY * DirY
    Return
    GetAimMoves1:
    RootX := Ceil(( AimOffsetX ** ( 1 )))
    RootY := Ceil(( AimOffsetY ** ( 1 )))
    MoveX := RootX * DirX
    MoveY := RootY * DirY
    Return
    SleepF1:
    SleepDuration = 1
    TimePeriod = 1
    DllCall("Winmm\timeBeginPeriod", uint, TimePeriod)
    Iterations = 1
    StartTime := A_TickCount
    Loop, %Iterations% {
    DllCall("Sleep", UInt, TimePeriod)
    }
    DllCall("Winmm\timeEndPeriod", UInt, TimePeriod)
    Return
    DebugTool1:
    MouseGetPos, MX, MY
    ToolTip, %AimOffsetX% | %AimOffsetY%
    ToolTip, %AimX% | %AimY%
    ToolTip, %IntAimX% | %IntAimY%
    ToolTip, %RootX% | %RootY%
    ToolTip, %MoveX% | %MoveY% || %MX% %MY%
    Return
    ALT::
    pause
    SoundBEEP
    return
    F3::
    Reload
    return
    Save these as hhp.bmp hhp2.bmp hhp3.bmp hhp4.bmp
    MUST BE IN THE SAME FOLDER AS THE .ahk SCRIPT
    Attachment 35962
    Attachment 35963
    Attachment 35964
    Attachment 35965
    ========================

    Modified version of one of the first Pixelbots

    Code:
        ; <DC: v1>
        #NoTrayIcon
        #SingleInstance, Force
        #NoEnv
        return ;anticp
         
        UpdateLayeredWindow(hwnd, hdc, x="", y="", w="", h="", Alpha=255)
        {
        if ((x != "") && (y != ""))
        VarSetCapacity(pt, 8), NumPut(x, pt, 0), NumPut(y, pt, 4)
        if (w = "") ||(h = "")
         
        WinGetPos,,, w, h, ahk_id %hwnd%
        return DllCall("UpdateLayeredWindow", "uint", hwnd, "uint", 0, "uint", ((x = "") && (y = "")) ? 0 : &pt
        , "int64*", w|h<<32, "uint", hdc, "int64*", 0, "uint", 0, "uint*", Alpha<<16|1<<24, "uint", 2)
        }
        MsgBox, 4,, No copypasting?
        IfMsgBox Ok
            return
        else
            return
        BitBlt(ddc, dx, dy, dw, dh, sdc, sx, sy, Raster="")
        {
        return DllCall("gdi32\BitBlt", "uint", dDC, "int", dx, "int", dy, "int", dw, "int", dh
        , "uint", sDC, "int", sx, "int", sy, "uint", Raster ? Raster : 0x00CC0020)
        }
        StretchBlt(ddc, dx, dy, dw, dh, sdc, sx, sy, sw, sh, Raster="")
        {
        return DllCall("gdi32\StretchBlt", "uint", ddc, "int", dx, "int", dy, "int", dw, "int", dh
        , "uint", sdc, "int", sx, "int", sy, "int", sw, "int", sh, "uint", Raster ? Raster : 0x00CC0020)
        }
        SetStretchBltMode(hdc, iStretchMode=4)
        {
        return DllCall("gdi32\SetStretchBltMode", "uint", hdc, "int", iStretchMode)
        }
        SetImage(hwnd, hBitmap)
        {
        SendMessage, 0x172, 0x0, hBitmap,, ahk_id %hwnd%
        E := ErrorLevel
        DeleteObject(E)
        return E
        }
        SetSysColorToControl(hwnd, SysColor=15)
        {
        WinGetPos,,, w, h, ahk_id %hwnd%
        bc := DllCall("GetSysColor", "Int", SysColor)
        pBrushClear := Gdip_BrushCreateSolid(0xff000000 | (bc >> 16 | bc & 0xff00 | (bc & 0xff) << 16))
        pBitmap := Gdip_CreateBitmap(w, h), G := Gdip_GraphicsFromImage(pBitmap)
        Gdip_FillRectangle(G, pBrushClear, 0, 0, w, h)
        hBitmap := Gdip_CreateHBITMAPFromBitmap(pBitmap)
        SetImage(hwnd, hBitmap)
        Gdip_DeleteBrush(pBrushClear)
        Gdip_DeleteGraphics(G), Gdip_DisposeImage(pBitmap), DeleteObject(hBitmap)
        return 0
        }
        Gdip_BitmapFromScreen(Screen=0, Raster="")
        {
        if (Screen = 0)
        {
        Sysget, x, 76
        Sysget, y, 77
        Sysget, w, 78
        Sysget, h, 79
        }
        else if (SubStr(Screen, 1, 5) = "hwnd:")
        {
        Screen := SubStr(Screen, 6)
        if !WinExist( "ahk_id " Screen)
        return -2
        WinGetPos,,, w, h, ahk_id %Screen%
        x := y := 0
        hhdc := GetDCEx(Screen, 3)
        }
        else if (Screen&1 != "")
        {
        Sysget, M, Monitor, %Screen%
        x := MLeft, y := MTop, w := MRight-MLeft, h := MBottom-MTop
        }
        else
        {
        StringSplit, S, Screen, |
        x := S1, y := S2, w := S3, h := S4
        }
        if (x = "") || (y = "") || (w = "") || (h = "")
        return -1
        chdc := CreateCompatibleDC(), hbm := CreateDIBSection(w, h, chdc), obm := SelectObject(chdc, hbm), hhdc := hhdc ? hhdc : GetDC()
        BitBlt(chdc, 0, 0, w, h, hhdc, x, y, Raster)
        ReleaseDC(hhdc)
        pBitmap := Gdip_CreateBitmapFromHBITMAP(hbm)
        SelectObject(chdc, obm), DeleteObject(hbm), DeleteDC(hhdc), DeleteDC(chdc)
        return pBitmap
        }
        Gdip_BitmapFromHWND(hwnd)
        {
        WinGetPos,,, Width, Height, ahk_id %hwnd%
        hbm := CreateDIBSection(Width, Height), hdc := CreateCompatibleDC(), obm := SelectObject(hdc, hbm)
        PrintWindow(hwnd, hdc)
        pBitmap := Gdip_CreateBitmapFromHBITMAP(hbm)
        SelectObject(hdc, obm), DeleteObject(hbm), DeleteDC(hdc)
        return pBitmap
        }
        CreateRectF(ByRef RectF, x, y, w, h)
        {
        VarSetCapacity(RectF, 16)
        NumPut(x, RectF, 0, "float"), NumPut(y, RectF, 4, "float"), NumPut(w, RectF, 8, "float"), NumPut(h, RectF, 12, "float")
        }
        CreateRect(ByRef Rect, x, y, w, h)
        {
        VarSetCapacity(Rect, 16)
        NumPut(x, Rect, 0, "uint"), NumPut(y, Rect, 4, "uint"), NumPut(w, Rect, 8, "uint"), NumPut(h, Rect, 12, "uint")
        }
        CreateSizeF(ByRef SizeF, w, h)
        {
        VarSetCapacity(SizeF, 8)
        NumPut(w, SizeF, 0, "float"), NumPut(h, SizeF, 4, "float")
        }
        CreatePointF(ByRef PointF, x, y)
        {
        VarSetCapacity(PointF, 8)
        NumPut(x, PointF, 0, "float"), NumPut(y, PointF, 4, "float")
        }
        CreateDIBSection(w, h, hdc="", bpp=32, ByRef ppvBits=0)
        {
        hdc2 := hdc ? hdc : GetDC()
        VarSetCapacity(bi, 40, 0)
        NumPut(w, bi, 4), NumPut(h, bi, 8), NumPut(40, bi, 0), NumPut(1, bi, 12, "ushort"), NumPut(0, bi, 16), NumPut(bpp, bi, 14, "ushort")
        hbm := DllCall("CreateDIBSection", "uint" , hdc2, "uint" , &bi, "uint" , 0, "uint*", ppvBits, "uint" , 0, "uint" , 0)
        if !hdc
        ReleaseDC(hdc2)
        return hbm
        }
        PrintWindow(hwnd, hdc, Flags=0)
        {
        return DllCall("PrintWindow", "uint", hwnd, "uint", hdc, "uint", Flags)
        }
        DestroyIcon(hIcon)
        {
        return DllCall("DestroyIcon", "uint", hIcon)
        }
        PaintDesktop(hdc)
        {
        return DllCall("PaintDesktop", "uint", hdc)
        }
        CreateCompatibleBitmap(hdc, w, h)
        {
        return DllCall("gdi32\CreateCompatibleBitmap", "uint", hdc, "int", w, "int", h)
        }
        CreateCompatibleDC(hdc=0)
        {
        return DllCall("CreateCompatibleDC", "uint", hdc)
        }
        SelectObject(hdc, hgdiobj)
        {
        return DllCall("SelectObject", "uint", hdc, "uint", hgdiobj)
        }
        DeleteObject(hObject)
        {
        return DllCall("DeleteObject", "uint", hObject)
        }
        GetDC(hwnd=0)
        {
        return DllCall("GetDC", "uint", hwnd)
        }
        GetDCEx(hwnd, flags=0, hrgnClip=0)
        {
        return DllCall("GetDCEx", "uint", hwnd, "uint", hrgnClip, "int", flags)
        }
        ReleaseDC(hdc, hwnd=0)
        {
        return DllCall("ReleaseDC", "uint", hwnd, "uint", hdc)
        }
        DeleteDC(hdc)
        {
        return DllCall("DeleteDC", "uint", hdc)
        }
        Gdip_LibraryVersion()
        {
        return 1.45
        }
        Gdip_BitmapFromBRA(ByRef BRAFromMemIn, File, Alternate=0)
        {
        if !BRAFromMemIn
        return -1
        Loop, Parse, BRAFromMemIn, `n
        {
        if (A_Index = 1)
        {
        StringSplit, Header, A_LoopField, |
        if (Header0 != 4 || Header2 != "BRA!")
        return -2
        }
        else if (A_Index = 2)
        {
        StringSplit, Info, A_LoopField, |
        if (Info0 != 3)
        return -3
        }
        else
        break
        }
        if !Alternate
        StringReplace, File, File, \, \\, All
        RegExMatch(BRAFromMemIn, "mi`n)^" (Alternate ? File "\|.+?\|(\d+)\|(\d+)" : "\d+\|" File "\|(\d+)\|(\d+)") "$", FileInfo)
        if !FileInfo
        return -4
        hData := DllCall("GlobalAlloc", "uint", 2, "uint", FileInfo2)
        pData := DllCall("GlobalLock", "uint", hData)
        DllCall("RtlMoveMemory", "uint", pData, "uint", &BRAFromMemIn+Info2+FileInfo1, "uint", FileInfo2)
        DllCall("GlobalUnlock", "uint", hData)
        DllCall("ole32\CreateStreamOnHGlobal", "uint", hData, "int", 1, "uint*", pStream)
        DllCall("gdiplus\GdipCreateBitmapFromStream", "uint", pStream, "uint*", pBitmap)
        DllCall(NumGet(NumGet(1*pStream)+8), "uint", pStream)
        return pBitmap
        }
        Gdip_DrawRectangle(pGraphics, pPen, x, y, w, h)
        {
        return DllCall("gdiplus\GdipDrawRectangle", "uint", pGraphics, "uint", pPen, "float", x, "float", y, "float", w, "float", h)
        }
        Gdip_DrawRoundedRectangle(pGraphics, pPen, x, y, w, h, r)
        {
        Gdip_SetClipRect(pGraphics, x-r, y-r, 2*r, 2*r, 4)
        Gdip_SetClipRect(pGraphics, x+w-r, y-r, 2*r, 2*r, 4)
        Gdip_SetClipRect(pGraphics, x-r, y+h-r, 2*r, 2*r, 4)
        Gdip_SetClipRect(pGraphics, x+w-r, y+h-r, 2*r, 2*r, 4)
        E := Gdip_DrawRectangle(pGraphics, pPen, x, y, w, h)
        Gdip_ResetClip(pGraphics)
        Gdip_SetClipRect(pGraphics, x-(2*r), y+r, w+(4*r), h-(2*r), 4)
        Gdip_SetClipRect(pGraphics, x+r, y-(2*r), w-(2*r), h+(4*r), 4)
        Gdip_DrawEllipse(pGraphics, pPen, x, y, 2*r, 2*r)
        Gdip_DrawEllipse(pGraphics, pPen, x+w-(2*r), y, 2*r, 2*r)
        Gdip_DrawEllipse(pGraphics, pPen, x, y+h-(2*r), 2*r, 2*r)
        Gdip_DrawEllipse(pGraphics, pPen, x+w-(2*r), y+h-(2*r), 2*r, 2*r)
        Gdip_ResetClip(pGraphics)
        return E
        }
        Gdip_DrawEllipse(pGraphics, pPen, x, y, w, h)
        {
        return DllCall("gdiplus\GdipDrawEllipse", "uint", pGraphics, "uint", pPen, "float", x, "float", y, "float", w, "float", h)
        }
        Gdip_DrawBezier(pGraphics, pPen, x1, y1, x2, y2, x3, y3, x4, y4)
        {
        return DllCall("gdiplus\GdipDrawBezier", "uint", pgraphics, "uint", pPen
        , "float", x1, "float", y1, "float", x2, "float", y2
        , "float", x3, "float", y3, "float", x4, "float", y4)
        }
        Gdip_DrawArc(pGraphics, pPen, x, y, w, h, StartAngle, SweepAngle)
        {
        return DllCall("gdiplus\GdipDrawArc", "uint", pGraphics, "uint", pPen, "float", x
        , "float", y, "float", w, "float", h, "float", StartAngle, "float", SweepAngle)
        }
        Gdip_DrawPie(pGraphics, pPen, x, y, w, h, StartAngle, SweepAngle)
        {
        return DllCall("gdiplus\GdipDrawPie", "uint", pGraphics, "uint", pPen, "float", x, "float", y, "float", w, "float", h, "float", StartAngle, "float", SweepAngle)
        }
        Gdip_DrawLine(pGraphics, pPen, x1, y1, x2, y2)
        {
        return DllCall("gdiplus\GdipDrawLine", "uint", pGraphics, "uint", pPen
        , "float", x1, "float", y1, "float", x2, "float", y2)
        }
        Gdip_DrawLines(pGraphics, pPen, Points)
        {
        StringSplit, Points, Points, |
        VarSetCapacity(PointF, 8*Points0)
        Loop, %Points0%
        {
        StringSplit, Coord, Points%A_Index%, `,
        NumPut(Coord1, PointF, 8*(A_Index-1), "float"), NumPut(Coord2, PointF, (8*(A_Index-1))+4, "float")
        }
        return DllCall("gdiplus\GdipDrawLines", "uint", pGraphics, "uint", pPen, "uint", &PointF, "int", Points0)
        }
        Gdip_FillRectangle(pGraphics, pBrush, x, y, w, h)
        {
        return DllCall("gdiplus\GdipFillRectangle", "uint", pGraphics, "int", pBrush
        , "float", x, "float", y, "float", w, "float", h)
        }
        Gdip_FillRoundedRectangle(pGraphics, pBrush, x, y, w, h, r)
        {
        Region := Gdip_GetClipRegion(pGraphics)
        Gdip_SetClipRect(pGraphics, x-r, y-r, 2*r, 2*r, 4)
        Gdip_SetClipRect(pGraphics, x+w-r, y-r, 2*r, 2*r, 4)
        Gdip_SetClipRect(pGraphics, x-r, y+h-r, 2*r, 2*r, 4)
        Gdip_SetClipRect(pGraphics, x+w-r, y+h-r, 2*r, 2*r, 4)
        E := Gdip_FillRectangle(pGraphics, pBrush, x, y, w, h)
        Gdip_SetClipRegion(pGraphics, Region, 0)
        Gdip_SetClipRect(pGraphics, x-(2*r), y+r, w+(4*r), h-(2*r), 4)
        Gdip_SetClipRect(pGraphics, x+r, y-(2*r), w-(2*r), h+(4*r), 4)
        Gdip_FillEllipse(pGraphics, pBrush, x, y, 2*r, 2*r)
        Gdip_FillEllipse(pGraphics, pBrush, x+w-(2*r), y, 2*r, 2*r)
        Gdip_FillEllipse(pGraphics, pBrush, x, y+h-(2*r), 2*r, 2*r)
        Gdip_FillEllipse(pGraphics, pBrush, x+w-(2*r), y+h-(2*r), 2*r, 2*r)
        Gdip_SetClipRegion(pGraphics, Region, 0)
        Gdip_DeleteRegion(Region)
        return E
        }
        Gdip_FillPolygon(pGraphics, pBrush, Points, FillMode=0)
        {
        StringSplit, Points, Points, |
        VarSetCapacity(PointF, 8*Points0)
        Loop, %Points0%
        {
        StringSplit, Coord, Points%A_Index%, `,
        NumPut(Coord1, PointF, 8*(A_Index-1), "float"), NumPut(Coord2, PointF, (8*(A_Index-1))+4, "float")
        }
        return DllCall("gdiplus\GdipFillPolygon", "uint", pGraphics, "uint", pBrush, "uint", &PointF, "int", Points0, "int", FillMode)
        }
        Gdip_FillPie(pGraphics, pBrush, x, y, w, h, StartAngle, SweepAngle)
        {
        return DllCall("gdiplus\GdipFillPie", "uint", pGraphics, "uint", pBrush
        , "float", x, "float", y, "float", w, "float", h, "float", StartAngle, "float", SweepAngle)
        }
        Gdip_FillEllipse(pGraphics, pBrush, x, y, w, h)
        {
        return DllCall("gdiplus\GdipFillEllipse", "uint", pGraphics, "uint", pBrush, "float", x, "float", y, "float", w, "float", h)
        }
        Gdip_FillRegion(pGraphics, pBrush, Region)
        {
        return DllCall("gdiplus\GdipFillRegion", "uint", pGraphics, "uint", pBrush, "uint", Region)
        }
        Gdip_FillPath(pGraphics, pBrush, Path)
        {
        return DllCall("gdiplus\GdipFillPath", "uint", pGraphics, "uint", pBrush, "uint", Path)
        }
        Gdip_DrawImagePointsRect(pGraphics, pBitmap, Points, sx="", sy="", sw="", sh="", Matrix=1)
        {
        StringSplit, Points, Points, |
        VarSetCapacity(PointF, 8*Points0)
        Loop, %Points0%
        {
        StringSplit, Coord, Points%A_Index%, `,
        NumPut(Coord1, PointF, 8*(A_Index-1), "float"), NumPut(Coord2, PointF, (8*(A_Index-1))+4, "float")
        }
        if (Matrix&1 = "")
        ImageAttr := Gdip_SetImageAttributesColorMatrix(Matrix)
        else if (Matrix != 1)
        ImageAttr := Gdip_SetImageAttributesColorMatrix("1|0|0|0|0|0|1|0|0|0|0|0|1|0|0|0|0|0|" Matrix "|0|0|0|0|0|1")
        if (sx = "" && sy = "" && sw = "" && sh = "")
        {
        sx := 0, sy := 0
        sw := Gdip_GetImageWidth(pBitmap)
        sh := Gdip_GetImageHeight(pBitmap)
        }
        E := DllCall("gdiplus\GdipDrawImagePointsRect", "uint", pGraphics, "uint", pBitmap
        , "uint", &PointF, "int", Points0, "float", sx, "float", sy, "float", sw, "float", sh
        , "int", 2, "uint", ImageAttr, "uint", 0, "uint", 0)
        if ImageAttr
        Gdip_DisposeImageAttributes(ImageAttr)
        return E
        }
        Gdip_DrawImage(pGraphics, pBitmap, dx="", dy="", dw="", dh="", sx="", sy="", sw="", sh="", Matrix=1)
        {
        if (Matrix&1 = "")
        ImageAttr := Gdip_SetImageAttributesColorMatrix(Matrix)
        else if (Matrix != 1)
        ImageAttr := Gdip_SetImageAttributesColorMatrix("1|0|0|0|0|0|1|0|0|0|0|0|1|0|0|0|0|0|" Matrix "|0|0|0|0|0|1")
        if (sx = "" && sy = "" && sw = "" && sh = "")
        {
        if (dx = "" && dy = "" && dw = "" && dh = "")
        {
        sx := dx := 0, sy := dy := 0
        sw := dw := Gdip_GetImageWidth(pBitmap)
        sh := dh := Gdip_GetImageHeight(pBitmap)
        }
        else
        {
        sx := sy := 0
        sw := Gdip_GetImageWidth(pBitmap)
        sh := Gdip_GetImageHeight(pBitmap)
        }
        }
        E := DllCall("gdiplus\GdipDrawImageRectRect", "uint", pGraphics, "uint", pBitmap
        , "float", dx, "float", dy, "float", dw, "float", dh
        , "float", sx, "float", sy, "float", sw, "float", sh
        , "int", 2, "uint", ImageAttr, "uint", 0, "uint", 0)
        if ImageAttr
        Gdip_DisposeImageAttributes(ImageAttr)
        return E
        }
        Gdip_SetImageAttributesColorMatrix(Matrix)
        {
        VarSetCapacity(ColourMatrix, 100, 0)
        Matrix := RegExReplace(RegExReplace(Matrix, "^[^\d-\.]+([\d\.])", "$1", "", 1), "[^\d-\.]+", "|")
        StringSplit, Matrix, Matrix, |
        Loop, 25
        {
        Matrix := (Matrix%A_Index% != "") ? Matrix%A_Index% : Mod(A_Index-1, 6) ? 0 : 1
        NumPut(Matrix, ColourMatrix, (A_Index-1)*4, "float")
        }
        DllCall("gdiplus\GdipCreateImageAttributes", "uint*", ImageAttr)
        DllCall("gdiplus\GdipSetImageAttributesColorMatrix", "uint", ImageAttr, "int", 1, "int", 1, "uint", &ColourMatrix, "int", 0, "int", 0)
        return ImageAttr
        }
        Gdip_GraphicsFromImage(pBitmap)
        {
        DllCall("gdiplus\GdipGetImageGraphicsContext", "uint", pBitmap, "uint*", pGraphics)
        return pGraphics
        }
        Gdip_GraphicsFromHDC(hdc)
        {
        DllCall("gdiplus\GdipCreateFromHDC", "uint", hdc, "uint*", pGraphics)
        return pGraphics
        }
        Gdip_GetDC(pGraphics)
        {
        DllCall("gdiplus\GdipGetDC", "uint", pGraphics, "uint*", hdc)
        return hdc
        }
        Gdip_ReleaseDC(pGraphics, hdc)
        {
        return DllCall("gdiplus\GdipReleaseDC", "uint", pGraphics, "uint", hdc)
        }
        Gdip_GraphicsClear(pGraphics, ARGB=0x00ffffff)
        {
        return DllCall("gdiplus\GdipGraphicsClear", "uint", pGraphics, "int", ARGB)
        }
        Gdip_BlurBitmap(pBitmap, Blur)
        {
        if (Blur > 100) || (Blur < 1)
        return -1
        sWidth := Gdip_GetImageWidth(pBitmap), sHeight := Gdip_GetImageHeight(pBitmap)
        dWidth := sWidth//Blur, dHeight := sHeight//Blur
        pBitmap1 := Gdip_CreateBitmap(dWidth, dHeight)
        G1 := Gdip_GraphicsFromImage(pBitmap1)
        Gdip_SetInterpolationMode(G1, 7)
        Gdip_DrawImage(G1, pBitmap, 0, 0, dWidth, dHeight, 0, 0, sWidth, sHeight)
        Gdip_DeleteGraphics(G1)
        pBitmap2 := Gdip_CreateBitmap(sWidth, sHeight)
        G2 := Gdip_GraphicsFromImage(pBitmap2)
        Gdip_SetInterpolationMode(G2, 7)
        Gdip_DrawImage(G2, pBitmap1, 0, 0, sWidth, sHeight, 0, 0, dWidth, dHeight)
        Gdip_DeleteGraphics(G2)
        Gdip_DisposeImage(pBitmap1)
        return pBitmap2
        }
        Gdip_SaveBitmapToFile(pBitmap, sOutput, Quality=75)
        {
        SplitPath, sOutput,,, Extension
        if Extension not in BMP,DIB,RLE,JPG,JPEG,JPE,JFIF,GIF,TIF,TIFF,PNG
        return -1
        Extension := "." Extension
        DllCall("gdiplus\GdipGetImageEncodersSize", "uint*", nCount, "uint*", nSize)
        VarSetCapacity(ci, nSize)
        DllCall("gdiplus\GdipGetImageEncoders", "uint", nCount, "uint", nSize, "uint", &ci)
        if !(nCount && nSize)
        return -2
        Loop, %nCount%
        {
        Location := NumGet(ci, 76*(A_Index-1)+44)
        if !A_IsUnicode
        {
        nSize := DllCall("WideCharToMultiByte", "uint", 0, "uint", 0, "uint", Location, "int", -1, "uint", 0, "int",  0, "uint", 0, "uint", 0)
        VarSetCapacity(sString, nSize)
        DllCall("WideCharToMultiByte", "uint", 0, "uint", 0, "uint", Location, "int", -1, "str", sString, "int", nSize, "uint", 0, "uint", 0)
        if !InStr(sString, "*" Extension)
        continue
        }
        else
        {
        nSize := DllCall("WideCharToMultiByte", "uint", 0, "uint", 0, "uint", Location, "int", -1, "uint", 0, "int",  0, "uint", 0, "uint", 0)
        sString := ""
        Loop, %nSize%
        sString .= Chr(NumGet(Location+0, 2*(A_Index-1), "char"))
        if !InStr(sString, "*" Extension)
        continue
        }
        pCodec := &ci+76*(A_Index-1)
        break
        }
        if !pCodec
        return -3
        if (Quality != 75)
        {
        Quality := (Quality < 0) ? 0 : (Quality > 100) ? 100 : Quality
        if Extension in .JPG,.JPEG,.JPE,.JFIF
        {
        DllCall("gdiplus\GdipGetEncoderParameterListSize", "uint", pBitmap, "uint", pCodec, "uint*", nSize)
        VarSetCapacity(EncoderParameters, nSize, 0)
        DllCall("gdiplus\GdipGetEncoderParameterList", "uint", pBitmap, "uint", pCodec, "uint", nSize, "uint", &EncoderParameters)
        Loop, % NumGet(EncoderParameters)
        {
        if (NumGet(EncoderParameters, (28*(A_Index-1))+20) = 1) && (NumGet(EncoderParameters, (28*(A_Index-1))+24) = 6)
        {
        p := (28*(A_Index-1))+&EncoderParameters
        NumPut(Quality, NumGet(NumPut(4, NumPut(1, p+0)+20)))
        break
        }
        }
        }
        }
        if !A_IsUnicode
        {
        nSize := DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, "uint", &sOutput, "int", -1, "uint", 0, "int", 0)
        VarSetCapacity(wOutput, nSize*2)
        DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, "uint", &sOutput, "int", -1, "uint", &wOutput, "int", nSize)
        VarSetCapacity(wOutput, -1)
        if !VarSetCapacity(wOutput)
        return -4
        E := DllCall("gdiplus\GdipSaveImageToFile", "uint", pBitmap, "uint", &wOutput, "uint", pCodec, "uint", p ? p : 0)
        }
        else
        E := DllCall("gdiplus\GdipSaveImageToFile", "uint", pBitmap, "uint", &sOutput, "uint", pCodec, "uint", p ? p : 0)
        return E ? -5 : 0
        }
        Gdip_GetPixel(pBitmap, x, y)
        {
        DllCall("gdiplus\GdipBitmapGetPixel", "uint", pBitmap, "int", x, "int", y, "uint*", ARGB)
        return ARGB
        }
        Gdip_SetPixel(pBitmap, x, y, ARGB)
        {
        return DllCall("gdiplus\GdipBitmapSetPixel", "uint", pBitmap, "int", x, "int", y, "int", ARGB)
        }
        Gdip_GetImageWidth(pBitmap)
        {
        DllCall("gdiplus\GdipGetImageWidth", "uint", pBitmap, "uint*", Width)
        return Width
        }
        Gdip_GetImageHeight(pBitmap)
        {
        DllCall("gdiplus\GdipGetImageHeight", "uint", pBitmap, "uint*", Height)
        return Height
        }
        Gdip_GetImageDimensions(pBitmap, ByRef Width, ByRef Height)
        {
        DllCall("gdiplus\GdipGetImageWidth", "uint", pBitmap, "uint*", Width)
        DllCall("gdiplus\GdipGetImageHeight", "uint", pBitmap, "uint*", Height)
        }
        Gdip_GetDimensions(pBitmap, ByRef Width, ByRef Height)
        {
        Gdip_GetImageDimensions(pBitmap, Width, Height)
        }
        Gdip_GetImagePixelFormat(pBitmap)
        {
        DllCall("gdiplus\GdipGetImagePixelFormat", "uint", pBitmap, "uint*", Format)
        return Format
        }
        Gdip_GetDpiX(pGraphics)
        {
        DllCall("gdiplus\GdipGetDpiX", "uint", pGraphics, "float*", dpix)
        return Round(dpix)
        }
        Gdip_GetDpiY(pGraphics)
        {
        DllCall("gdiplus\GdipGetDpiY", "uint", pGraphics, "float*", dpiy)
        return Round(dpiy)
        }
        Gdip_GetImageHorizontalResolution(pBitmap)
        {
        DllCall("gdiplus\GdipGetImageHorizontalResolution", "uint", pBitmap, "float*", dpix)
        return Round(dpix)
        }
        Gdip_GetImageVerticalResolution(pBitmap)
        {
        DllCall("gdiplus\GdipGetImageVerticalResolution", "uint", pBitmap, "float*", dpiy)
        return Round(dpiy)
        }
        Gdip_BitmapSetResolution(pBitmap, dpix, dpiy)
        {
        return DllCall("gdiplus\GdipBitmapSetResolution", "uint", pBitmap, "float", dpix, "float", dpiy)
        }
        Gdip_CreateBitmapFromFile(sFile, IconNumber=1, IconSize="")
        {
        SplitPath, sFile,,, ext
        if ext in exe,dll
        {
        Sizes := IconSize ? IconSize : 256 "|" 128 "|" 64 "|" 48 "|" 32 "|" 16
        VarSetCapacity(buf, 40)
        Loop, Parse, Sizes, |
        {
        DllCall("PrivateExtractIcons", "str", sFile, "int", IconNumber-1, "int", A_LoopField, "int", A_LoopField, "uint*", hIcon, "uint*", 0, "uint", 1, "uint", 0)
        if !hIcon
        continue
        if !DllCall("GetIconInfo", "uint", hIcon, "uint", &buf)
        {
        DestroyIcon(hIcon)
        continue
        }
        hbmColor := NumGet(buf, 16)
        hbmMask  := NumGet(buf, 12)
        if !(hbmColor && DllCall("GetObject", "uint", hbmColor, "int", 24, "uint", &buf))
        {
        DestroyIcon(hIcon)
        continue
        }
        break
        }
        if !hIcon
        return -1
        Width := NumGet(buf, 4, "int"),  Height := NumGet(buf, 8, "int")
        hbm := CreateDIBSection(Width, -Height), hdc := CreateCompatibleDC(), obm := SelectObject(hdc, hbm)
        if !DllCall("DrawIconEx", "uint", hdc, "int", 0, "int", 0, "uint", hIcon, "uint", Width, "uint", Height, "uint", 0, "uint", 0, "uint", 3)
        {
        DestroyIcon(hIcon)
        return -2
        }
        VarSetCapacity(dib, 84)
        DllCall("GetObject", "uint", hbm, "int", 84, "uint", &dib)
        Stride := NumGet(dib, 12), Bits := NumGet(dib, 20)
        DllCall("gdiplus\GdipCreateBitmapFromScan0", "int", Width, "int", Height, "int", Stride, "int", 0x26200A, "uint", Bits, "uint*", pBitmapOld)
        pBitmap := Gdip_CreateBitmap(Width, Height), G := Gdip_GraphicsFromImage(pBitmap)
        Gdip_DrawImage(G, pBitmapOld, 0, 0, Width, Height, 0, 0, Width, Height)
        SelectObject(hdc, obm), DeleteObject(hbm), DeleteDC(hdc)
        Gdip_DeleteGraphics(G), Gdip_DisposeImage(pBitmapOld)
        DestroyIcon(hIcon)
        }
        else
        {
        if !A_IsUnicode
        {
        VarSetCapacity(wFile, 1023)
        DllCall("kernel32\MultiByteToWideChar", "uint", 0, "uint", 0, "uint", &sFile, "int", -1, "uint", &wFile, "int", 512)
        DllCall("gdiplus\GdipCreateBitmapFromFile", "uint", &wFile, "uint*", pBitmap)
        }
        else
        DllCall("gdiplus\GdipCreateBitmapFromFile", "uint", &sFile, "uint*", pBitmap)
        }
        return pBitmap
        }
        Gdip_CreateBitmapFromHBITMAP(hBitmap, Palette=0)
        {
        DllCall("gdiplus\GdipCreateBitmapFromHBITMAP", "uint", hBitmap, "uint", Palette, "uint*", pBitmap)
        return pBitmap
        }
        Gdip_CreateHBITMAPFromBitmap(pBitmap, Background=0xffffffff)
        {
        DllCall("gdiplus\GdipCreateHBITMAPFromBitmap", "uint", pBitmap, "uint*", hbm, "int", Background)
        return hbm
        }
        Gdip_CreateBitmapFromHICON(hIcon)
        {
        DllCall("gdiplus\GdipCreateBitmapFromHICON", "uint", hIcon, "uint*", pBitmap)
        return pBitmap
        }
        Gdip_CreateHICONFromBitmap(pBitmap)
        {
        DllCall("gdiplus\GdipCreateHICONFromBitmap", "uint", pBitmap, "uint*", hIcon)
        return hIcon
        }
        Gdip_CreateBitmap(Width, Height, Format=0x26200A)
        {
        DllCall("gdiplus\GdipCreateBitmapFromScan0", "int", Width, "int", Height, "int", 0, "int", Format, "uint", 0, "uint*", pBitmap)
        Return pBitmap
        }
        Gdip_CreateBitmapFromClipboard()
        {
        if !DllCall("OpenClipboard", "uint", 0)
        return -1
        if !DllCall("IsClipboardFormatAvailable", "uint", 8)
        return -2
        if !hBitmap := DllCall("GetClipboardData", "uint", 2)
        return -3
        if !pBitmap := Gdip_CreateBitmapFromHBITMAP(hBitmap)
        return -4
        if !DllCall("CloseClipboard")
        return -5
        DeleteObject(hBitmap)
        return pBitmap
        }
        Gdip_SetBitmapToClipboard(pBitmap)
        {
        hBitmap := Gdip_CreateHBITMAPFromBitmap(pBitmap)
        DllCall("GetObject", "uint", hBitmap, "int", VarSetCapacity(oi, 84, 0), "uint", &oi)
        hdib := DllCall("GlobalAlloc", "uint", 2, "uint", 40+NumGet(oi, 44))
        pdib := DllCall("GlobalLock", "uint", hdib)
        DllCall("RtlMoveMemory", "uint", pdib, "uint", &oi+24, "uint", 40)
        DllCall("RtlMoveMemory", "Uint", pdib+40, "Uint", NumGet(oi, 20), "uint", NumGet(oi, 44))
        DllCall("GlobalUnlock", "uint", hdib)
        DllCall("DeleteObject", "uint", hBitmap)
        DllCall("OpenClipboard", "uint", 0)
        DllCall("EmptyClipboard")
        DllCall("SetClipboardData", "uint", 8, "uint", hdib)
        DllCall("CloseClipboard")
        }
        Gdip_CloneBitmapArea(pBitmap, x, y, w, h, Format=0x26200A)
        {
        DllCall("gdiplus\GdipCloneBitmapArea", "float", x, "float", y, "float", w, "float", h
        , "int", Format, "uint", pBitmap, "uint*", pBitmapDest)
        return pBitmapDest
        }
        Gdip_CreatePen(ARGB, w)
        {
        DllCall("gdiplus\GdipCreatePen1", "int", ARGB, "float", w, "int", 2, "uint*", pPen)
        return pPen
        }
        Gdip_CreatePenFromBrush(pBrush, w)
        {
        DllCall("gdiplus\GdipCreatePen2", "uint", pBrush, "float", w, "int", 2, "uint*", pPen)
        return pPen
        }
        Gdip_BrushCreateSolid(ARGB=0xff000000)
        {
        DllCall("gdiplus\GdipCreateSolidFill", "int", ARGB, "uint*", pBrush)
        return pBrush
        }
        Gdip_BrushCreateHatch(ARGBfront, ARGBback, HatchStyle=0)
        {
        DllCall("gdiplus\GdipCreateHatchBrush", "int", HatchStyle, "int", ARGBfront, "int", ARGBback, "uint*", pBrush)
        return pBrush
        }
        Gdip_CreateTextureBrush(pBitmap, WrapMode=1, x=0, y=0, w="", h="")
        {
        if !(w && h)
        DllCall("gdiplus\GdipCreateTexture", "uint", pBitmap, "int", WrapMode, "uint*", pBrush)
        else
        DllCall("gdiplus\GdipCreateTexture2", "uint", pBitmap, "int", WrapMode, "float", x, "float", y, "float", w, "float", h, "uint*", pBrush)
        return pBrush
        }
        Gdip_CreateLineBrush(x1, y1, x2, y2, ARGB1, ARGB2, WrapMode=1)
        {
        CreatePointF(PointF1, x1, y1), CreatePointF(PointF2, x2, y2)
        DllCall("gdiplus\GdipCreateLineBrush", "uint", &PointF1, "uint", &PointF2, "int", ARGB1, "int", ARGB2, "int", WrapMode, "uint*", LGpBrush)
        return LGpBrush
        }
        Gdip_CreateLineBrushFromRect(x, y, w, h, ARGB1, ARGB2, LinearGradientMode=1, WrapMode=1)
        {
        CreateRectF(RectF, x, y, w, h)
        DllCall("gdiplus\GdipCreateLineBrushFromRect", "uint", &RectF, "int", ARGB1, "int", ARGB2, "int", LinearGradientMode, "int", WrapMode, "uint*", LGpBrush)
        return LGpBrush
        }
        Gdip_CloneBrush(pBrush)
        {
        DllCall("gdiplus\GdipCloneBrush", "uint", pBrush, "uint*", pBrushClone)
        return pBrushClone
        }
        Gdip_DeletePen(pPen)
        {
        return DllCall("gdiplus\GdipDeletePen", "uint", pPen)
        }
        Gdip_DeleteBrush(pBrush)
        {
        return DllCall("gdiplus\GdipDeleteBrush", "uint", pBrush)
        }
        Gdip_DisposeImage(pBitmap)
        {
        return DllCall("gdiplus\GdipDisposeImage", "uint", pBitmap)
        }
        Gdip_DeleteGraphics(pGraphics)
        {
        return DllCall("gdiplus\GdipDeleteGraphics", "uint", pGraphics)
        }
        Gdip_DisposeImageAttributes(ImageAttr)
        {
        return DllCall("gdiplus\GdipDisposeImageAttributes", "uint", ImageAttr)
        }
        Gdip_DeleteFont(hFont)
        {
        return DllCall("gdiplus\GdipDeleteFont", "uint", hFont)
        }
        Gdip_DeleteStringFormat(hFormat)
        {
        return DllCall("gdiplus\GdipDeleteStringFormat", "uint", hFormat)
        }
        Gdip_DeleteFontFamily(hFamily)
        {
        return DllCall("gdiplus\GdipDeleteFontFamily", "uint", hFamily)
        }
        Gdip_DeleteMatrix(Matrix)
        {
        return DllCall("gdiplus\GdipDeleteMatrix", "uint", Matrix)
        }
        Gdip_TextToGraphics(pGraphics, Text, Options, Font="Arial", Width="", Height="", Measure=0)
        {
        IWidth := Width, IHeight:= Height
        RegExMatch(Options, "i)X([\-\d\.]+)(p*)", xpos)
        RegExMatch(Options, "i)Y([\-\d\.]+)(p*)", ypos)
        RegExMatch(Options, "i)W([\-\d\.]+)(p*)", Width)
        RegExMatch(Options, "i)H([\-\d\.]+)(p*)", Height)
        RegExMatch(Options, "i)C(?!(entre|enter))([a-f\d]+)", Colour)
        RegExMatch(Options, "i)Top|Up|Bottom|Down|vCentre|vCenter", vPos)
        RegExMatch(Options, "i)NoWrap", NoWrap)
        RegExMatch(Options, "i)R(\d)", Rendering)
        RegExMatch(Options, "i)S(\d+)(p*)", Size)
        if !Gdip_DeleteBrush(Gdip_CloneBrush(Colour2))
        PassBrush := 1, pBrush := Colour2
        if !(IWidth && IHeight) && (xpos2 || ypos2 || Width2 || Height2 || Size2)
        return -1
        Style := 0, Styles := "Regular|Bold|Italic|BoldItalic|Underline|Strikeout"
        Loop, Parse, Styles, |
        {
        if RegExMatch(Options, "\b" A_loopField)
        Style |= (A_LoopField != "StrikeOut") ? (A_Index-1) : 8
        }
        Align := 0, Alignments := "Near|Left|Centre|Center|Far|Right"
        Loop, Parse, Alignments, |
        {
        if RegExMatch(Options, "\b" A_loopField)
        Align |= A_Index//2.1
        }
        xpos := (xpos1 != "") ? xpos2 ? IWidth*(xpos1/100) : xpos1 : 0
        ypos := (ypos1 != "") ? ypos2 ? IHeight*(ypos1/100) : ypos1 : 0
        Width := Width1 ? Width2 ? IWidth*(Width1/100) : Width1 : IWidth
        Height := Height1 ? Height2 ? IHeight*(Height1/100) : Height1 : IHeight
        if !PassBrush
        Colour := "0x" (Colour2 ? Colour2 : "ff000000")
        Rendering := ((Rendering1 >= 0) && (Rendering1 <= 5)) ? Rendering1 : 4
        Size := (Size1 > 0) ? Size2 ? IHeight*(Size1/100) : Size1 : 12
        hFamily := Gdip_FontFamilyCreate(Font)
        hFont := Gdip_FontCreate(hFamily, Size, Style)
        FormatStyle := NoWrap ? 0x4000 | 0x1000 : 0x4000
        hFormat := Gdip_StringFormatCreate(FormatStyle)
        pBrush := PassBrush ? pBrush : Gdip_BrushCreateSolid(Colour)
        if !(hFamily && hFont && hFormat && pBrush && pGraphics)
        return !pGraphics ? -2 : !hFamily ? -3 : !hFont ? -4 : !hFormat ? -5 : !pBrush ? -6 : 0
        CreateRectF(RC, xpos, ypos, Width, Height)
        Gdip_SetStringFormatAlign(hFormat, Align)
        Gdip_SetTextRenderingHint(pGraphics, Rendering)
        ReturnRC := Gdip_MeasureString(pGraphics, Text, hFont, hFormat, RC)
        if vPos
        {
        StringSplit, ReturnRC, ReturnRC, |
        if (vPos = "vCentre") || (vPos = "vCenter")
        ypos += (Height-ReturnRC4)//2
        else if (vPos = "Top") || (vPos = "Up")
        ypos := 0
        else if (vPos = "Bottom") || (vPos = "Down")
        ypos := Height-ReturnRC4
        CreateRectF(RC, xpos, ypos, Width, ReturnRC4)
        ReturnRC := Gdip_MeasureString(pGraphics, Text, hFont, hFormat, RC)
        }
        if !Measure
        E := Gdip_DrawString(pGraphics, Text, hFont, hFormat, pBrush, RC)
        if !PassBrush
        Gdip_DeleteBrush(pBrush)
        Gdip_DeleteStringFormat(hFormat)
        Gdip_DeleteFont(hFont)
        Gdip_DeleteFontFamily(hFamily)
        return E ? E : ReturnRC
        }
        Gdip_DrawString(pGraphics, sString, hFont, hFormat, pBrush, ByRef RectF)
        {
        if !A_IsUnicode
        {
        nSize := DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, "uint", &sString, "int", -1, "uint", 0, "int", 0)
        VarSetCapacity(wString, nSize*2)
        DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, "uint", &sString, "int", -1, "uint", &wString, "int", nSize)
        return DllCall("gdiplus\GdipDrawString", "uint", pGraphics
        , "uint", &wString, "int", -1, "uint", hFont, "uint", &RectF, "uint", hFormat, "uint", pBrush)
        }
        else
        {
        return DllCall("gdiplus\GdipDrawString", "uint", pGraphics
        , "uint", &sString, "int", -1, "uint", hFont, "uint", &RectF, "uint", hFormat, "uint", pBrush)
        }
        }
        Gdip_MeasureString(pGraphics, sString, hFont, hFormat, ByRef RectF)
        {
        VarSetCapacity(RC, 16)
        if !A_IsUnicode
        {
        nSize := DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, "uint", &sString, "int", -1, "uint", 0, "int", 0)
        VarSetCapacity(wString, nSize*2)
        DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, "uint", &sString, "int", -1, "uint", &wString, "int", nSize)
        DllCall("gdiplus\GdipMeasureString", "uint", pGraphics
        , "uint", &wString, "int", -1, "uint", hFont, "uint", &RectF, "uint", hFormat, "uint", &RC, "uint*", Chars, "uint*", Lines)
        }
        else
        {
        DllCall("gdiplus\GdipMeasureString", "uint", pGraphics
        , "uint", &sString, "int", -1, "uint", hFont, "uint", &RectF, "uint", hFormat, "uint", &RC, "uint*", Chars, "uint*", Lines)
        }
        return &RC ? NumGet(RC, 0, "float") "|" NumGet(RC, 4, "float") "|" NumGet(RC, 8, "float") "|" NumGet(RC, 12, "float") "|" Chars "|" Lines : 0
        }
        Gdip_SetStringFormatAlign(hFormat, Align)
        {
        return DllCall("gdiplus\GdipSetStringFormatAlign", "uint", hFormat, "int", Align)
        }
        Gdip_StringFormatCreate(Format=0, Lang=0)
        {
        DllCall("gdiplus\GdipCreateStringFormat", "int", Format, "int", Lang, "uint*", hFormat)
        return hFormat
        }
        Gdip_FontCreate(hFamily, Size, Style=0)
        {
        DllCall("gdiplus\GdipCreateFont", "uint", hFamily, "float", Size, "int", Style, "int", 0, "uint*", hFont)
        return hFont
        }
        Gdip_FontFamilyCreate(Font)
        {
        if !A_IsUnicode
        {
        nSize := DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, "uint", &Font, "int", -1, "uint", 0, "int", 0)
        VarSetCapacity(wFont, nSize*2)
        DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, "uint", &Font, "int", -1, "uint", &wFont, "int", nSize)
        DllCall("gdiplus\GdipCreateFontFamilyFromName", "uint", &wFont, "uint", 0, "uint*", hFamily)
        }
        else
        DllCall("gdiplus\GdipCreateFontFamilyFromName", "uint", &Font, "uint", 0, "uint*", hFamily)
        return hFamily
        }
        Gdip_CreateAffineMatrix(m11, m12, m21, m22, x, y)
        {
        DllCall("gdiplus\GdipCreateMatrix2", "float", m11, "float", m12, "float", m21, "float", m22, "float", x, "float", y, "uint*", Matrix)
        return Matrix
        }
        Gdip_CreateMatrix()
        {
        DllCall("gdiplus\GdipCreateMatrix", "uint*", Matrix)
        return Matrix
        }
        Gdip_CreatePath(BrushMode=0)
        {
        DllCall("gdiplus\GdipCreatePath", "int", BrushMode, "uint*", Path)
        return Path
        }
        Gdip_AddPathEllipse(Path, x, y, w, h)
        {
        return DllCall("gdiplus\GdipAddPathEllipse", "uint", Path, "float", x, "float", y, "float", w, "float", h)
        }
        Gdip_AddPathPolygon(Path, Points)
        {
        StringSplit, Points, Points, |
        VarSetCapacity(PointF, 8*Points0)
        Loop, %Points0%
        {
        StringSplit, Coord, Points%A_Index%, `,
        NumPut(Coord1, PointF, 8*(A_Index-1), "float"), NumPut(Coord2, PointF, (8*(A_Index-1))+4, "float")
        }
        return DllCall("gdiplus\GdipAddPathPolygon", "uint", Path, "uint", &PointF, "int", Points0)
        }
        Gdip_DeletePath(Path)
        {
        return DllCall("gdiplus\GdipDeletePath", "uint", Path)
        }
        Gdip_SetTextRenderingHint(pGraphics, RenderingHint)
        {
        return DllCall("gdiplus\GdipSetTextRenderingHint", "uint", pGraphics, "int", RenderingHint)
        }
        Gdip_SetInterpolationMode(pGraphics, InterpolationMode)
        {
        return DllCall("gdiplus\GdipSetInterpolationMode", "uint", pGraphics, "int", InterpolationMode)
        }
        Gdip_SetSmoothingMode(pGraphics, SmoothingMode)
        {
        return DllCall("gdiplus\GdipSetSmoothingMode", "uint", pGraphics, "int", SmoothingMode)
        }
        Gdip_SetCompositingMode(pGraphics, CompositingMode=0)
        {
        return DllCall("gdiplus\GdipSetCompositingMode", "uint", pGraphics, "int", CompositingMode)
        }
        Gdip_Startup()
        {
        if !DllCall("GetModuleHandle", "str", "gdiplus")
        DllCall("LoadLibrary", "str", "gdiplus")
        VarSetCapacity(si, 16, 0), si := Chr(1)
        DllCall("gdiplus\GdiplusStartup", "uint*", pToken, "uint", &si, "uint", 0)
        return pToken
        }
        Gdip_Shutdown(pToken)
        {
        DllCall("gdiplus\GdiplusShutdown", "uint", pToken)
        if hModule := DllCall("GetModuleHandle", "str", "gdiplus")
        DllCall("FreeLibrary", "uint", hModule)
        return 0
        }
        Gdip_RotateWorldTransform(pGraphics, Angle, MatrixOrder=0)
        {
        return DllCall("gdiplus\GdipRotateWorldTransform", "uint", pGraphics, "float", Angle, "int", MatrixOrder)
        }
        Gdip_ScaleWorldTransform(pGraphics, x, y, MatrixOrder=0)
        {
        return DllCall("gdiplus\GdipScaleWorldTransform", "uint", pGraphics, "float", x, "float", y, "int", MatrixOrder)
        }
        Gdip_TranslateWorldTransform(pGraphics, x, y, MatrixOrder=0)
        {
        return DllCall("gdiplus\GdipTranslateWorldTransform", "uint", pGraphics, "float", x, "float", y, "int", MatrixOrder)
        }
        Gdip_ResetWorldTransform(pGraphics)
        {
        return DllCall("gdiplus\GdipResetWorldTransform", "uint", pGraphics)
        }
        Gdip_GetRotatedTranslation(Width, Height, Angle, ByRef xTranslation, ByRef yTranslation)
        {
        pi := 3.14159, TAngle := Angle*(pi/180)
        Bound := (Angle >= 0) ? Mod(Angle, 360) : 360-Mod(-Angle, -360)
        if ((Bound >= 0) && (Bound <= 90))
        xTranslation := Height*Sin(TAngle), yTranslation := 0
        else if ((Bound > 90) && (Bound <= 180))
        xTranslation := (Height*Sin(TAngle))-(Width*Cos(TAngle)), yTranslation := -Height*Cos(TAngle)
        else if ((Bound > 180) && (Bound <= 270))
        xTranslation := -(Width*Cos(TAngle)), yTranslation := -(Height*Cos(TAngle))-(Width*Sin(TAngle))
        else if ((Bound > 270) && (Bound <= 360))
        xTranslation := 0, yTranslation := -Width*Sin(TAngle)
        }
        Gdip_GetRotatedDimensions(Width, Height, Angle, ByRef RWidth, ByRef RHeight)
        {
        pi := 3.14159, TAngle := Angle*(pi/180)
        if !(Width && Height)
        return -1
        RWidth := Ceil(Abs(Width*Cos(TAngle))+Abs(Height*Sin(TAngle)))
        RHeight := Ceil(Abs(Width*Sin(TAngle))+Abs(Height*Cos(Tangle)))
        }
        Gdip_ImageRotateFlip(pBitmap, RotateFlipType=1)
        {
        return DllCall("gdiplus\GdipImageRotateFlip", "uint", pBitmap, "int", RotateFlipType)
        }
        Gdip_SetClipRect(pGraphics, x, y, w, h, CombineMode=0)
        {
        return DllCall("gdiplus\GdipSetClipRect", "uint", pGraphics, "float", x, "float", y, "float", w, "float", h, "int", CombineMode)
        }
        Gdip_SetClipPath(pGraphics, Path, CombineMode=0)
        {
        return DllCall("gdiplus\GdipSetClipPath", "uint", pGraphics, "uint", Path, "int", CombineMode)
        }
        Gdip_ResetClip(pGraphics)
        {
        return DllCall("gdiplus\GdipResetClip", "uint", pGraphics)
        }
        Gdip_GetClipRegion(pGraphics)
        {
        Region := Gdip_CreateRegion()
        DllCall("gdiplus\GdipGetClip", "uint" pGraphics, "uint*", Region)
        return Region
        }
        Gdip_SetClipRegion(pGraphics, Region, CombineMode=0)
        {
        return DllCall("gdiplus\GdipSetClipRegion", "uint", pGraphics, "uint", Region, "int", CombineMode)
        }
        Gdip_CreateRegion()
        {
        DllCall("gdiplus\GdipCreateRegion", "uint*", Region)
        return Region
        }
        Gdip_DeleteRegion(Region)
        {
        return DllCall("gdiplus\GdipDeleteRegion", "uint", Region)
        }
        Gdip_LockBits(pBitmap, x, y, w, h, ByRef Stride, ByRef Scan0, ByRef BitmapData, LockMode = 3, PixelFormat = 0x26200a)
        {
        CreateRect(Rect, x, y, w, h)
        VarSetCapacity(BitmapData, 21, 0)
        E := DllCall("Gdiplus\GdipBitmapLockBits", "uint", pBitmap, "uint", &Rect, "uint", LockMode, "int", PixelFormat, "uint", &BitmapData)
        Stride := NumGet(BitmapData, 8)
        Scan0 := NumGet(BitmapData, 16)
        return E
        }
        Gdip_UnlockBits(pBitmap, ByRef BitmapData)
        {
        return DllCall("Gdiplus\GdipBitmapUnlockBits", "uint", pBitmap, "uint", &BitmapData)
        }
        Gdip_SetLockBitPixel(ARGB, Scan0, x, y, Stride)
        {
        Numput(ARGB, Scan0+0, (x*4)+(y*Stride))
        }
        Gdip_GetLockBitPixel(Scan0, x, y, Stride)
        {
        return NumGet(Scan0+0, (x*4)+(y*Stride))
        }
        Gdip_PixelateBitmap(pBitmap, ByRef pBitmapOut, BlockSize)
        {
        static PixelateBitmap
        if !PixelateBitmap
        {
        MCode_PixelateBitmap := "83EC388B4424485355568B74245C99F7FE8B5C244C8B6C2448578BF88BCA894C241C897C243485FF0F8E2E0300008B44245"
        . "499F7FE897C24448944242833C089542418894424308944242CEB038D490033FF397C2428897C24380F8E750100008BCE0FAFCE894C24408DA4240000"
        . "000033C03BF08944241089442460894424580F8E8A0000008B5C242C8D4D028BD52BD183C203895424208D3CBB0FAFFE8BD52BD142895424248BD52BD"
        . "103F9897C24148974243C8BCF8BFE8DA424000000008B5C24200FB61C0B03C30FB619015C24588B5C24240FB61C0B015C24600FB61C11015C241083C1"
        . "0483EF0175D38B7C2414037C245C836C243C01897C241475B58B7C24388B6C244C8B5C24508B4C244099F7F9894424148B44245899F7F9894424588B4"
        . "4246099F7F9894424608B44241099F7F98944241085F60F8E820000008D4B028BC32BC18D68038B44242C8D04B80FAFC68BD32BD142895424248BD32B"
        . "D103C18944243C89742420EB038D49008BC88BFE0FB64424148B5C24248804290FB644245888010FB644246088040B0FB644241088040A83C10483EF0"
        . "175D58B44243C0344245C836C2420018944243C75BE8B4C24408B5C24508B6C244C8B7C2438473B7C2428897C24380F8C9FFEFFFF8B4C241C33D23954"
        . "24180F846401000033C03BF2895424108954246089542458895424148944243C0F8E82000000EB0233D2395424187E6F8B4C243003C80FAF4C245C8B4"
        . "424280FAFC68D550203CA8D0C818BC52BC283C003894424208BC52BC2408BFD2BFA8B54241889442424895424408B4424200FB614080FB60101542414"
        . "8B542424014424580FB6040A0FB61439014424600154241083C104836C24400175CF8B44243C403BC68944243C7C808B4C24188B4424140FAFCE99F7F"
        . "9894424148B44245899F7F9894424588B44246099F7F9894424608B44241099F7F98944241033C08944243C85F60F8E7F000000837C2418007E6F8B4C"
        . "243003C80FAF4C245C8B4424280FAFC68D530203CA8D0C818BC32BC283C003894424208BC32BC2408BFB2BFA8B54241889442424895424400FB644241"
        . "48B5424208804110FB64424580FB654246088018B4424248814010FB654241088143983C104836C24400175CF8B44243C403BC68944243C7C818B4C24"
        . "1C8B44245C0144242C01742430836C2444010F85F4FCFFFF8B44245499F7FE895424188944242885C00F8E890100008BF90FAFFE33D2897C243C89542"
        . "45489442438EB0233D233C03BCA89542410895424608954245889542414894424400F8E840000003BF27E738B4C24340FAFCE03C80FAF4C245C034C24"
        . "548D55028BC52BC283C003894424208BC52BC2408BFD03CA894424242BFA89742444908B5424200FB6040A0FB611014424148B442424015424580FB61"
        . "4080FB6040F015424600144241083C104836C24440175CF8B4424408B7C243C8B4C241C33D2403BC1894424400F8C7CFFFFFF8B44241499F7FF894424"
        . "148B44245899F7FF894424588B44246099F7FF894424608B44241099F7FF8944241033C08944244085C90F8E8000000085F67E738B4C24340FAFCE03C"
        . "80FAF4C245C034C24548D53028BC32BC283C003894424208BC32BC2408BFB03CA894424242BFA897424448D49000FB65424148B4424208814010FB654"
        . "24580FB644246088118B5424248804110FB644241088043983C104836C24440175CF8B4424408B7C243C8B4C241C403BC1894424407C808D04B500000"
        . "00001442454836C2438010F858CFEFFFF33D233C03BCA89542410895424608954245889542414894424440F8E9A000000EB048BFF33D2395424180F8E"
        . "7D0000008B4C24340FAFCE03C80FAF4C245C8B4424280FAFC68D550203CA8D0C818BC52BC283C003894424208BC52BC240894424248BC52BC28B54241"
        . "8895424548DA424000000008B5424200FB6140A015424140FB611015424588B5424240FB6140A015424600FB614010154241083C104836C24540175CF"
        . "8B4424448B4C241C403BC1894424440F8C6AFFFFFF0FAF4C24188B44241499F7F9894424148B44245899F7F9894424588B44246099F7F9894424608B4"
        . "4241099F7F98944241033C03944241C894424540F8E7B0000008B7C241885FF7E688B4C24340FAFCE03C80FAF4C245C8B4424280FAFC68D530203CA8D"
        . "0C818BC32BC283C003894424208BC32BC2408BEB894424242BEA0FB65424148B4424208814010FB65424580FB644246088118B5424248804110FB6442"
        . "41088042983C10483EF0175D18B442454403B44241C894424547C855F5E5D33C05B83C438C3"
        VarSetCapacity(PixelateBitmap, StrLen(MCode_PixelateBitmap)//2)
        Loop % StrLen(MCode_PixelateBitmap)//2
        NumPut("0x" SubStr(MCode_PixelateBitmap, (2*A_Index)-1, 2), PixelateBitmap, A_Index-1, "char")
        }
        Gdip_GetImageDimensions(pBitmap, Width, Height)
        if (Width != Gdip_GetImageWidth(pBitmapOut) || Height != Gdip_GetImageHeight(pBitmapOut))
        return -1
        if (BlockSize > Width || BlockSize > Height)
        return -2
        E1 := Gdip_LockBits(pBitmap, 0, 0, Width, Height, Stride1, Scan01, BitmapData1)
        E2 := Gdip_LockBits(pBitmapOut, 0, 0, Width, Height, Stride2, Scan02, BitmapData2)
        if (E1 || E2)
        return -3
        E := DllCall(&PixelateBitmap, "uint", Scan01, "uint", Scan02, "int", Width, "int", Height, "int", Stride1, "int", BlockSize)
        Gdip_UnlockBits(pBitmap, BitmapData1), Gdip_UnlockBits(pBitmapOut, BitmapData2)
        return 0
        }
        Gdip_ToARGB(A, R, G, B)
        {
        return (A << 24) | (R << 16) | (G << 8) | B
        }
        Gdip_FromARGB(ARGB, ByRef A, ByRef R, ByRef G, ByRef B)
        {
        A := (0xff000000 & ARGB) >> 24
        R := (0x00ff0000 & ARGB) >> 16
        G := (0x0000ff00 & ARGB) >> 8
        B := 0x000000ff & ARGB
        }
        Gdip_AFromARGB(ARGB)
        {
        return (0xff000000 & ARGB) >> 24
        }
        Gdip_RFromARGB(ARGB)
        {
        return (0x00ff0000 & ARGB) >> 16
        }
        Gdip_GFromARGB(ARGB)
        {
        return (0x0000ff00 & ARGB) >> 8
        }
        Gdip_BFromARGB(ARGB)
        {
        return 0x000000ff & ARGB
        }
        coordmode, tooltip,client
        setwindelay,-1
        SetBatchLines, -1
        mouse_div := 3.0
        inicount := 11
        fileread,settings,settings.ini
        stringsplit,settings,settings,`n
        if !(fileexist("settings.ini")) || (settings0-3 != inicount){
        iniwrite,1,settings.ini,hotkeys,lbutton
        iniwrite,1,settings.ini,hotkeys,rbutton
        iniwrite,3.30,settings.ini,settings,sensitivity
        iniwrite,0,settings.ini,settings,safe
        iniwrite,0,settings.ini,settings,distance
        iniwrite,800,settings.ini,settings,initial_search_width
        iniwrite,200,settings.ini,settings,match_search_width
        iniwrite,24,settings.ini,settings,static_x_offset
        iniwrite,12,settings.ini,settings,static_y_offset
        iniwrite,1,settings.ini,settings,overlayShow
        iniwrite,0,settings.ini,settings,alphaSearch
        }
        iniread,lCheck,settings.ini,hotkeys,lbutton
        iniread,rCheck,settings.ini,hotkeys,rbutton
        hotkey,~lbutton,aim, % lCheck ? "on" : "off"
        hotkey,~rbutton,aim, % lCheck ? "on" : "off"
        iniread,mouse_div,settings.ini,settings,sensitivity
        iniread,safe,settings.ini,settings,safe
        iniread,distance,settings.ini,settings,distance
        iniread,initial_s_w,settings.ini,settings,initial_search_width
        iniread,match_s_w,settings.ini,settings,match_search_width
        iniread,x_offset,settings.ini,settings,static_x_offset
        iniread,y_offset,settings.ini,settings,static_y_offset
        iniread,overlayShow,settings.ini,settings,overlayShow
        iniread,alphaSearch,settings.ini,settings,alphaSearch
        Gui, 1: Add, GroupBox, x12 y10 w160 h45 , Activation
        Gui 1: Add, CheckBox, % "x22 y25 w60 h20 " (lCheck ? "+checked" : "-checked") " v_l greg", LButton
        Gui 1: Add, CheckBox, % "x85 y25 w140 h20 " (rCheck ? "+checked" : "-checked") " v_r greg", RButton
        Gui 1: Add, GroupBox, x12 y60 w160 h45 , Sensitivity / mouse_div
        Gui 1: Add, Edit, x62 y80 w50 h20 vsensitivity, % mouse_div
        Gui 1: Add, Button, x112 y80 w20 h20 v_sensChange_0 gsens, +
        Gui 1: Add, Button, x132 y80 w20 h20 v_sensChange_2 gsens, -
        Gui 1: Add, Text, x22 y82 w40 h20 , Sens:
        Gui 1: Add, GroupBox, x12 y110 w160 h290 , Settings
        Gui 1: Add, CheckBox, % "x22 y125 w140 h20 " (safe ? "+checked" : "-checked") " vsafe greg2", Safe mode
        Gui 1: Add, Text, x22 y145 w130 h20 , (Slow`, but potentially safer)
        Gui 1: Add, CheckBox, % "x22 y165 w130 h20 " (distance ? "+checked" : "-checked") " vdistance greg2", Distance check
        Gui 1: Add, Text, x22 y185 w140 h40 , (Accounts for distance`, but due to hpbar obscurance, can be unreliable)
        Gui 1: Add, Text, x22 y233 w100 h20 , Search width:
        Gui 1: Add, Edit, x122 y230 w50 h20 vinitial_s_w, % initial_s_w
        Gui 1: Add, Text, x22 y253 w100 h20 , Match search width:
        Gui 1: Add, Edit, x122 y250 w50 h20 vmatch_s_w, % match_s_w
        Gui 1: Add, Text, x22 y273 w100 h20 , Offset on x:
        Gui 1: Add, Edit, x122 y270 w50 h20 vx_offset, % x_offset
        Gui 1: Add, Text, x22 y293 w100 h20 , Offset on y:
        Gui 1: Add, Edit, x122 y290 w50 h20 vy_offset, % y_offset
        Gui 1: Add, CheckBox, % "x22 y313 w130 h20 " (overlayShow ? "+checked" : "-checked") " voverlayShow greg2", Show overlay
        Gui 1: Add, CheckBox, % "x22 y333 w130 h40 " (alphaSearch ? "+checked" : "-checked") " valphaSearch greg2", Alternative search`n(Win 10, etc)
        Gui 1: Add, Button, x12 y373 w160 h30 vrunButton grunr, Run
        Gui 1: Show, w189 h413
        mainGui := winactive("A")
        return
        reg:
        gui,submit,nohide
        key := "~" strsplit(a_guicontrol,"_")[2] "button"
        if (%a_guicontrol%)
        hotkey, % key, aim, on
        else
        hotkey, % key, aim, off
        return
        reg2:
        %a_guicontrol% := !%a_guicontrol%
        return
        home::
        if (!winactive("ahk_id " mainGui)) {
        winactivate, ahk_id %mainGui%
        goto, runr
        }
        else {
        WinMinimize, ahk_id %mainGui%
        winactivate, ahk_class TankWindowClass
        winactivate, ahk_id %overlay_ID%
        }
        return
        ~pgup::goto sens
        ~pgdn::
        mouse_div += -0.1
        goto sens
        sens:
        addVal := a_guicontrol ? a_guicontrol : "__0"
        mouse_div := round(mouse_div+(1-strsplit(addVal,"_")[3])*0.05,2)
        guicontrol,,sensitivity, % mouse_div
        if (!winactive("ahk_id " mainGui))
        TTip(mouse_div, 500)
        return
        TTip(str,delay) {
        tooltip % str
        settimer,ttexpire, % delay
        return
        ttexpire:
        tooltip,
        return
        }
        runr:
        gui 1: submit,nohide
        if (!winexist("ahk_class TankWindowClass")) {
        MsgBox Open Overwatch and try again.
        return
        }
        aimactive := !aimactive
        if (aimactive) {
        guicontrol,,runButton,Disable
        WinMinimize, ahk_id %mainGui%
        pToken := Gdip_Startup()
        if (safe) {
        dc := GetDC()
        winactivate,ahk_class TankWindowClass
        wingetpos,,,w,h,ahk_class TankWindowClass
        }
        else {
        handle := winexist("ahk_class TankWindowClass")
        dc := GetDC(handle)
        winactivate,ahk_id %handle%
        pbmp := Gdip_BitmapFromHWND(handle)
        Gdip_GetDimensions(pbmp, w, h)
        Gdip_DisposeImage(pbmp)
        }
        c_x := (w/2)
        c_y := (h/2)
        s_w := initial_s_w
        s_h := s_w/2
        s_x := (w/2)-(s_w/2)
        s_y := (h/2)-(s_h/2)
        y_off := -initial_s_w*0.125
        if (overlayShow) {
        Gui, 2: +E0x20 -Caption +E0x80000 +LastFound +AlwaysOnTop +ToolWindow +OwnDialogs
        Gui, 2: Show,,Window
        overlay_ID := WinExist()
        overlay_dib := CreateDIBSection(s_w, s_h)
        overlay_dc := CreateCompatibleDC()
        overlay_obm := SelectObject(overlay_dc, overlay_dib)
        G := Gdip_GraphicsFromHDC(overlay_dc)
        overlay_pen := Gdip_CreatePen(Gdip_ToARGB(255,255,0,0), 2)
        Gdip_DrawRectangle(G, overlay_pen, 0, 0, s_w, s_h)
        Gdip_DeletePen(overlay_pen)
        UpdateLayeredWindow(overlay_ID, overlay_dc, s_x, s_y+y_off, s_w, s_h)
        SelectObject(overlay_dc, overlay_obm)
        DeleteObject(overlay_dib)
        DeleteDC(overlay_dc)
        Gdip_DeleteGraphics(G)
        }
        }
        else {
        guicontrol,,runButton,Run
        Gdip_DisposeImage(pbmp)
        Gdip_Shutdown(pToken)
        Gui 2: Destroy
        }
        return
        Gdip_FromARGB(NumGet(Scan0+0, ((10)*4)+((10)*Stride)),A,R,G,B)
        aim:
        if (aimactive) {
        while (GetKeyState(strreplace(a_thishotkey,"~"),"P")) {
        if (!active) {
        active := true
        QPX(True)
        M_Move()
        pbmp := BitmapFromScreen(s_x, s_y+y_off, s_w, s_h,dc)
        M_Move()
        if (alphaSearch)
        E1 := Gdip_LockBits(pbmp, 0, 0, s_w, s_h, Stride, Scan0, BitmapData,1)
        else
        E1 := Gdip_LockBits(pbmp, 0, 0, s_w, s_h, Stride, Scan0, BitmapData,1,0x21808)
        M_Move()
        match := false
        loop % s_h/6 {
        y := (a_index-1)*6
        loop % s_w/6 {
        x := ((a_index-1)*6)
        if (abs((x*y)-(s_w*s_h)/2) < 36) {
        M_Move()
        }
        if (alphaSearch)
        Gdip_FromARGB(NumGet(Scan0+0, (x*4)+(y*Stride)),A,R,G,B)
        else
        Gdip_FromRGB(NumGet(Scan0+0, (x*3)+(y*Stride)),r,g,b)
        if (r > 240 && g < 20 && b < 20) && (b > 0) && (g == 0) {
        n_x := x-3, n_y := y-3
        c:= 0
        loop, 7 {
        if (n_x >= 0 && n_x <= s_w) && (n_y >= 0 && n_y <= s_h) {
        if (alphaSearch)
        Gdip_FromARGB(NumGet(Scan0+0, (n_x*4)+(n_y*Stride)),A,R,G,B)
        else
        Gdip_FromRGB(NumGet(Scan0+0, (n_x*3)+(n_y*Stride)),r,g,b)
        if (r > 240 && g < 20 && b < 20) && (b > 0) && (g == 0)
        c++
        }
        n_x++, n_y++
        }
        if (c == 4 || c == 5) {
        lowest_x := x, lowest_y := y
        t_x := x-30, t_y := y-10
        loop 20 {
        loop 40 {
        if (t_x >= 0 && t_x <= s_w && t_y >= 0 && t_y < s_h) {
        if (alphaSearch)
        Gdip_FromARGB(NumGet(Scan0+0, (t_x*4)+(t_y*Stride)),A,R,G,B)
        else
        Gdip_FromRGB(NumGet(Scan0+0, (t_x*3)+(t_y*Stride)),r,g,b)
        if (r > 240 && g < 20 && b < 20) && (b > 0) && (g == 0) {
        if (t_x < lowest_x) {
        lowest_x := t_x
        }
        if (t_y > lowest_y)
        lowest_y := t_y
        }
        }
        t_x++
        }
        t_x := x-20
        t_y++
        }
        x := lowest_x, y := lowest_y
        if (distance) {
        top_x := x + 6, top_y := y-3
        loop {
        top_y--
        if (top_x >= 0 && top_x <= s_w) && (top_y >= 0 && top_y <= s_h)
        if (alphaSearch)
        Gdip_FromARGB(NumGet(Scan0+0, (top_x*4)+(top_y*Stride)),A,R,G,B)
        else
        Gdip_FromRGB(NumGet(Scan0+0, (top_x*3)+(top_y*Stride)),r,g,b)
        else
        break
        } until (!((r > 200 && g < 100 && b < 100)))
        h_r := 1+((y-top_y)/8)
        screen_x := top_x+s_x, screen_y := (top_y+s_y+y_off)
        mouse_x := (((s_x+x)-c_x)/mouse_div)+(x_offset*h_r)
        mouse_y := (((s_y+y)-c_y)/mouse_div)-(y_offset*h_r)
        }
        else {
        screen_x := x+s_x, screen_y := (y+s_y+y_off)
        mouse_x := (((s_x+x)-c_x)/mouse_div)+x_offset
        mouse_y := (((s_y+y)-c_y)/mouse_div)-y_offset
        }
        if (abs(mouse_x) < s_w || abs(mouse_y) < s_y) {
        s_x -= mouse_x, s_y -= mouse_y
        M_Move(mouse_x,mouse_y)
        }
        match := true
        tt++
        }
        }
        } until (match)
        } until (match)
        if (match) {
        s_w := match_s_w
        s_h := match_s_w/2
        s_x := c_x-mouse_x-(match_s_w/2)-(match_s_w/4), s_y := c_y-mouse_y-(s_h/2)+(match_s_w/8)
        if (overlayShow) {
        overlay_dib := CreateDIBSection(s_w, s_h)
        overlay_dc := CreateCompatibleDC()
        overlay_obm := SelectObject(overlay_dc, overlay_dib)
        G := Gdip_GraphicsFromHDC(overlay_dc)
        overlay_pen := Gdip_CreatePen(Gdip_ToARGB(255,0,255,0), 2)
        Gdip_DrawRectangle(G, overlay_pen, 0, 0, s_w, s_h)
        Gdip_DeletePen(overlay_pen)
        UpdateLayeredWindow(overlay_ID, overlay_dc, s_x, s_y+y_off, s_w, s_h)
        SelectObject(overlay_dc, overlay_obm)
        DeleteObject(overlay_dib)
        DeleteDC(overlay_dc)
        Gdip_DeleteGraphics(G)
        }
        }
        else {
        if (s_w < initial_s_w) {
        s_w += match_s_w/2
        s_h += match_s_w/4
        s_x -= match_s_w/4
        s_y -= match_s_w/8
        }
        else {
        s_x := (w/2)-(s_w/2)
        s_y := (h/2)-(s_h/2)
        p_x := s_x
        p_y := s_y
        }
        if (overlayShow) {
        overlay_dib := CreateDIBSection(s_w, s_h)
        overlay_dc := CreateCompatibleDC()
        overlay_obm := SelectObject(overlay_dc, overlay_dib)
        G := Gdip_GraphicsFromHDC(overlay_dc)
        overlay_pen := Gdip_CreatePen(Gdip_ToARGB(255,255,0,0), 2)
        Gdip_DrawRectangle(G, overlay_pen, 0, 0, s_w, s_h)
        Gdip_DeletePen(overlay_pen)
        UpdateLayeredWindow(overlay_ID, overlay_dc, s_x, s_y+y_off, s_w, s_h)
        SelectObject(overlay_dc, overlay_obm)
        DeleteObject(overlay_dib)
        DeleteDC(overlay_dc)
        Gdip_DeleteGraphics(G)
        }
        }
        Gdip_UnlockBits(pbmp, BitmapData)
        Gdip_DisposeImage(pbmp)
        dur := QPX(false)
        if (dur < 0.016) {
        loop % floor((dur/4)*1000) {
        M_Move()
        delay(0.004)
        }
        }
        active := false
        }
        }
        }
        return
        M_Move(in_x=0, in_y=0) {
        static x,y,chunk_x,chunk_y,force_vector
        if (in_x || in_y) {
        x += in_x
        y += in_y
        chunk_x := x/5
        chunk_y := y/5
        }
        if (x <= -1 || x >= 1) || (y <= -1 || y >= 1) {
        x -= chunk_x, y -= chunk_y
        DllCall("mouse_event", "UInt", 0x01, "UInt", chunk_x, "UInt", chunk_y)
        }
        }
        BitmapFromScreen(s_x,s_y,s_w,s_h,dc) {
        chdc := CreateCompatibleDC(dc), hbm := CreateDIBSection(s_w, s_h, chdc), obm := SelectObject(chdc, hbm)
        BitBlt(chdc, 0, 0, s_w, s_h, dc, s_x, s_y)
        pbmp := Gdip_CreateBitmapFromHBITMAP(hbm)
        SelectObject(chdc, obm), DeleteObject(hbm), DeleteDC(chdc)
        return pbmp
        }
        Gdip_FromRGB(RGB, ByRef R, ByRef G, ByRef B)
        {
        R := (0x00ff0000 & RGB) >> 16
        G := (0x0000ff00 & RGB) >> 8
        B := 0x000000ff & RGB
        }
        Get_RGBBitPixel(Scan0,x,y,Stride) {
        f := Gdip_GetLockBitPixel(Scan0, x, y, Stride)
        return f
        }
        Delay( D=0.001 ) {
        Static F
        Critical
        F ? F : DllCall( "QueryPerformanceFrequency", Int64P,F )
        DllCall( "QueryPerformanceCounter", Int64P,pTick ), cTick := pTick
        While( ( (Tick:=(pTick-cTick)/F)) <D ) {
        DllCall( "QueryPerformanceCounter", Int64P,pTick )
        Sleep -1
        }
        Return Round( Tick,3 )
        }
        QPX( N=0 ) {
        Static F,A,Q,P,X
        If	( N && !P )
        Return	DllCall("QueryPerformanceFrequency",Int64P,F) + (X:=A:=0) + DllCall("QueryPerformanceCounter",Int64P,P)
        DllCall("QueryPerformanceCounter",Int64P,Q), A:=A+Q-P, P:=Q, X:=X+1
        Return	( N && X=N ) ? (X:=X-1)<<64 : ( N=0 && (R:=A/X/F) ) ? ( R + (A:=P:=X:=0) ) : 1
        }
        rshift::
        GuiClose:
        gui,submit
        iniwrite,% _l,settings.ini,hotkeys,lbutton
        iniwrite,% _r,settings.ini,hotkeys,rbutton
        iniwrite,% mouse_div,settings.ini,settings,sensitivity
        iniwrite,% safe,settings.ini,settings,safe
        iniwrite,% distance,settings.ini,settings,distance
        iniwrite,% initial_s_w,settings.ini,settings,initial_search_width
        iniwrite,% match_s_w,settings.ini,settings,match_search_width
        iniwrite,% x_offset,settings.ini,settings,static_x_offset
        iniwrite,% y_offset,settings.ini,settings,static_y_offset
        iniwrite,% overlayShow,settings.ini,settings,overlayShow
        iniwrite,% overlayShow,settings.ini,settings,alphaSearch
        Gdip_DisposeImage(pbmp)
        Gdip_Shutdown(pToken)
        ExitApp
    =========

    Widowmaker Auto Shot

    Code:
        RButton::Pause
        ~$LButton::
            While GetKeyState("LButton", "P"){
         
        Click down
        Sleep, 100
        Click up
        Sleep, 1350
        }
        return
         
        Numpad0::ExitApp
    =======

    McCree Right Click control

    Code:
        SendMode Input
         
         
        Numpad0::ExitApp
         
        ~RButton::
        Loop
            If GetKeyState("RButton") {
                Sleep, 5
                moveAmount := (moveAmount = 2) ? 3 : 0
                mouseXY(moveAmount,3.4)
               
            }
            else
            break
           
        Return
         
         
         
        mouseXY(x,y)
        {
        DllCall("mouse_event",int,1,int,x,int,y,uint,0,uint,0)
        }
    ======
    Reinhardt faster melee updated by Stinkyjoint
    Click here to give him +rep
    Code:
        ~$LButton::
            While GetKeyState("LButton", "P"){
         
        Click
        sleep 650
        Click right down
        sleep 200
        Click right up
        sleep 300
         
        }
        return
         
        Numpad0::ExitApp
    =========

    Soldier76 Nospread updated

    Code:
    LAlt::Pause
    ~$LButton::
    While GetKeyState("LButton", "P"){
    
    Click down
    Sleep, 450
    Click up
    Sleep, 215
    }
    return
    
    Numpad0::ExitApp
    =========

    Reaper faster reload

    Code:
        $r:: ; reload key
        {
        send {r} ; reload key
        sleep 300 ; 300 is the delay in ms
        send {v} ; your melee key
        }
        return
         
        Numpad0::suspend ; pause the script
    =============
    Pharah Faster reload
    By Stinkyjoint - Click here to give him +rep
    Code:
    $r:: ; reload key
    	send {r} ; reload key
    	sleep 1400 ; delay
    	send {v} ; melee key
    return
         
    Numpad0::suspend ; suspend the script
    Numpad2::ExitApp  ; panic ends the script
    =============
    Torbjorn Faster reload
    By Stinkyjoint - Click here to give him +rep
    Code:
    $r:: ; reload key
    	send {r} ; reload key
    	sleep 1780 ; delay
    	send {v} ; melee key
    return
         
    Numpad0::suspend ; suspend the script
    Numpad2::ExitApp  ; panic ends the script
    =============
    Roadhog Faster reload
    By Stinkyjoint - Click here to give him +rep
    Code:
    $r:: ; reload key
    	send {r} ; reload key
    	sleep 1880 ; delay
    	send {v} ; your melee key
    return
         
    Numpad0::suspend ; suspend the script
    Numpad2::ExitApp  ; panic ends the script
    ==========
    Genji 175 DMG Combo shared by Bahrein
    Click here to +rep Bahrein
    Not sure about this one but sometimes it won't do full damage. You have to be really close
    Code:
    xbutton2::
    MouseClick, right
    sleep, 15
    Send {v down}{v up}
    sleep, 15
    Send {Shift down}{Shift up}
    Return
    ========
    Korean Triggerbot
    Creator said it's a bit slow and not perfect, but it's still faster than human reaction
    Code:
    loop
    {
    ImageSearch, , , 960, 0, 960, 540, *100 1.png
    If Errorlevel = 0
    ImageSearch, , , 960, 541, 960, 1080, *100 1.png
    If Errorlevel = 0
    mouseclick, left
    
    }
    return
    You need this image in the folder
    Right click + save

    =============

    Rapid fire
    Code:
    !MButton:: Hotkey, *MButton, Toggle
    *~MButton::
    Loop
    {
    SetMouseDelay 10
    Click
    If (GetKeyState("MButton","P*")=0)
    break
    }
    return
    ==========

    Bunny hop

    Code:
    F1:: Hotkey, *space, Toggle
    *~$Space::
    sleep 20
    loop
    {
    GetKeyState, SpaceState, Space, P
    if SpaceState = U
    break
    Sleep 1
    Send, {Blind}{Space}
    }
    return
    My idea is to add button presses (QWE) for strafing.

    ========
    These two aren't ahk, but should be interesting for other developers

    Multi hack Code 1
    Code:
    #include-once
    #include <WindowsConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <Misc.au3>
    #include <WinAPI.au3>
    #include "FastFind.au3"
    #include <Array.au3>
    #include <Color.au3>
    #include <WinAPIGdi.au3>
     
    Opt('MouseCoordMode', 2)
    Opt('PixelCoordMode', 2)
     
    Global $SettingHitChance = .60
    Global $SettingTriggerRadarSize = 18
    Global $ShowRadar = 1
     
    ;HotKeys
    HotKeySet("{HOME}", "Stop")
    HotKeySet("{END}", "Pause")
    HotKeySet("{DELETE}", "SwitchAimMode")
     
    ;Main FORM
    Global $frmBot, $mFile, $mClose, $mOptions, $mSettings, $mAutoUpdate, $mDrawDebug, $lblHitChance, $lblStatus, $lblfrmTriggerBot, $lblfrmAimBot, $lblHelpMsg1, $lblHelpMsg2, $lblHelpMsg3
    Global $Interations = 0
    ;Settings FORM
    Global $SettingsGUI, $tabSettings, $tsBotSettings, $grpBotSettings, $cbAutoRun, $lblWindowClass, $lblAimKey, $lblTriggerAimKey, $txtWindowClass, $txtAimKey, $txtTriggerAimKey
    Global $tsPixelSettings, $grpPixelSettings, $txtSearchAreaSize, $txtShadeVariation, $txtMinPureColors, $txtMaxShades, $lblSearchAreaSize, $lblShadeVariation, $lblMinPureColors, $lblMaxShades, $lblSearchColors, $editSearchColors
    Global $btnSave, $grpEnable, $cbAimBot, $cbTriggerBot, $txtAimShootAreaSize, $txtAimBotStepSize,  $txtTriggerScanSize, $lblAimBotStepSize, $lblAimShootAreaSize, $lblTriggerScanSize
     
    Global $SettingAimMode
    Global $SettingTriggerScanSize, $SettingTriggerBot, $SettingTriggerAimKey
    Global $SettingAimShootAreaSize, $SettingAimBot, $SettingAimKey, $SettingAutoShoot, $SettingAimBotStepSize
    Global $SettingSearchAreaSize, $SettingShadeVariation, $SettingMinPureColors, $SettingMaxShades, $SettingMaxR, $SettingMaxG, $SettingMaxB, $SettingMinR, $SettingMinG, $SettingMinB
    Global $SettingDrawDebug, $SettingWindowClass, $SettingAutoRun, $SettingAutoUpdate
    Global $WindowHandle, $CurrentCoord, $VersionsInfo, $Version, $OldVersion, $NewVersion, $GUITitle, $DebugGUIs[7]
    Global $X_Ratio, $Y_Ratio, $MiddleX, $MiddleY, $Size
    Global $SearchAreaSizeX, $AimShootAreaSizeX, $SearchAreaSizeY, $AimShootAreaSizeY
    Global $SearchAreaQuads[4][7]
    Global $SearchAreaPoints[4]
    Global $AimShootAreaPoints[4]
    Global $LoopTimeArray = []
    Global $SettingsPath = "Settings.ini"
    Global $DebugGUI
    Global $UnitTable = []
     
     
    ;***************************************************MODIFY IF YOU WANT***************************************************************
    ;AIMBOT $ TRIGGERBOT SETTINGS
    Global $SettingAimMode = 0 ;0 = Triggerbot and aimbot ON,1 = Triggerbot ON,2 = Aimbot ON
     
    ;Triggerbot
    $SettingTriggerScanSize = 45
    $SettingTriggerBot = 0
    $SettingTriggerAimKey = ""
     
    ;Aimbot
    $SettingAimShootAreaSize = 5
    $SettingAimBot = 1
    $SettingAimKey = "01"
    $SettingAutoShoot = 0
    $SettingAimBotStepSize = 5 ;Lower the value = slower aimbot, higher equal faster aimbot
     
    ;Pixel Search settings
    $SettingSearchAreaSize = 100
    Global $SettingSearchColors[13] = [0xF2361B, 0xEF3519, 0xEE4131, 0xED4233, 0xEE4031, 0xCF8790, 0xCF878F, 0xD92411, 0xDC2613, 0xA24D53, 0xA84547, 0xB25C62, 0xAB545B] ;Color to search for, hex!
    $SettingShadeVariation = 10
    $SettingMinPureColors = 13
    $SettingMaxShades = 25
     
    $SettingMaxR = 242
    $SettingMaxG = 135
    $SettingMaxB = 144
    $SettingMinR = 162
    $SettingMinG = 36
    $SettingMinB = 17
     
     
     
    ;DrawDebug
    $SettingDrawDebug = 0
     
    ;Game Handle Name
    $SettingWindowClass = "[CLASS:TankWindowClass]"
     
    ;Bot Settings
    $SettingAutoRun = 1
    $SettingAutoUpdate = 1
    ;***************************************************MODIFY IF YOU WANT***************************************************************
     
    ;Used by Bot Settings
    $CurrentCoord = ""
    $VersionsInfo = "http://bit.ly/1O7cfqX"
    $Version = "1.63"
    $OldVersion = IniRead("updater.ini", "Version", "Version", $Version)
    $NewVersion = "0.0"
    $GUITitle = GetTitle()
     
    ;ShellExecute("http://www.ownedcore.com/forums/reputation.php?do=addreputation&p=3435059")
     
    RefreshSettings()
     
    If $SettingAutoUpdate = 1 Then DoUpdate()
    MainGUI()
     
    Func MainGUI()
        $frmBot = GUICreate($GUITitle & $Version & " - Updating", 270, 165, 0, 0, -1, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW), 0)
        GUISetBkColor(0xC0C0C0)
        $mFile = GUICtrlCreateMenu("File")
        $mClose = GUICtrlCreateMenuItem("Exit", $mFile)
        $mOptions = GUICtrlCreateMenu("Options")
        $mSettings = GUICtrlCreateMenuItem("Settings", $mOptions)
        $mAutoUpdate = GUICtrlCreateMenuItem("Auto Update", $mOptions)
        GUISetCheck($mAutoUpdate, $SettingAutoUpdate)
        $mDrawDebug = GUICtrlCreateMenuItem("Draw Debug", $mOptions)
        GUISetCheck($mDrawDebug, $SettingDrawDebug)
        $lblHitChance = GUICtrlCreateLabel("HitChance: 0%", 4, 0, 280, 24)
        GUICtrlSetFont(-1, 10, 600, 0, "Segoe UI")
        GUICtrlSetColor(-1, 0x330000)
        $lblStatus = GUICtrlCreateLabel("Average Loop Time: 0", 4, 20, 250, 17)
        GUICtrlSetFont(-1, 10, 600, 0, "Segoe UI")
        GUICtrlSetColor(-1, 0x330000)
        $lblfrmTriggerBot = GUICtrlCreateLabel("Trigger Bot: " & GetTriggerBotState(), 4, 40, 250, 17)
        GUICtrlSetFont(-1, 10, 600, 0, "Segoe UI")
        GUICtrlSetColor(-1, 0x330000)
        $lblfrmAimBot = GUICtrlCreateLabel("Aim Bot: " & GetAimBotState(), 4, 60, 250, 17)
        GUICtrlSetFont(-1, 10, 600, 0, "Segoe UI")
        GUICtrlSetColor(-1, 0x330000)
        $lblHelpMsg1 = GUICtrlCreateLabel("Press DELETE to change aim modes", 4, 80, 250, 17)
        GUICtrlSetFont(-1, 10, 600, 0, "Segoe UI")
        GUICtrlSetColor(-1, 0xFF0000)
        $lblHelpMsg2 = GUICtrlCreateLabel("Press END to pause", 4, 100, 250, 17)
        GUICtrlSetFont(-1, 10, 600, 0, "Segoe UI")
        GUICtrlSetColor(-1, 0xFF0000)
        $lblHelpMsg3 = GUICtrlCreateLabel("Press HOME to end", 4, 120, 250, 17)
        GUICtrlSetFont(-1, 10, 600, 0, "Segoe UI")
        GUICtrlSetColor(-1, 0xFF0000)
        GUISetState()
        UpdateGUIAimMode()
     
        While 1
            $aMsg = GUIGetMsg(1) ; Use advanced parameter to get array
            Switch $aMsg[1] ; check which GUI sent the message
                Case $frmBot
                    Switch $aMsg[0]
                        Case $mSettings
                            GUICtrlSetState($mSettings, $GUI_DISABLE)
                            SettingsGUI()
                        Case $mClose
                            Exit
                        Case $mDrawDebug
                            If IsChecked($mDrawDebug) Then
                                RemoveDebugGUI()
                                GUICtrlSetState($mDrawDebug, $GUI_UNCHECKED)
                            Else
                                DrawDebugGUI()
                                GUICtrlSetState($mDrawDebug, $GUI_CHECKED)
                            EndIf
                            IniWrite($SettingsPath, "BotSettings", "DrawDebug", ConvertFlag($mDrawDebug))
                        Case $mAutoUpdate
                            If IsChecked($mAutoUpdate) Then
                                GUICtrlSetState($mAutoUpdate, $GUI_UNCHECKED)
                            Else
                                GUICtrlSetState($mAutoUpdate, $GUI_CHECKED)
                            EndIf
                            IniWrite($SettingsPath, "BotSettings", "AutoUpdate", ConvertFlag($mAutoUpdate))
                    EndSwitch
                Case $SettingsGUI
                    Switch $aMsg[0] ; Now check for the messages for $hGUI2
                        ;BOT SETTINGS
                        Case $cbAutoRun
                            If IsChecked($cbAutoRun) Then GUICtrlSetState($cbAutoRun, $GUI_CHECKED)
                        ;AIM BOT
                        Case $cbAimBot
                            If IsChecked($cbAimBot) Then GUICtrlSetState($cbAimBot, $GUI_CHECKED)
                        ;TRIGGER BOT
                        Case $cbTriggerBot
                            If IsChecked($cbTriggerBot) Then GUICtrlSetState($cbTriggerBot, $GUI_CHECKED)
                        Case $btnSave
                            SaveINI()
                            RefreshSettings()
                            GUIDelete($SettingsGUI)
                            GUICtrlSetState($mSettings, $GUI_ENABLE)
                            UpdateGUIAimMode()
                    EndSwitch
            EndSwitch
     
            RunBot()
        WEnd
    EndFunc   ;==>MainGUI
     
    Func SettingsGUI()
        $SettingsGUI = GUICreate($GUITitle & $Version, 459, 198, 0, 0, -1, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW), 0)
        GUISetIcon(@ScriptDir & "\Setting-icon.ico")
        $tabSettings = GUICtrlCreateTab(8, 8, 281, 153)
        GUICtrlSetResizing($SettingsGUI, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
        $tsBotSettings = GUICtrlCreateTabItem("Pixel Bot")
        $grpBotSettings = GUICtrlCreateGroup("", 12, 33, 273, 121)
        $cbAutoRun = GUICtrlCreateCheckbox("Auto Run", 20, 49, 73, 17)
     
        $lblWindowClass = GUICtrlCreateLabel("Game Handle:", 20, 77, 93, 17)
        $lblAimKey = GUICtrlCreateLabel("Aimbot Key:", 20, 102, 93, 17)
        $lblTriggerAimKey = GUICtrlCreateLabel("Triggerbot Key:", 20, 127, 93, 17)
        $txtWindowClass = GUICtrlCreateInput($SettingWindowClass, 116, 75, 105, 21)
        $txtAimKey = GUICtrlCreateInput($SettingAimKey, 116, 100, 105, 21)
        $txtTriggerAimKey = GUICtrlCreateInput($SettingTriggerAimKey, 116, 125, 105, 21)
     
        GUICtrlCreateGroup("", -99, -99, 1, 1)
        $tsPixelSettings = GUICtrlCreateTabItem("Pixel Search")
        $grpPixelSettings = GUICtrlCreateGroup("Settings", 12, 33, 273, 121)
        $txtSearchAreaSize = GUICtrlCreateInput($SettingSearchAreaSize, 86, 49, 55, 21)
        $txtShadeVariation = GUICtrlCreateInput($SettingShadeVariation, 86, 73, 55, 21)
        $txtMinPureColors = GUICtrlCreateInput($SettingMinPureColors, 86, 97, 55, 21)
        $txtMaxShades = GUICtrlCreateInput($SettingMaxShades, 86, 121, 55, 21)
        $lblSearchAreaSize = GUICtrlCreateLabel("Area Size:", 20, 52, 65, 17)
        $lblShadeVariation = GUICtrlCreateLabel("Varations:", 20, 76, 65, 17)
        $lblMinPureColors = GUICtrlCreateLabel("Min Colors:", 20, 100, 65, 17)
        $lblMaxShades = GUICtrlCreateLabel("Max Shades:", 20, 124, 65, 17)
        $lblSearchColors = GUICtrlCreateLabel("Search Colors:", 148, 52, 80, 35)
        $editSearchColors = GUICtrlCreateEdit(SearchColorsToString($SettingSearchColors), 148, 73, 121, 65)
     
        GUICtrlCreateGroup("", -99, -99, 1, 1)
        GUICtrlCreateTabItem("")
        $btnSave = GUICtrlCreateButton("Save", 368, 168, 75, 25, 0)
        $grpEnable = GUICtrlCreateGroup("Enable", 296, 24, 161, 137)
        $cbAimBot = GUICtrlCreateCheckbox("Aimbot Enabled", 312, 41, 100, 17)
        $lblAimShootAreaSize = GUICtrlCreateLabel("Aimbot Area:", 312, 65, 93, 17)
        $txtAimShootAreaSize = GUICtrlCreateInput($SettingAimShootAreaSize, 392, 62, 55, 21)
        $lblAimBotStepSize = GUICtrlCreateLabel("Step Size:", 312, 89, 93, 17)
        $txtAimBotStepSize = GUICtrlCreateInput($SettingAimBotStepSize, 392, 86, 55, 21)
        $cbTriggerBot = GUICtrlCreateCheckbox("Triggerbot Enabled", 312, 115, 100, 17)
        $lblTriggerScanSize = GUICtrlCreateLabel("Trigger Area:", 312, 139, 93, 17)
        $txtTriggerScanSize = GUICtrlCreateInput($SettingTriggerScanSize, 392, 136, 55, 21)
     
        GUICtrlCreateGroup("", -99, -99, 1, 1)
        GUISetState()
        UpdateGUI()
    EndFunc   ;==>SettingsGUI
     
    Func DrawDebugGUI()
        $DebugGUI = GUICreate("", 1920, 1080, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TRANSPARENT)))
        GUISetBkColor(0xABCDEF)
        _WinAPI_SetLayeredWindowAttributes($DebugGUI, 0xABCDEF, 0xA0)
        GUISetState()
     
        Local $QuadOne[4] = [$SearchAreaQuads[0][0], $SearchAreaQuads[0][1], $SearchAreaQuads[0][2], $SearchAreaQuads[0][3]]
        Local $QuadTwo[4] = [$SearchAreaQuads[1][0], $SearchAreaQuads[1][1], $SearchAreaQuads[1][2], $SearchAreaQuads[1][3]]
        Local $QuadThree[4] = [$SearchAreaQuads[2][0], $SearchAreaQuads[2][1], $SearchAreaQuads[2][2], $SearchAreaQuads[2][3]]
        Local $QuadFour[4] = [$SearchAreaQuads[3][0], $SearchAreaQuads[3][1], $SearchAreaQuads[3][2], $SearchAreaQuads[3][3]]
     
        DrawSearchAreaGUI($DebugGUI, $QuadOne, 0x66FF33)
        DrawSearchAreaGUI($DebugGUI, $QuadTwo, 0x66FF33)
        DrawSearchAreaGUI($DebugGUI, $QuadThree, 0x66FF33)
        DrawSearchAreaGUI($DebugGUI, $QuadFour, 0x66FF33)
        DrawSearchAreaGUI($DebugGUI, $SearchAreaPoints, 0xFF0000)
        DrawSearchAreaGUI($DebugGUI, $AimShootAreaPoints, 0xFF0000)
     
        If $ShowRadar = 1 Then
            $hDC = _WinAPI_GetWindowDC($DebugGUI)
            $hPen = _WinAPI_CreatePen($PS_SOLID, 2, 0xFF69B4)
            $obj_orig = _WinAPI_SelectObject($hDC, $hPen)
     
            For $dir = 0 To $SettingTriggerRadarSize
                _WinAPI_DrawLine($hDC, $MiddleX, $MiddleY, $UnitTable[$dir][0],  $UnitTable[$dir][1])
            Next
        EndIf
    EndFunc
     
    Func RemoveDebugGUI()
        GUIDelete($DebugGUI)
    EndFunc
     
    Func RunBot()
        If $SettingAutoRun And WinGetState($WindowHandle) = 15 Then
            Local $BeginTime
            $BeginTime = TimerInit()
     
            FFSnapShot($SearchAreaPoints[0], $SearchAreaPoints[1], $SearchAreaPoints[2], $SearchAreaPoints[3])
     
            If $SettingAimBot = 1 And $SettingTriggerBot = 1 Then
                AimBot()
                TriggerBot()
            ElseIf $SettingTriggerBot = 1 Then
                TriggerBot()
            ElseIf $SettingAimBot = 1 Then
                AimBot()
            EndIf
     
            UpdateAverageTime($BeginTime)
            $CurrentCoord = ""
        EndIf
    EndFunc
     
    Func GetAverageTime()
        Local $Time, $TimeSum, $TimeCount = UBound($LoopTimeArray)
     
        For $Time In $LoopTimeArray
            $TimeSum = $TimeSum + $Time
        Next
     
        Return Round($TimeSum / $TimeCount)
    EndFunc   ;==>GetAverageTime
     
    Func TriggerBot()
        If _IsPressed("01") Then Return
     
        If $SettingTriggerAimKey = "" Then
            ActionTrigger()
        ElseIf _IsPressed($SettingTriggerAimKey) Then
            ActionTrigger()
        EndIf
    EndFunc   ;==>TriggerBot
     
    Func AimBot()
        If $SettingAimKey = "" Then
            ActionAim()
        ElseIf _IsPressed($SettingAimKey) Then
            ActionAim()
        EndIf
    EndFunc   ;==>AimBot
     
    Func ActionTrigger()
        Local $TriggerPixelSearch = TriggerPixelSearch()
        If $TriggerPixelSearch > $SettingHitChance Then
            ActionShoot()
        EndIf
    EndFunc   ;==>ActionTrigger
     
    Func ActionAim()
        If $CurrentCoord = "" Then $CurrentCoord = SearchPixel()
        If IsArray($CurrentCoord) = 0 Then Return False
        If ActionMoveMouse($CurrentCoord) Then
            If $SettingAutoShoot And IsWithinBounds($CurrentCoord, $AimShootAreaPoints) Then ActionShoot()
        EndIf
     
    EndFunc   ;==>ActionAim
     
    Func ActionShoot()
        _MouseClickFast2("left")
    EndFunc   ;==>ActionShoot
     
    Func ActionMoveMouse($Coord)
        Local $MoveToX = ($Coord[0] - $MiddleX)
        Local $MoveToY = ($Coord[1] - $MiddleY)
     
        If $MoveToX Then
            If Abs($MoveToX) < $SettingAimBotStepSize Then
                $Moving = $MoveToX
            Else
                $Moving = $SettingAimBotStepSize * $X_Ratio
                If ($MoveToX) < 0 Then $Moving *= -1
            EndIf
            _MouseMovePlus($Moving, 0)
        EndIf
     
     
        If $MoveToY Then
            If Abs($MoveToY) < $SettingAimBotStepSize Then
                $Moving = $MoveToY
            Else
                $Moving = $SettingAimBotStepSize * $Y_Ratio
                If ($MoveToY) < 0 Then $Moving *= -1
            EndIf
            _MouseMovePlus(0, $Moving)
        EndIf
     
        Return True
    EndFunc   ;==>ActionMoveMouse
     
    Func IsWithinBounds($Coord, $AreaPoints)
        Local $IsWithinBounds = $Coord[0] >= $AreaPoints[0] And $Coord[0] <= $AreaPoints[2] And $Coord[1] >= $AreaPoints[1] And $Coord[1] <= $AreaPoints[3]
        Return $IsWithinBounds
    EndFunc   ;==>IsWithinBounds
     
    Func _MouseMovePlus($x, $y)
        DllCall("user32.dll", "none", "mouse_event", "long", 1, "long", $x, "long", $y, "long", 0, "long", 0)
    EndFunc   ;==>_MouseMovePlus
     
    Func _MouseClickFast2($x = 0, $y = 0, $User32 = "User32.dll")
        DllCall($User32, "none", "mouse_event", "long", 2, "long", $x, "long", $y, "long", 0, "long", 0) ; 32770 0x8002 BitOR($MOUSEEVENTF_ABSOLUTE, $MOUSEEVENTF_LEFTDOWN)
        DllCall($User32, "none", "mouse_event", "long", 4, "long", $x, "long", $y, "long", 0, "long", 0) ; 32772 0x8004 BitOR($MOUSEEVENTF_ABSOLUTE, $MOUSEEVENTF_LEFTUP)
    EndFunc   ;==>_MouseClickFast2
     
    Func SearchPixel()
        Local $FoundPoints[4]
        $FoundPoints[0] = FFBestSpot($SearchAreaQuads[0][6], $SettingMinPureColors, $SettingMaxShades, $SearchAreaQuads[0][4], $SearchAreaQuads[0][5], -1, $SettingShadeVariation, False, $SearchAreaQuads[0][0], $SearchAreaQuads[0][1], $SearchAreaQuads[0][2], $SearchAreaQuads[0][3]) ;top left
        $FoundPoints[1] = FFBestSpot($SearchAreaQuads[1][6], $SettingMinPureColors, $SettingMaxShades, $SearchAreaQuads[1][4], $SearchAreaQuads[1][5], -1, $SettingShadeVariation, False, $SearchAreaQuads[1][0], $SearchAreaQuads[1][1], $SearchAreaQuads[1][2], $SearchAreaQuads[1][3]) ;bottom right
        $FoundPoints[2] = FFBestSpot($SearchAreaQuads[2][6], $SettingMinPureColors, $SettingMaxShades, $SearchAreaQuads[2][4], $SearchAreaQuads[2][5], -1, $SettingShadeVariation, False, $SearchAreaQuads[2][0], $SearchAreaQuads[2][1], $SearchAreaQuads[2][2], $SearchAreaQuads[2][3]) ;bottom left
        $FoundPoints[3] = FFBestSpot($SearchAreaQuads[3][6], $SettingMinPureColors, $SettingMaxShades, $SearchAreaQuads[3][4], $SearchAreaQuads[3][5], -1, $SettingShadeVariation, False, $SearchAreaQuads[3][0], $SearchAreaQuads[3][1], $SearchAreaQuads[3][2], $SearchAreaQuads[3][3]) ; top right
     
        Local $midX = 0
        Local $midY = 0
        Local $Count = 0
     
        For $Point In $FoundPoints
            If IsArray($Point) = 1 Then
                $Count += 1
                $midX += $Point[0]
                $midY += $Point[1]
            EndIf
        Next
     
        If $midX = 0 Or $midY = 0 Then Return
     
        $midX = Round($midX / $Count)
        $midY = Round($midY / $Count - 4)
     
        Local $midCoords[2] = [$midX, $midY]
     
        Return $midCoords
    EndFunc   ;==>SearchPixel
     
     
    Func TriggerPixelSearch()
        Local $OpenCount = 0
        Local $ClosedCount = 0
        Local $AvgDistance = 0
        Local $pct = 0
        For $dir = 0 To $SettingTriggerRadarSize
            $result = lineTest($MiddleX, $MiddleY, $UnitTable[$dir][0], $UnitTable[$dir][1])
     
            If IsArray($result) = 0 Then
                $OpenCount += 1
            Else
                If Sqrt(($MiddleX-$result[0])^2+($MiddleY-$result[1])^2) > 7 Then $ClosedCount += 1
            EndIf
        Next
        If $ClosedCount > 0 Then
            $pct = $ClosedCount / $SettingTriggerRadarSize
        EndIf
        UpdateGUIHitChance(Round($pct*100,2))
        Return $pct
    EndFunc
     
     
    Func lineTest($x1,$y1,$x2,$y2)
        ;Define differences and error check
        $dx = Abs($x2 - $x1)
        $dy = Abs($y2 - $y1)
        $sx = ($x1 < $x2) ? 1 : -1
        $sy = ($y1 < $y2) ? 1 : -1
        $err = $dx - $dy
     
        ;Main loop
        While (Not ($x1 = $x2 And $y1 = $y2))
            $result = IsCorrectShade($x1,$y1)
     
            If IsArray($result) = 1 Then
                Return $result
            EndIf
     
            $e2 = BitShift($err, -1)
     
            If $e2 > -$dy Then
                $err -= $dy
                $x1 += $sx
            EndIf
            If $e2 < $dx Then
                $err += $dx
                $y1 += $sy
            EndIf
        WEnd
    EndFunc
     
    Func IsCorrectShade($x0, $y0)
        $color = _ColorGetRGB(FFGetPixel($x0,$y0))
        If IsArray($color) = 1 Then
            $r = $color[0]
            $g = $color[1]
            $b = $color[2]
            If $r >= $SettingMinR  And $r <= $SettingMaxR Then
               If $g >= $SettingMinG  And $g <= $SettingMaxG Then
                    If $b >= $SettingMinB  And $b <= $SettingMaxB  Then
     
                        Local $Result[2]
                        $Result[0] = $x0
                        $Result[1] = $y0
                        Return $Result
                    EndIf
                EndIf
            EndIf
        EndIf
     
        Return 0
    EndFunc
     
    Func DrawSearchAreaGUI($GUI, $Points, $Color, $comment = "")
        Local $DrawAreaWidth = $Points[2] - $Points[0]
        Local $DrawAreaHeight = $Points[3] - $Points[1]
     
        $hDC = _WinAPI_GetWindowDC($GUI)
        $hPen = _WinAPI_CreatePen($PS_SOLID, 2, $Color)
        $obj_orig = _WinAPI_SelectObject($hDC, $hPen)
     
        _WinAPI_DrawLine($hDC, $Points[0], $Points[1], $Points[0] + $DrawAreaWidth, $Points[1])
        _WinAPI_DrawLine($hDC, $Points[0], $Points[1], $Points[0],  $Points[1] + $DrawAreaHeight)
        _WinAPI_DrawLine($hDC, $Points[0], $Points[1] + $DrawAreaHeight, $Points[0] + $DrawAreaWidth, $Points[1] + $DrawAreaHeight)
        _WinAPI_DrawLine($hDC, $Points[0] + $DrawAreaWidth, $Points[1] + $DrawAreaHeight, $Points[0] + $DrawAreaWidth, $Points[1])
     
        _WinAPI_SetTextColor($hDC, 0x000000)
        _WinAPI_SetBkMode($hDC, $TRANSPARENT)
     
        $tRECT = DllStructCreate($tagRect)
        DllStructSetData($tRECT, "Left", $Points[0])
        DllStructSetData($tRECT, "Top", $Points[1])
        DllStructSetData($tRECT, "Right", $Points[0]+50)
        DllStructSetData($tRECT, "Bottom", $Points[1]+50)
        _WinAPI_DrawText($hDC, $comment, $tRECT, 1)
     
        WinSetOnTop($GUI, "", 1)
    EndFunc   ;==>DrawSearchAreaGUI
     
    ;hotkey functions
    Func Pause()
        $SettingAutoRun = Not $SettingAutoRun
        UpdateGUIStatus()
    EndFunc   ;==>Pause
     
    ;0 = Triggerbot and aimbot ON,1 = Triggerbot ON,2 = Aimbot ON
    Func SwitchAimMode()
        If $SettingAimMode = 2 Then
            $SettingAimMode = 0
        Else
            $SettingAimMode = $SettingAimMode + 1
        EndIf
     
        If $SettingAimMode = 0 Then
            $SettingTriggerBot = 1
            $SettingAimBot = 1
        ElseIf $SettingAimMode = 1 Then
            $SettingTriggerBot = 1
            $SettingAimBot = 0
        ElseIf $SettingAimMode = 2 Then
            $SettingTriggerBot = 0
            $SettingAimBot = 1
        EndIf
     
        UpdateGUIAimMode()
    EndFunc   ;==>SwitchAimMode
     
    Func Stop()
        Exit
    EndFunc   ;==>Stop
     
    Func UpdateGUIStatus($Time = "0ms")
        If $SettingAutoRun = 1 Then
            GUICtrlSetData($lblStatus, "Average Loop Time:  " & $Time)
        Else
            GUICtrlSetData($lblStatus, "Average Loop Time:  Paused")
        EndIf
    EndFunc   ;==>UpdateGUIStatus
     
    Func UpdateAverageTime($BeginTime)
        Local $EndTime = TimerDiff($BeginTime)
     
        _ArrayAdd($LoopTimeArray, Round($EndTime))
     
        If UBound($LoopTimeArray) >= 25 Then
            Local $AverageTime = GetAverageTime()
            UpdateGUIStatus($AverageTime & "ms")
            ReDim $LoopTimeArray[0]
            _ArrayAdd($LoopTimeArray, $AverageTime)
        EndIf
    EndFunc   ;==>UpdateAverageTime
     
    Func UpdateGUIHitChance($pct)
        GUICtrlSetData($lblHitChance, "HitChance: " & $pct & " %")
    EndFunc   ;==>UpdateGUIPixel
     
    Func UpdateGUIAimMode()
        GUICtrlSetData($lblfrmTriggerBot, "Trigger Bot: " & GetTriggerBotState())
        GUICtrlSetData($lblfrmAimBot, "Aim Bot: " & GetAimBotState())
    EndFunc   ;==>UpdateGUIAimMode
     
    Func GetAimBotState()
        If $SettingAimBot = 0 Then Return "OFF"
        If $SettingAimKey = "" Then
            Return "Auto"
        Else
            Return GetFriendlyKeyName($SettingAimKey)
        EndIf
    EndFunc   ;==>GetAimBotState
     
    Func GetTriggerBotState()
        If $SettingTriggerBot = 0 Then Return "OFF"
        If $SettingTriggerAimKey = "" Then
            Return "Auto"
        Else
            Return GetFriendlyKeyName($SettingTriggerAimKey)
        EndIf
    EndFunc   ;==>GetTriggerBotState
     
    ;GUI Title Bar
    Func GetTitle()
        Local $Title = ""
        For $i = 0 To Random(0, 7, 1)
            $Title &= Chr(Random(97, 122, 1))
        Next
        For $i = 0 To Random(5, 10, 1)
            $Title &= Chr(Random(65, 90, 1))
        Next
        Return $Title
    EndFunc   ;==>GetTitle
     
    Func UpdateGUI()
        ;Game Handle Name
        GUIUpdate($txtWindowClass, $SettingWindowClass)
     
        ;Bot Settings
        GUISetCheck($cbAutoRun, $SettingAutoRun)
     
        ;Triggerbot
        GUISetCheck($cbTriggerBot, $SettingTriggerBot)
        GUIUpdate($txtTriggerScanSize, $SettingTriggerScanSize)
        GUIUpdate($txtTriggerAimKey, $SettingTriggerAimKey)
     
        ;Aimbot
        GUISetCheck($cbAimBot, $SettingAimBot)
        GUIUpdate($txtAimShootAreaSize, $SettingAimShootAreaSize)
        GUIUpdate($txtAimBotStepSize, $SettingAimBotStepSize)
        GUIUpdate($txtAimKey, $SettingAimKey)
     
     
        ;Pixel Search settings
        GUIUpdate($txtSearchAreaSize, $SettingSearchAreaSize)
        GUIUpdate($txtShadeVariation, $SettingShadeVariation)
        GUIUpdate($txtMinPureColors, $SettingMinPureColors)
        GUIUpdate($txtMaxShades, $SettingMaxShades)
    EndFunc   ;==>UpdateGUI
     
    Func SaveColors()
        Local $string = GUICtrlRead($editSearchColors)
        If $string = "" Then Return
        local $temp = StringReplace($string, @CRLF, " ")
        $temp = StringStripWS($temp, 7)
        Local $SearchColors = StringSplit($temp, " ")
     
        For $ColorIndex = 1 To $SearchColors[0]
            IniWrite($SettingsPath, "Pixel Settings", "Color" & $ColorIndex, $SearchColors[$ColorIndex])
        Next
    EndFunc   ;==>SaveColors
     
    Func GetColors()
        Local $string = ""
        Local $SearchColors = IniReadSection($SettingsPath, "Pixel Settings")
        If @error Then Return
     
        Local $TotalColors = $SearchColors[0][0]
     
        If $TotalColors > 0 Then
            ReDim $SettingSearchColors[$TotalColors]
        EndIf
     
        For $ColorIndex = 1 To $TotalColors
            $SettingSearchColors[$ColorIndex - 1] = $SearchColors[$ColorIndex][1]
            $string &= $SettingSearchColors[$ColorIndex - 1] & @CRLF
        Next
     
        If Not $string = "" Then GUICtrlSetData($editSearchColors, $string)
    EndFunc   ;==>GetColors
     
    Func SearchColorsToString($SearchColors)
        Local $string = ""
        For $Color In $SearchColors
            $string &= $Color & @CRLF
        Next
     
        Return $string
    EndFunc   ;==>SearchColorsToString
     
    Func GUISetCheck($Control, $Flag)
        If $Flag = 0 Then
            GUICtrlSetState($Control, $GUI_UNCHECKED)
        ElseIf $Flag = 1 Then
            GUICtrlSetState($Control, $GUI_CHECKED)
        EndIf
    EndFunc   ;==>GUISetCheck
     
    Func ConvertFlag($Control)
        If GUICtrlRead($Control) = 4 Or GUICtrlRead($Control) = 68 Then
            Return 0
        Else
            Return 1
        EndIf
    EndFunc   ;==>ConvertFlag
     
    Func IsChecked($Control)
        Return BitAND(GUICtrlRead($Control), $GUI_CHECKED) = $GUI_CHECKED
    EndFunc   ;==>IsChecked
     
    Func GUIUpdate($Control, $Value)
        GUICtrlSetData($Control, $Value)
    EndFunc   ;==>GUIUpdate
     
    Func ReadINI()
        ;SHOW GUI SETTING
        $SettingDrawDebug = IniRead($SettingsPath, "BotSettings", "DrawDebug", $SettingDrawDebug)
     
        ;Game Handle Name
        $SettingWindowClass = IniRead($SettingsPath, "BotSettings", "WindowClass", $SettingWindowClass)
     
        ;Bot Settings
        $SettingRunning = IniRead($SettingsPath, "BotSettings", "AutoRun", $SettingAutoRun)
        $SettingAutoUpdate = IniRead($SettingsPath, "BotSettings", "AutoUpdate", $SettingAutoUpdate)
     
        ;AIMBOT $ TRIGGERBOT SETTINGS
        $SettingAimMode = IniRead($SettingsPath, "BotSettings", "AimMode", $SettingAimMode)
     
        ;Triggerbot
        $SettingTriggerScanSize = IniRead($SettingsPath, "TriggerbotSettings", "ScanSize", $SettingTriggerScanSize)
        $SettingTriggerBot = IniRead($SettingsPath, "TriggerSettings", "Enabled", $SettingTriggerBot)
        $SettingTriggerAimKey = IniRead($SettingsPath, "TriggerSettings", "Key", $SettingTriggerAimKey)
     
        ;Aimbot
        $SettingAimShootAreaSize = IniRead($SettingsPath, "AimbotSettings", "ShootAreaSize", $SettingAimShootAreaSize)
        $SettingAimBot = IniRead($SettingsPath, "AimbotSettings", "Enabled", $SettingAimBot)
        $SettingAimKey = IniRead($SettingsPath, "AimbotSettings", "Key", $SettingAimKey)
        $SettingAutoShoot = IniRead($SettingsPath, "AimbotSettings", "Shoot", $SettingAutoShoot)
        $SettingAimBotStepSize = IniRead($SettingsPath, "AimbotSettings", "StepSize", $SettingAimBotStepSize)
     
        ;Pixel Search settings
        $SettingSearchAreaSize = IniRead($SettingsPath, "PixelSettings", "SearchAreaSize", $SettingSearchAreaSize)
        $SettingShadeVariation = IniRead($SettingsPath, "PixelSettings", "ShadeVariation ", $SettingShadeVariation)
        $SettingMinPureColors = IniRead($SettingsPath, "PixelSettings", "MinPureColors", $SettingMinPureColors)
        $SettingMaxShades = IniRead($SettingsPath, "PixelSettings", "MaxShades", $SettingMaxShades)
     
        GetColors()
    EndFunc   ;==>ReadINI
     
    Func SaveINI()
        FileDelete($SettingsPath)
     
        ;Game Handle Name
        IniWrite($SettingsPath, "BotSettings", "WindowClass", GUICtrlRead($txtWindowClass))
     
        ;Bot Settings
        IniWrite($SettingsPath, "BotSettings", "AutoRun", ConvertFlag($cbAutoRun))
        IniWrite($SettingsPath, "BotSettings", "AutoUpdate", ConvertFlag($mAutoUpdate))
        IniWrite($SettingsPath, "BotSettings", "DrawDebug", ConvertFlag($mDrawDebug))
     
        ;Triggerbot
        IniWrite($SettingsPath, "TriggerbotSettings", "ScanSize", GUICtrlRead($txtTriggerScanSize))
        IniWrite($SettingsPath, "TriggerSettings", "Enabled", ConvertFlag($cbTriggerBot))
        IniWrite($SettingsPath, "TriggerSettings", "Key", GUICtrlRead($txtTriggerAimKey))
     
        ;Aimbot
        IniWrite($SettingsPath, "AimbotSettings", "ShootAreaSize", GUICtrlRead($txtAimShootAreaSize))
        IniWrite($SettingsPath, "AimbotSettings", "Enabled", ConvertFlag($cbAimBot))
        IniWrite($SettingsPath, "AimbotSettings", "Key", GUICtrlRead($txtAimKey))
        IniWrite($SettingsPath, "AimbotSettings", "StepSize", GUICtrlRead($txtAimBotStepSize))
     
        ;Pixel Search settings
        IniWrite($SettingsPath, "PixelSettings", "SearchAreaSize", GUICtrlRead($txtSearchAreaSize))
        IniWrite($SettingsPath, "PixelSettings", "ShadeVariation ", GUICtrlRead($txtShadeVariation))
        IniWrite($SettingsPath, "PixelSettings", "MinPureColors", GUICtrlRead($txtMinPureColors))
        IniWrite($SettingsPath, "PixelSettings", "MaxShades", GUICtrlRead($txtMaxShades))
     
        SaveColors()
        Call("ReadINI")
    EndFunc   ;==>SaveINI
     
    Func GetFriendlyKeyName($Key)
        If $Key = "01" Then Return "Left mouse button"
        If $Key = "02" Then Return "Right mouse button"
        If $Key = "03" Then Return "Control-break processing"
        If $Key = "04" Then Return "Middle mouse button (three-button mouse)"
        If $Key = "05" Then Return "X1 mouse button"
        If $Key = "06" Then Return "X2 mouse button"
        If $Key = "08" Then Return "BACKSPACE key"
        If $Key = "09" Then Return "TAB key"
        If $Key = "0C" Then Return "CLEAR key"
        If $Key = "0D" Then Return "ENTER key"
        If $Key = "10" Then Return "SHIFT key"
        If $Key = "11" Then Return "CTRL key"
        If $Key = "12" Then Return "ALT key"
        If $Key = "13" Then Return "PAUSE key"
        If $Key = "14" Then Return "CAPS LOCK key"
        If $Key = "1B" Then Return "ESC key"
        If $Key = "20" Then Return "SPACEBAR"
        If $Key = "21" Then Return "PAGE UP key"
        If $Key = "22" Then Return "PAGE DOWN key"
        If $Key = "23" Then Return "END key"
        If $Key = "24" Then Return "HOME key"
        If $Key = "25" Then Return "LEFT ARROW key"
        If $Key = "26" Then Return "UP ARROW key"
        If $Key = "27" Then Return "RIGHT ARROW key"
        If $Key = "28" Then Return "DOWN ARROW key"
        If $Key = "29" Then Return "SELECT key"
        If $Key = "2A" Then Return "PRINT key"
        If $Key = "2B" Then Return "EXECUTE key"
        If $Key = "2C" Then Return "PRINT SCREEN key"
        If $Key = "2D" Then Return "INS key"
        If $Key = "2E" Then Return "DEL key"
        If $Key = "30" Then Return "0 key"
        If $Key = "31" Then Return "1 key"
        If $Key = "32" Then Return "2 key"
        If $Key = "33" Then Return "3 key"
        If $Key = "34" Then Return "4 key"
        If $Key = "35" Then Return "5 key"
        If $Key = "36" Then Return "6 key"
        If $Key = "37" Then Return "7 key"
        If $Key = "38" Then Return "8 key"
        If $Key = "39" Then Return "9 key"
        If $Key = "41" Then Return "A key"
        If $Key = "42" Then Return "B key"
        If $Key = "43" Then Return "C key"
        If $Key = "44" Then Return "D key"
        If $Key = "45" Then Return "E key"
        If $Key = "46" Then Return "F key"
        If $Key = "47" Then Return "G key"
        If $Key = "48" Then Return "H key"
        If $Key = "49" Then Return "I key"
        If $Key = "4A" Then Return "J key"
        If $Key = "4B" Then Return "K key"
        If $Key = "4C" Then Return "L key"
        If $Key = "4D" Then Return "M key"
        If $Key = "4E" Then Return "N key"
        If $Key = "4F" Then Return "O key"
        If $Key = "50" Then Return "P key"
        If $Key = "51" Then Return "Q key"
        If $Key = "52" Then Return "R key"
        If $Key = "53" Then Return "S key"
        If $Key = "54" Then Return "T key"
        If $Key = "55" Then Return "U key"
        If $Key = "56" Then Return "V key"
        If $Key = "57" Then Return "W key"
        If $Key = "58" Then Return "X key"
        If $Key = "59" Then Return "Y key"
        If $Key = "5A" Then Return "Z key"
        If $Key = "5B" Then Return "Left Windows key"
        If $Key = "5C" Then Return "Right Windows key"
        If $Key = "60" Then Return "Numeric keypad 0 key"
        If $Key = "61" Then Return "Numeric keypad 1 key"
        If $Key = "62" Then Return "Numeric keypad 2 key"
        If $Key = "63" Then Return "Numeric keypad 3 key"
        If $Key = "64" Then Return "Numeric keypad 4 key"
        If $Key = "65" Then Return "Numeric keypad 5 key"
        If $Key = "66" Then Return "Numeric keypad 6 key"
        If $Key = "67" Then Return "Numeric keypad 7 key"
        If $Key = "68" Then Return "Numeric keypad 8 key"
        If $Key = "69" Then Return "Numeric keypad 9 key"
        If $Key = "6A" Then Return "Multiply key"
        If $Key = "6B" Then Return "Add key"
        If $Key = "6C" Then Return "Separator key"
        If $Key = "6D" Then Return "Subtract key"
        If $Key = "6E" Then Return "Decimal key"
        If $Key = "6F" Then Return "Divide key"
        If $Key = "70" Then Return "F1 key"
        If $Key = "71" Then Return "F2 key"
        If $Key = "72" Then Return "F3 key"
        If $Key = "73" Then Return "F4 key"
        If $Key = "74" Then Return "F5 key"
        If $Key = "75" Then Return "F6 key"
        If $Key = "76" Then Return "F7 key"
        If $Key = "77" Then Return "F8 key"
        If $Key = "78" Then Return "F9 key"
        If $Key = "79" Then Return "F10 key"
        If $Key = "7A" Then Return "F11 key"
        If $Key = "7B" Then Return "F12 key"
        If $Key = "90" Then Return "NUM LOCK key"
        If $Key = "91" Then Return "SCROLL LOCK key"
        If $Key = "A0" Then Return "Left SHIFT key"
        If $Key = "A1" Then Return "Right SHIFT key"
        If $Key = "A2" Then Return "Left CONTROL key"
        If $Key = "A3" Then Return "Right CONTROL key"
        If $Key = "A4" Then Return "Left MENU key"
        If $Key = "A5" Then Return "Right MENU key"
        If $Key = "BA" Then Return ";"
        If $Key = "BB" Then Return "="
        If $Key = "BC" Then Return ","
        If $Key = "BD" Then Return "-"
        If $Key = "BE" Then Return "."
        If $Key = "BF" Then Return "/"
        If $Key = "C0" Then Return "`"
        If $Key = "DB" Then Return "["
        If $Key = "DC" Then Return "\"
        If $Key = "DD" Then Return "]"
    EndFunc   ;==>GetFriendlyKeyName
     
    Func RefreshSettings()
        FFResetColors()
        RemoveDebugGUI()
        ReadINI()
        ;Game Handle
        $WindowHandle = WinGetHandle($SettingWindowClass)
     
        ;Game window size shit
        $Size = WinGetClientSize($WindowHandle)
        If $Size = 0 Then
            MsgBox(16, "Error", "Game is not running, cannot grab resolution!" & @CRLF & "Exiting...")
            Exit
        EndIf
     
        $X_Ratio = $size[0] / 1920
        $Y_Ratio = $size[1] / 1080
        $MiddleX = $size[0] / 2
        $MiddleY = $size[1] / 2
     
        $SearchAreaSizeX = $SettingSearchAreaSize * $X_Ratio
        $AimShootAreaSizeX = $SettingAimShootAreaSize * $X_Ratio
     
        $SearchAreaSizeY = $SettingSearchAreaSize * $Y_Ratio
        $AimShootAreaSizeY = $SettingAimShootAreaSize * $Y_Ratio
     
        ;Search Area
        $SearchAreaPoints[0] = Round($MiddleX - $SearchAreaSizeX)
        $SearchAreaPoints[1] = Round($MiddleY - $SearchAreaSizeY)
        $SearchAreaPoints[2] = Round($MiddleX + $SearchAreaSizeX)
        $SearchAreaPoints[3] = Round($MiddleY + $SearchAreaSizeY)
     
        $SearchAreaQuads[0][0] = $SearchAreaPoints[0]
        $SearchAreaQuads[0][1] = $SearchAreaPoints[1]
        $SearchAreaQuads[0][2] = $SearchAreaPoints[0] + $SearchAreaSizeX
        $SearchAreaQuads[0][3] = $SearchAreaPoints[1] + $SearchAreaSizeY
        $SearchAreaQuads[0][4] = ($SearchAreaQuads[0][0] + $SearchAreaQuads[0][2]) / 2
        $SearchAreaQuads[0][5] = ($SearchAreaQuads[0][1] + $SearchAreaQuads[0][3]) / 2
        $SearchAreaQuads[0][6] = $SearchAreaQuads[0][2] - $SearchAreaQuads[0][0]
     
        $SearchAreaQuads[1][0] = $SearchAreaPoints[0] + $SearchAreaSizeX
        $SearchAreaQuads[1][1] = $SearchAreaPoints[1]
        $SearchAreaQuads[1][2] = $SearchAreaPoints[0] + $SearchAreaSizeX * 2
        $SearchAreaQuads[1][3] = $SearchAreaPoints[1] + $SearchAreaSizeY
        $SearchAreaQuads[1][4] = ($SearchAreaQuads[1][0] + $SearchAreaQuads[1][2]) / 2
        $SearchAreaQuads[1][5] = ($SearchAreaQuads[1][1] + $SearchAreaQuads[1][3]) / 2
        $SearchAreaQuads[1][6] = $SearchAreaQuads[1][2] - $SearchAreaQuads[1][0]
     
        $SearchAreaQuads[2][0] = $SearchAreaPoints[0]
        $SearchAreaQuads[2][1] = $SearchAreaPoints[1] + $SearchAreaSizeY
        $SearchAreaQuads[2][2] = $SearchAreaPoints[0] + $SearchAreaSizeX
        $SearchAreaQuads[2][3] = $SearchAreaPoints[1] + $SearchAreaSizeY * 2
        $SearchAreaQuads[2][4] = ($SearchAreaQuads[2][0] + $SearchAreaQuads[2][2]) / 2
        $SearchAreaQuads[2][5] = ($SearchAreaQuads[2][1] + $SearchAreaQuads[2][3]) / 2
        $SearchAreaQuads[2][6] = $SearchAreaQuads[2][2] - $SearchAreaQuads[2][0]
     
        $SearchAreaQuads[3][0] = $SearchAreaPoints[0] + $SearchAreaSizeX
        $SearchAreaQuads[3][1] = $SearchAreaPoints[1] + $SearchAreaSizeY
        $SearchAreaQuads[3][2] = $SearchAreaPoints[0] + $SearchAreaSizeX * 2
        $SearchAreaQuads[3][3] = $SearchAreaPoints[1] + $SearchAreaSizeY * 2
        $SearchAreaQuads[3][4] = ($SearchAreaQuads[3][0] + $SearchAreaQuads[3][2]) / 2
        $SearchAreaQuads[3][5] = ($SearchAreaQuads[3][1] + $SearchAreaQuads[3][3]) / 2
        $SearchAreaQuads[3][6] = $SearchAreaQuads[3][2] - $SearchAreaQuads[3][0]
     
        ;Aimbot Area
        $AimShootAreaPoints[0] = Round($MiddleX - $AimShootAreaSizeX)
        $AimShootAreaPoints[1] = Round($MiddleY - $AimShootAreaSizeY)
        $AimShootAreaPoints[2] = Round($MiddleX + $AimShootAreaSizeX)
        $AimShootAreaPoints[3] = Round($MiddleY + $AimShootAreaSizeY)
     
        Local $UnitTable1[$SettingTriggerRadarSize + 1][4]
     
        Local $PI = 3.141592653589793
     
        Local $Rad = $PI / 180
        Local $Offset = 0
        Local $Increment = 360 / $SettingTriggerRadarSize
     
        For $a = 0 To $SettingTriggerRadarSize
            $Angle = $Rad * $Offset;
            $UnitTable1[$a][0] = Round($MiddleX + Cos($Angle) * $SettingTriggerScanSize);
            $UnitTable1[$a][1] = Round($MiddleY + Sin($Angle) * $SettingTriggerScanSize);
            $UnitTable1[$a][2] = $Offset
            $UnitTable1[$a][3] = $Angle;
            $Offset = $Offset + $Increment
        Next
     
        $UnitTable = $UnitTable1
     
        $SettingAutoShoot = $SettingAutoShoot And Not $SettingAimKey = "01"
     
        If $SettingDrawDebug = 1 Then
            DrawDebugGUI()
        EndIf
     
        For $Color In $SettingSearchColors
            $color = _ColorGetRGB($Color)
            If IsArray($color) = 1 Then
                $r = $color[0]
                $g = $color[1]
                $b = $color[2]
                ;ConsoleWrite($r & "," & $g & "," & $b & @CRLF)
     
                If $r >= $SettingMaxR Then $SettingMaxR = $r
                If $g >= $SettingMaxG Then $SettingMaxG = $g
                If $b >= $SettingMaxB Then $SettingMaxB = $b
    ;
                If $r <= $SettingMinR Then $SettingMinR = $r
                If $g <= $SettingMinG Then $SettingMinG = $g
                If $b <= $SettingMinB Then $SettingMinB = $b
            EndIf
        Next
     
        FFSetDebugMode(0)
        FFSetWnd($WindowHandle)
        FFAddColor($SettingSearchColors)
    EndFunc
     
    Func DoUpdate()
        $ini = InetGet($VersionsInfo, @ScriptDir & "\version.ini") ;download version.ini
        If $ini = 0 Then ;was the download of version.ini successful?
            MsgBox(16, "Fatal Error", "The server seems to be offline. No update will be done.")
        Else
            $NewVersion = IniRead(@ScriptDir & "\version.ini", "Version", "Version", "") ;reads the new version out of version.ini
            If $NewVersion = $OldVersion Then ;compare old and new
                MsgBox(0, "No update", "There is no update available!")
                FileDelete(@ScriptDir & "\version.ini")
            Else
                $msg = MsgBox(68, "Update", "A new version is available: " & $NewVersion & "! Current version: " & $OldVersion & @CRLF & "Do you want to download the new version?")
                If $msg = 7 Then ;No was pressed
                    FileDelete(@ScriptDir & "\version.ini")
                ElseIf $msg = 6 Then ;OK was pressed
                    $downloadLink = IniRead(@ScriptDir & "\version.ini", "Version", "download", "NotFound")
                    $dlhandle = InetGet($downloadLink, @ScriptDir & "\Update_" & $NewVersion & ".zip", 1, 1)
                    ProgressOn("Update", "Downloading Updates", "", -1, -1, 16) ;creates a progressbar
     
                    $size = InetGetSize($downloadLink, 1) ;get the size of the update
                    While Not InetGetInfo($dlhandle, 2)
                        $Percent = Round((InetGetInfo($dlhandle, 0) / $size) * 100)
                        ProgressSet($Percent, $Percent & "%") ;update progressbar
                        Sleep(1)
                    WEnd
                    ProgressSet(100, "Done", "Complete") ;show complete progressbar
                    Sleep(500)
                    ProgressOff() ;close progress window
                    IniWrite("updater.ini", "version", "version", $newVersion)
                    InetClose($dlhandle)
                    $iniMsg = IniRead(@ScriptDir & "\version.ini", "Version", "message", "Exiting...")
                    MsgBox(64, "Success", "Download Complete!" & @CRLF & "Please restart the bot by extracting the Au3 from Update_" & $NewVersion & ".zip" & @CRLF & $iniMsg)
                    FileDelete(@ScriptDir & "\version.ini")
                    Exit
                EndIf
            EndIf
        EndIf
        WinSetTitle($GUITitle, "", $GUITitle & $Version & " - Waiting")
    EndFunc   ;==>DoUpdate
    Multi hack Code 2

    Code:
    #include <GUIConstants.au3>
    #include <Constants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <Misc.au3>
    #include <WinAPI.au3>
    #include <Array.au3>
    
    Opt("MouseClickDelay", 0)
    Opt('MouseCoordMode', 2)
    Opt('PixelCoordMode', 2)
    Opt("MouseClickDownDelay", 0)
    
    ;MODIFY TO YOUR LIKINGS!!
    Global $SettingShootBoundWidth = 45
    Global $SettingShootBoundHeight = 150
    Global $SettingSearchAreaWidth = 25
    Global $SettingSearchAreaHeight = 125
    Global $SettingAimMode = False ;False = triggerbot, True = aimbot
    Global $SettingsGUI = False ;Show GUI?
    Global $SettingHoldClick = False ;Rapid fire = true, Single fire = false
    Global $SettingAimBotStepSize = 10 ;Lower the value = slower aimbot, higher equal faster aimbot
    ;MODIFY TO YOUR LIKINGS!!
    
    ;HotKeys
    HotKeySet("{HOME}", "Stop")
    HotKeySet("{END}", "Pause")
    HotKeySet("{INS}", "HoldClickOn")
    HotKeySet("{DELETE}", "SwitchAimMode")
    
    ;Game Handle
    Global $WindowClass = "[CLASS:TankWindowClass]"
    Global $WindowHandle = WinGetHandle($WindowClass)
    
    ;Settings
    Global $SettingTriggerBot = True
    Global $SettingRunning = True
    Global $SettingShooting = False
    Global $IsUserShooting = False
    
    ;Pixel Search settings
    $SettingSearchAreaSize = 100
    Global $SettingSearchColors[13] = [0xF2361B, 0xEF3519, 0xEE4131, 0xED4233, 0xEE4031, 0xCF8790, 0xCF878F, 0xD92411, 0xDC2613, 0xA24D53, 0xA84547, 0xB25C62, 0xAB545B] ;Color to search for, hex!
    $SettingShadeVariation = 10
    $SettingMinPureColors = 13
    $SettingMaxShades = 25
    
    $SettingMaxR = 242
    $SettingMaxG = 135
    $SettingMaxB = 144
    $SettingMinR = 162
    $SettingMinG = 36
    $SettingMinB = 17
    
    ;Game window size
    Global $size = WinGetClientSize($WindowHandle)
    If $size = 0 Then
     MsgBox(16, "Error", "Game is not running, cannot grab resolution!" & @CRLF & "Exiting...")
     Exit
    EndIf
    Global $x_ratio = $size[0] / 1920
    Global $y_ratio = $size[1] / 1080
    Global $middleX = $size[0]/2
    Global $middleY = $size[1]/2
    
    ;Search Area
    Global $SearchAreaBoundsX = [$middleX - ($SettingSearchAreaWidth* $x_ratio),  $middleX + ($SettingSearchAreaWidth * $x_ratio)]
    Global $SearchAreaBoundsY = [$middleY - ($SettingSearchAreaHeight * $y_ratio), $middleY + ($SettingSearchAreaHeight/2 * $y_ratio)]
    Global $SearchAreaPoints[4] = [$SearchAreaBoundsX[0],$SearchAreaBoundsY[0],$SearchAreaBoundsX[1],$SearchAreaBoundsY[1]]
    
    ;Shoot Area
    Global $ShootBoundsX[2] = [$middleX - ($SettingShootBoundWidth * $x_ratio), $middleX + ($SettingShootBoundWidth * $x_ratio)]
    Global $ShootBoundsY[2] = [$middleY - ($SettingShootBoundHeight * $y_ratio), $middleY + ($SettingShootBoundHeight/2 * $y_ratio)]
    Global $ShootAreaPoints[4] = [$ShootBoundsX[0], $ShootBoundsY[0], $ShootBoundsX[1], $ShootBoundsY[1]]
    
    ;Draw GUI
    If $SettingsGUI Then
       DrawSearchAreaGUI($SearchAreaPoints, 0x66FF33, "Search")
       DrawSearchAreaGUI($ShootAreaPoints, 0x0000FF, "Shoot")
       $frmBot = GUICreate("Pixel Triggerbot" & "1.0" & " - OFF", 270, 145, 0, 0, -1, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW), 0)
       $lblPixel = GUICtrlCreateLabel("Pixel Found: 0,0" , 4, 0, 280, 24)
       GUICtrlSetFont(-1, 10, 600, 0, "Segoe UI")
       GUICtrlSetColor(-1, 0x330000)
       $lblStatus = GUICtrlCreateLabel("Status: Running", 4, 20, 240, 17)
       GUICtrlSetFont(-1, 10, 600, 0, "Segoe UI")
       GUICtrlSetColor(-1, 0x330000)
       $lblMode = GUICtrlCreateLabel("Mode: Single Click", 4, 40, 240, 17)
       GUICtrlSetFont(-1, 10, 600, 0, "Segoe UI")
       GUICtrlSetColor(-1, 0x330000)
       $lblHelpMsg1 = GUICtrlCreateLabel("Press INSERT to change modes", 4, 60, 240, 17)
       GUICtrlSetFont(-1, 10, 600, 0, "Segoe UI")
       GUICtrlSetColor(-1, 0xFF0000)
       $lblHelpMsg2 = GUICtrlCreateLabel("Press END to pause", 4, 80, 240, 17)
       GUICtrlSetFont(-1, 10, 600, 0, "Segoe UI")
       GUICtrlSetColor(-1, 0xFF0000)
       $lblHelpMsg3 = GUICtrlCreateLabel("Press HOME to end", 4, 100, 240, 17)
       GUICtrlSetFont(-1, 10, 600, 0, "Segoe UI")
       GUICtrlSetColor(-1, 0xFF0000)
       GUISetState()
    EndIf
    
    ;Mainbot
    While $SettingRunning
       WinActivate($WindowHandle)
       If $SettingsGUI Then
      If Not $SettingTriggerBot Then
       GUICtrlSetData($lblStatus,"Status: Paused")
      Else
      GUICtrlSetData($lblStatus,"Status: Searching For Pixel")
      EndIf
       EndIf
       TryShoot()
    WEnd
    Func TryShoot()
       While $SettingTriggerBot
      If  Not IsUserPressing() Then
      ShootGun()
      StopShooting()
      EndIf
       WEnd
    EndFunc
    
    ;Check if gun can shoot and draws a box around the pixel found
    Func CanShootGun($coord)
       If IsArray($coord) = 1 Then
      If $SettingsGUI Then
      DrawFoundCoordArea($coord)
      GUICtrlSetData($lblPixel,"Pixel Found: " & $coord[0] & "," & $coord[1])
      EndIf
      If Not $SettingAimMode Then
      If $coord[0] >= $ShootBoundsX[0] And $coord[0] <= $ShootBoundsX[1] And  $coord[1] >= $ShootBoundsY[0] And $coord[1] <= $ShootBoundsY[1] Then
       Return True
      Else
        Return False
      EndIf
      Else
      MoveMouse($coord[0], $coord[1])
      Return True
      EndIf
       Else
      Return False
       EndIf
    EndFunc
    Func IsUserPressing()
       Return Not $SettingShooting And _IsPressed("01")
    EndFunc
    Func StopShooting()
       If $SettingShooting And $SettingHoldClick Then
      MouseUp("left")
      $SettingShooting = False
       EndIf
    EndFunc
    Func MoveMouse($x, $y)
       Local $MoveToX = ($x - $middleX)
       Local $MoveToY = ($y - $middleY)
       If $MoveToX Then
      If Abs($MoveToX) < $SettingAimBotStepSize Then
       $iMoving = $MoveToX
      Else
       $iMoving = $SettingAimBotStepSize
       If ($MoveToX) < 0 Then $iMoving *= -1
      EndIf
      _MouseMovePlus($iMoving, 0)
       EndIf
    
       If $MoveToY Then
      If Abs($MoveToY) < $SettingAimBotStepSize Then
       $iMoving = $MoveToY
      Else
       $iMoving = $SettingAimBotStepSize
       If ($MoveToY) < 0 Then $iMoving *= -1
      EndIf
      _MouseMovePlus(0, $iMoving)
       EndIf
    EndFunc
    Func _MouseMovePlus($x, $y)
        DllCall("user32.dll", _
       "none", _
       "mouse_event", _
                "long",  1 , _
                "long",  $x, _
                "long",  $y, _
                "long",  0, _
       "long",  0)
      EndFunc
    Func _MouseClickFast2($x = 0, $y = 0, $User32 = "User32.dll")
        DllCall($User32, "none", "mouse_event", "long", 2, "long", $x, "long", $y, "long", 0, "long", 0) ; 32770 0x8002 BitOR($MOUSEEVENTF_ABSOLUTE, $MOUSEEVENTF_LEFTDOWN)
        DllCall($User32, "none", "mouse_event", "long", 4, "long", $x, "long", $y, "long", 0, "long", 0) ; 32772 0x8004 BitOR($MOUSEEVENTF_ABSOLUTE, $MOUSEEVENTF_LEFTUP)
    EndFunc
    
    Func ShootGun()
       While CanShootGun(SearchPixel())
      If $SettingHoldClick Then
      $SettingShooting = true
      MouseDown("left")
      Else
      _MouseClickFast2("left")
      EndIf
       WEnd
    EndFunc
    
    Func SearchPixel()
       Return PixelSearch($SearchAreaPoints[0], $SearchAreaPoints[1],$SearchAreaPoints[2], $SearchAreaPoints[3], $searchColor,15)
    EndFunc
    Func DrawSearchAreaGUI($Points, $Color, $comment = "")
       Local $DrawAreaWidth = $Points[2] - $Points[0]
       Local $DrawAreaHeight = $Points[3] - $Points[1]
       Local $AreaGUI = GUICreate("", $DrawAreaWidth + 2, $DrawAreaHeight + 2, $Points[0], $Points[1], $WS_POPUP, BitOR($WS_EX_LAYERED, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TRANSPARENT)))
       GUISetBkColor(0xABCDEF)
       _WinAPI_SetLayeredWindowAttributes($AreaGUI, 0xABCDEF, 0xA0)
       WinSetOnTop($AreaGUI, "", 1)
       GUISetState()
       $hDC = _WinAPI_GetWindowDC($AreaGUI)
       $hPen = _WinAPI_CreatePen($PS_SOLID, 2, $Color)
       $obj_orig = _WinAPI_SelectObject($hDC, $hPen)
       _WinAPI_DrawLine($hDC, 0, 1, $DrawAreaWidth, 0)
       _WinAPI_DrawLine($hDC, 1, 0, 0, $DrawAreaHeight)
       _WinAPI_DrawLine($hDC, $DrawAreaWidth, $DrawAreaHeight, $DrawAreaWidth, 0)
       _WinAPI_DrawLine($hDC, $DrawAreaWidth, $DrawAreaHeight, 0, $DrawAreaHeight)
       _WinAPI_SetTextColor($hDC, 0x000000)
       _WinAPI_SetBkMode($hDC, $TRANSPARENT)
       $tRECT = DllStructCreate($tagRect)
       DllStructSetData($tRECT, "Left", 5)
       DllStructSetData($tRECT, "Top", 5)
       DllStructSetData($tRECT, "Right", 250)
       DllStructSetData($tRECT, "Bottom", 50)
       _WinAPI_DrawText($hDC, $comment, $tRECT, 0)
    EndFunc   ;==>DrawArea
    
    Func DrawFoundCoordArea($FoundCoord)
       Local $hDC, $hPen, $o_Orig
       Local $FoundAreaPoints[4] = [$FoundCoord[0] - 5, $FoundCoord[1] - 5, $FoundCoord[0] + 5, $FoundCoord[1] + 5]
       Local $FoundAreaWidth = $FoundAreaPoints[2] - $FoundAreaPoints[0]
       Local $FoundAreaHeight = $FoundAreaPoints[3] - $FoundAreaPoints[1]
       Local $FoundTopLine[4] = [$FoundAreaPoints[0], $FoundAreaPoints[1], $FoundAreaPoints[0] + $FoundAreaWidth, $FoundAreaPoints[1]]
       Local $FoundBottomLine[4] = [$FoundAreaPoints[0], $FoundAreaPoints[1], $FoundAreaPoints[0], $FoundAreaPoints[1] + $FoundAreaHeight]
       Local $FoundLeftLine[4] = [$FoundAreaPoints[0] + $FoundAreaWidth, $FoundAreaPoints[1], $FoundAreaPoints[0] + $FoundAreaWidth, $FoundAreaPoints[1] + $FoundAreaHeight]
       Local $FoundRightLine[4] = [$FoundAreaPoints[0], $FoundAreaPoints[1] + $FoundAreaHeight, $FoundAreaPoints[0] + $FoundAreaWidth, $FoundAreaPoints[1] + $FoundAreaHeight]
       $hDC = _WinAPI_GetWindowDC(0) ; DC of entire screen (desktop)
       $hPen = _WinAPI_CreatePen($PS_SOLID, 2, 0xFF0000)
       $o_Orig = _WinAPI_SelectObject($hDC, $hPen)
       _WinAPI_DrawLine($hDC, $FoundTopLine[0], $FoundTopLine[1], $FoundTopLine[2], $FoundTopLine[3])
       _WinAPI_DrawLine($hDC, $FoundLeftLine[0], $FoundLeftLine[1], $FoundLeftLine[2], $FoundLeftLine[3])
       _WinAPI_DrawLine($hDC, $FoundRightLine[0], $FoundRightLine[1], $FoundRightLine[2], $FoundRightLine[3])
       _WinAPI_DrawLine($hDC, $FoundBottomLine[0], $FoundBottomLine[1], $FoundBottomLine[2], $FoundBottomLine[3])
       ; refresh desktop (clear cross)
       _WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN)
       ; clear resources
       _WinAPI_SelectObject($hDC, $o_Orig)
       _WinAPI_DeleteObject($hPen)
       _WinAPI_ReleaseDC(0, $hDC)
    EndFunc
    ;hotkey functions
    
    Func Pause()
       $SettingTriggerBot = Not $SettingTriggerBot
    EndFunc
    Func SwitchAimMode()
       $SettingAimMode = Not $SettingAimMode
       If $SettingAimMode Then
      $SearchColor = 0xFF0000
       Else
      $SearchColor = 0xEB1D2F
       EndIf
    EndFunc
    Func HoldClickOn()
       StopShooting()
       $SettingHoldClick = Not $SettingHoldClick
       If $SettingHoldClick Then
      If $SettingsGUI Then
      GUICtrlSetData($lblMode,"Mode: Rapid Fire")
      EndIf
       Else
      If $SettingsGUI Then
      GUICtrlSetData($lblMode,"Mode: Single Fire")
      EndIf
       EndIf
    EndFunc
    Func Stop()
       Exit
    EndFunc
    Attached Thumbnails Attached Thumbnails AHK coders lounge - discuss and share code-1-png  
    Last edited by phansawat; 08-12-2016 at 03:55 PM.

    AHK coders lounge - discuss and share code
  2. Thanks exylus, TheLordJesusHimself, darkimp1, Spidy, Bannock, freakzzz, algin, Caramelly, KREVA, daedalis420 (10 members gave Thanks to phansawat for this useful post)
  3. #2
    exylus's Avatar Member
    Reputation
    2
    Join Date
    Aug 2016
    Posts
    3
    Thanks G/R
    2/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you !
    Last edited by exylus; 08-11-2016 at 06:37 PM.

  4. Thanks phansawat (1 members gave Thanks to exylus for this useful post)
  5. #3
    TheLordJesusHimself's Avatar Elite User Fuck am not Jewish. Authenticator enabled
    Reputation
    333
    Join Date
    Jun 2011
    Posts
    676
    Thanks G/R
    141/268
    Trade Feedback
    4 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Reinhardt faster melee doesnt work very well, it dosnt give you a full swing distance and also with the way ot works it messes up the FoV not many or if any people use it

  6. #4
    phansawat's Avatar Knight-Lieutenant
    Reputation
    43
    Join Date
    Mar 2010
    Posts
    344
    Thanks G/R
    14/18
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by exylus View Post
    'Korean Aimbot Clean, add your own improvements" doesnt work, goes on jump bug, both res tested.
    I just compiled and tested it, it works. Please do not comment with "It does not work". This is for users that know what they are doing. Not some "free aimbot" handholding thread.

  7. #5
    exylus's Avatar Member
    Reputation
    2
    Join Date
    Aug 2016
    Posts
    3
    Thanks G/R
    2/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh ok, i got a question though,
    can the 4 bmp files left anywhere or do i need to put them in a specific location ?

  8. #6
    phansawat's Avatar Knight-Lieutenant
    Reputation
    43
    Join Date
    Mar 2010
    Posts
    344
    Thanks G/R
    14/18
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by exylus View Post
    Oh ok, i got a question though,
    can the 4 bmp files left anywhere or do i need to put them in a specific location ?
    Put them in the same folder as the .ahk script file.
    Also please edit your first post as this might mislead any interested users from using it.

  9. #7
    TheLordJesusHimself's Avatar Elite User Fuck am not Jewish. Authenticator enabled
    Reputation
    333
    Join Date
    Jun 2011
    Posts
    676
    Thanks G/R
    141/268
    Trade Feedback
    4 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Pharah faster reload

    Code:
    $r:: ; reload key
    	send {r} ; reload key
    	sleep 1400 ; delay
    	send {v} ; melee key
    return
         
    Numpad0::suspend ; suspend the script
    Numpad2::ExitApp  ; panic ends the script
    Torbjorn faster reload

    Code:
    $r:: ; reload key
    	send {r} ; reload key
    	sleep 1780 ; delay
    	send {v} ; melee key
    return
         
    Numpad0::suspend ; suspend the script
    Numpad2::ExitApp  ; panic ends the script
    Roadhog faster reload

    Code:
    $r:: ; reload key
    	send {r} ; reload key
    	sleep 1880 ; delay
    	send {v} ; your melee key
    return
         
    Numpad0::suspend ; suspend the script
    Numpad2::ExitApp  ; panic ends the script

  10. Thanks phansawat (1 members gave Thanks to TheLordJesusHimself for this useful post)
  11. #8
    phansawat's Avatar Knight-Lieutenant
    Reputation
    43
    Join Date
    Mar 2010
    Posts
    344
    Thanks G/R
    14/18
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you, will update OP

  12. #9
    TheLordJesusHimself's Avatar Elite User Fuck am not Jewish. Authenticator enabled
    Reputation
    333
    Join Date
    Jun 2011
    Posts
    676
    Thanks G/R
    141/268
    Trade Feedback
    4 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if you alter your Reinhardt faster melee code to the following it will give the full swing range but still be faster then the normal animation

    Code:
        ~$LButton::
            While GetKeyState("LButton", "P"){
         
        Click
        sleep 650
        Click right down
        sleep 200
        Click right up
        sleep 300
         
        }
        return
         
        Numpad0::ExitApp

  13. Thanks phansawat (1 members gave Thanks to TheLordJesusHimself for this useful post)
  14. #10
    Leaked's Avatar Member
    Reputation
    12
    Join Date
    May 2012
    Posts
    35
    Thanks G/R
    0/11
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dope thread. Thank you.

  15. #11
    phansawat's Avatar Knight-Lieutenant
    Reputation
    43
    Join Date
    Mar 2010
    Posts
    344
    Thanks G/R
    14/18
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Leaked View Post
    Dope thread. Thank you.
    no problem friend, i also appreciate it if you can rep stinkyjoint as he has helped out a lot

  16. #12
    Bahrein's Avatar Member
    Reputation
    3
    Join Date
    Aug 2016
    Posts
    6
    Thanks G/R
    0/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    xbutton2::
    MouseClick, right
    sleep, 15
    Send {v down}{v up}
    sleep, 15
    Send {Shift down}{Shift up}
    Return
    Geji combo my friends

  17. Thanks phansawat (1 members gave Thanks to Bahrein for this useful post)
  18. #13
    Aristocrated123's Avatar Member
    Reputation
    1
    Join Date
    Aug 2016
    Posts
    4
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How do you use the widow autoshot?

  19. #14
    TheLordJesusHimself's Avatar Elite User Fuck am not Jewish. Authenticator enabled
    Reputation
    333
    Join Date
    Jun 2011
    Posts
    676
    Thanks G/R
    141/268
    Trade Feedback
    4 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Bahrein View Post
    Geji combo my friends
    how is this ment to work?

  20. Thanks phansawat (1 members gave Thanks to TheLordJesusHimself for this useful post)
  21. #15
    phansawat's Avatar Knight-Lieutenant
    Reputation
    43
    Join Date
    Mar 2010
    Posts
    344
    Thanks G/R
    14/18
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by stinkyjoint View Post
    how is this ment to work?
    xbutton2 is mouse5 button i think, so you pick genji and press mouse5
    it will do a weapon cancellation combo that will do a lot of dmg up close

    Also added triggerbot now

Page 1 of 6 12345 ... LastLast

Similar Threads

  1. WoW Leveling Discussion and Introduction.
    By Yodam in forum World of Warcraft General
    Replies: 0
    Last Post: 01-13-2008, 10:38 AM
  2. Update: All wow id's New sounds and morph codes
    By henk in forum World of Warcraft Emulator Servers
    Replies: 4
    Last Post: 12-16-2007, 02:30 PM
  3. Simpsonize yourself and share with us
    By matswurld in forum Community Chat
    Replies: 3
    Last Post: 07-27-2007, 02:23 PM
All times are GMT -5. The time now is 01:50 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search