全网最强ahk压枪,支持CSGO,PUBG——ahker

Menu, Tray, Icon,,, 1.
; Generated by AutoGUI 2.5.4
#SingleInstance Force
#NoEnv
SetWorkingDir %A_ScriptDir%
SetBatchLines -1

SetBatchLines -1  ; 确保此方法最高的效率.
TimePeriod = 3 ;尝试 7 或 3. 请参阅下面的注释.
DllCall("Winmm\timeBeginPeriod", UInt, TimePeriod)
    ;StartTime := A_TickCount

sendmode,Input
CoordMode, ToolTip , Screen

global mark_show:=1 ;tooltip显示标记
global guishow=1 ;gui显示
Global index_gun:=1   ;当前的枪位
Global segment1:=15 
Global mgsz=50
global TimeSwitch:=0 ;连点
global mark_music:=1 ;声音开关标记(1:开 0:关)
Global sys_delay:=10
;间隔时间SLEEP TIME
global max=1
global min=-1
;---------------------

my_gun:=new gun ;创建对象

Menu, Tray, NoStandard                  ;删除自带托盘菜单
Menu, tray, Add, 暂停, 暂停                  ; 创建     退出
Menu, Tray, Add, 显示,Label_show_hide
Menu, Tray, Add, 声音关闭,Label_sound_on_off
Menu, Tray, Add, 文字提示关闭,Label_word_on_off
Menu, tray, Add, 退出, 退出                 ; 创建     退出

Global factor_value:={"补偿器":0.09,"消焰器":0.06,"消音器":0,无:0,垂直握把:0.09,直角握把:0,轻型握把:0.05,半截式握把:0.05,拇指握把:0.05,有:0.02}
;my_gun.get_parts()

;my_gun.get_range()
Global gui_gun1,gui_gun2,gui_mirror1,gui_mirror2,gui_muzzle1,gui_muzzle2,gui_grip1,gui_grip2,gui_butt1,gui_butt2
Gui,1: -MinimizeBox -MaximizeBox -SysMenu +AlwaysOnTop -Caption +Owner +hWndhMainWnd
Gui,1:Color,002200,00ff00
Gui,1: Font, cFuchsia
Gui,1: Add, DropDownList, x9 y36 w73 vgui_gun1 gok, 通用|M4||AK|SCAR|M16|UMP||mini|sks|大狙|无
Gui,1: Add, DropDownList, x9 y76 w73 vgui_gun2 gok, 通用|M4||AK|SCAR|M16|UMP|mini|sks|大狙|无
Gui,1: Add, DropDownList, x98 y36 w73 vgui_mirror1 gok, 机瞄|红点||2X|3X|4X|6X|8X
Gui,1: Add, DropDownList, x99 y76 w73 vgui_mirror2 gok, 机瞄|红点||2X|3X|4X|6X|8X
Gui,1:Add, DropDownList, x187 y36 w73 vgui_muzzle1 gok, 无||消焰器|补偿器|消音器
Gui,1: Add, DropDownList, x187 y76 w73 vgui_muzzle2 gok, 无||消焰器|补偿器|消音器
Gui,1: Add, DropDownList, x275 y36 w73 vgui_grip1 gok, 无||垂直握把|直角握把|轻型握把|半截式握把|拇指握把
Gui,1: Add, DropDownList, x275 y76 w73 vgui_grip2 gok, 无||垂直握把|直角握把|轻型握把|半截式握把|拇指握把
Gui,1: Add, DropDownList, x363 y36 w73 vgui_butt1 gok, 无||有
Gui,1: Add, DropDownList, x365 y76 w73 vgui_butt2 gok, 无||有
Gui,1: Add, Text, x9 y5 w65 h23 +0x200, 枪
Gui,1: Add, Text, x96 y3 w65 h23 +0x200, 镜
Gui,1: Add, Text, x184 y4 w65 h23 +0x200, 枪头
Gui,1: Add, Text, x275 y5 w65 h23 +0x200, 握把
Gui,1: Add, Text, x361 y4 w65 h23 +0x200, 枪托
Gui,1: Add, Text, x459 y4 w65 h23 +0x200, 压强幅度
Gui,1: Add, Button, x550 y4 w65 h23 +0x200 gadjust, 幅度调整

Gui,1: Add, Edit, x475 y36 w44 h21 vedit11 gdown_up
Gui,1: Add, UpDown, x454 y36 w17 h21 gdown_up, 1

Gui,1: Add, Edit, x475 y73 w44 h21 vedit21 gdown_up
Gui,1: Add, UpDown, x454 y73 w17 h21  gdown_up, 1

Gui,1: Add, Edit, x550 y36 w44 h21 vedit12 gdown_up
Gui,1: Add, UpDown, x526 y36 w17 h21  gdown_up, 1

Gui,1: Add, Edit, x550 y73 w44 h21 vedit22 gdown_up
Gui,1: Add, UpDown, x528 y73 w17 h21  gdown_up, 1

Gui,1: Add, Edit, x616 y36 w44 h21 vedit13 gdown_up
Gui,1: Add, UpDown, x594 y36 w17 h21  gdown_up, 1


Gui,1: Add, Edit, x616 y73 w44 h21 vedit23 gdown_up
Gui,1: Add, UpDown, x594 y73 w17 h21  gdown_up, 1

Gui,1: Add, Button, x221 y105 w193 h37 gsave, &保存数据
Gui,1: Add, Button, x521 y121 w80 h23 gLabel_show_hide, 隐藏

Gui,1: Font, s11 cRed
Gui,1: Add, Text, x12 y104 w186 h39 +0x200, F7:界面开关 F5:退出



Gui,1: Show, w668 h148 , Window
gui,1:Submit,NoHide
my_gun.get_parts()
my_gun.get_range()
if(index_gun==1)
{
    gun_range1:=my_gun.gun1_range1_target
    gun_range2:=my_gun.gun1_range2_target
    gun_range3:=my_gun.gun1_range3_target   
    tbs:=my_gun.tbs1    
}
Else
{
    gun_range1:=my_gun.gun2_range1_target
    gun_range2:=my_gun.gun2_range2_target
    gun_range3:=my_gun.gun2_range3_target    
    tbs:=my_gun.tbs2    
}
GuiControl,1:, edit11,% my_gun.gun1_range1
GuiControl,1:, edit12,% my_gun.gun1_range2
GuiControl,1:, edit13,% my_gun.gun1_range3

GuiControl,1:, edit21,% my_gun.gun2_range1
GuiControl,1:, edit22,% my_gun.gun2_range2
GuiControl,1:, edit23,% my_gun.gun2_range3


;;;;; 关联按钮BUTTONS ;;;;;
机瞄 = NumpadIns
红点 = NumpadEnd
2x = NumpadDown
3x = NumpadPgDn
4x = NumpadLeft
6x = NumpadRight
8x = NumpadUp

通用 = Numpad0
无 = Numpad1
AK = Numpad2
M16 = Numpad3
SCAR = Numpad4
M4 = Numpad5
UMP = Numpad6
mini = Numpad7
sks = Numpad8
大狙 = Numpad9


;;;;; 激活的按键变量HOTKEYS ;;;;;
Hotkey, %机瞄%, 机瞄
Hotkey, %红点%, 红点
Hotkey, %2x%, 2x
Hotkey, %3x%, 3x
Hotkey, %4x%, 4x
Hotkey, %6x%, 6x
Hotkey, %8x%, 8x

Hotkey, %通用%, 通用
Hotkey, %无%, 无
Hotkey, %AK%, AK
Hotkey, %M16%, M16
Hotkey, %SCAR%, SCAR
Hotkey, %M4%, M4
Hotkey, %UMP%, UMP
Hotkey, %mini%, mini
Hotkey, %sks%, sks
Hotkey, %大狙%, 大狙


;-------------------图像识别------------------
M4_OCR=
M4_OCR.="|<>40.UW2AnU7688WA0AMVaMlsF24NX7VA8F4AG6kXAEl8+28lX4Uc8W2AFnUaT8l0C2FWX7wG96+A0N8gsck0UWXWX7W2+++ASAMsscl8lX3XX4X6A06AGAMk0Ml8vWzWX7Xi82+AS/cU8ck0U"

SCAR_OCR=
SCAR_OCR.="|<>63.03028F020W0wMwF28wE4E7X7W8F7W0W0YMYH38YE4E4X4WMN4W0W0YMYH98YE4E6R4QH94W0W488U2N8wE4EkV40HB7W0W328U6NcUE4EA940n547yW0kcU4McXzwEn74QXZ6O1W7AMbowclEAE4X4XU769zW0YMYQ0stU4E4X4XU3540W0wMwMwMcU4T7X034X5a0U00M0NaMYE40U7U7An4W0U4"

AK_OCR=
AK_OCR.="|<>33.8F568N28slX8N6C4H38lEaMN6O6n98WEIH94G2WN8aEQHB0W3aNcAE9n50W9AMc4F1XZ4m8AwcWF3U76OAQ0slFXU36CAMwMslb4X56CtaMglRAn5W8A"

M16_OCR=
M16_OCR.="|<>54.AEclsW41a4EslsW4164Ekl8a6146kkl8a63A2Usl8YG2A2Ucl7Ym283Ucl04m6D30clz4m4M10ck1gn4M98ck0glAM88clscl8s88clscl8c8Mcl8dtMsAMcl8s1kUAMcl8s1k0AMcl8k0k0AsclslsjsCsclsl8U8/cck0lAU8U"

UMP_OCR=
UMP_OCR.="|<>43.YMlX7X7mA8VXlXt64kl8lAX3MMYMaFUcAGAH8kI6969YMC34X4mA71WFXt618lsk4X4YMwM2FW2A0/z8l160AzYMlX7wsmAMlW0yN6AMl0FAX6AMU8blXiAE4T0lr68280MiX410E"

SKS_OCR=
SKS_OCR.="|<>33.U757080Mck07X76D0wMlls4X6+90YMnF84X4G90ncWFbV14n26484A8MF1UkVV8432650UA8Msa0ltX4Fn0YMXF84X6+90YMlF87X76D0UMcls035604"

MINI_OCR=
MINI_OCR.="|<>50.lW0004EFAMU0034Al48000l2AH20008EW6kU0024NUc8000l4M+2tznYF43UlX754nssAM0lF8l4X6CAIGAN8lXX55X62AMclFFlUX6+AIIIMMlWX57776AMclFVllX6+AIM0AMlWX5603iAMclFTlvX6+AIE4PclWX54162AMclF0FU"

红点_OCR=
红点_OCR.="|<>32.00008Ec0000V004UEM04I8l00808E020H20F00E1V+0I10B9OU8BOUU0YB2Y0q2YW1aWV59jFI90q1e00GUc005EI000cOU848+00021E000Mc20U"
红点_OCR.="|<>32.0050000400004000000000000MU020N00809U02E4VU0U0kY0800902401U0U00E00+1+0240g0160400W0000J0000EU0008k0E05E0E00c4000U"


2x_OCR=
2x_OCR.="|<>31.00+NO006tOU01cSU00c6U00G4k02IIU00Y6000/FU000EE00088014980F1f/0I0Pe0IUL1EAcG0U2jK0c2Da0U0KY0c05g0c0180c00c0Y04"

3x_OCR=
3x_OCR.="|<>36.00000800000E00000e0M0A0V2U100U4820FQ04E1c2010HEU0c1gO00+0kU0E01300066i0009PV000SiWU0sZQ/005PkE10Gj522M2M+5BEDE0MG441YocUW43/F0U"

4x_OCR=
4x_OCR.="|<>32.0063Q0000pY000GW002f3E0TF1M0te080HaI00XQN010CdU0U2Mc043AS01li1E0Wa0+4DT0Z2V3EYUG+GGE9VGPM4c4RIcQ0G+I0015+0006ZU0U"


6x_OCR=
6x_OCR.="|<>32.0000800004800021000E00000E0002+00011000100000YU000aI000W2030m0008n0000U000020000000002U0040E02000000040E082U0000U"


8x_OCR=
8x_OCR.="|<>31.0000c000080008cE00c4U02+9M00014024E+0152/E012ZE0211E0U1200eME70cF000U3000200E00M8004O8000P9000P8k00P8a09H8aE4"

mirror_key_value:={"红点":红点_OCR,"2x":2x_OCR,"3x":3x_OCR,"4x":4x_OCR,"6x":6x_OCR,"8x":8x_OCR}
gun_key_value:={"M4":M4_OCR,"SCAR":SCAR_OCR,"AK":AK_OCR,"M16":M16_OCR,"UMP":UMP_OCR,"SKS":SKS_OCR,"MINI":MINI_OCR}
Return


gui2:

Return


暂停:
f8::
Suspend
Menu, Tray, ToggleCheck, 暂停
WinHide, ahk_id %hMainWnd%
if(A_IsSuspended==0)
{
    SoundPlay("启动")
}
Else
{
    SoundPlay("暂停")   
}
Return
;声音提示开关
Label_sound_on_off:
Menu, Tray, ToggleCheck, 声音关闭
if(mark_music==0)
{
   mark_music:=1
}
Else
{
   mark_music:=0     
}
Return

Label_word_on_off:
Menu, Tray, ToggleCheck, 文字提示关闭
if(mark_show==0)
{
   mark_show:=1
}
Else
{
   mark_show:=0    
}
Return

;界面开关:
Label_show_hide:
*f7::
if(WinActive("ahk_id" . hMainWnd))
{
    Gui,1:Hide
}
else
{
    Gui,1:Restore        
}
return

;#IfWinActive ahk_class TXGuiFoundation

NumpadMult::
SetNumLockState, off
tool_value=
(
选镜菜单:
0:机瞄
1:红点
2:2倍
3: 3倍
4: 4倍
6: 6倍
8: 8倍
)
ToolTip(tool_value)
return

NumpadDiv::
SetNumLockState, On
tool_value=
(
选枪菜单:
0:通用
1:无
2:AK
3: M16
4: SCAR
5: M4
6: UMP
7: Mini
8: SKS
9: 大狙
)
ToolTip(tool_value)
return



~*$1::
index_gun:=1
my_gun.get_range_save()

TimeSwitch:=my_gun.TimeSwitch1
gun_range1:=my_gun.gun1_range1_target
gun_range2:=my_gun.gun1_range2_target
gun_range3:=my_gun.gun1_range3_target

tbs:=my_gun.tbs1
string_value:=strstr_TimeSwitch(my_gun.TimeSwitch1)
ToolTip(my_gun.gun1_parts.name . my_gun.gun1_parts.mirror . string_value)
SoundPlay(my_gun.gun1_parts.name)
sleep,500
SoundPlay(my_gun.gun1_parts.mirror)
sleep,400
SoundPlay(string_value)
Return

~*$2::
index_gun:=2
my_gun.get_range_save()

TimeSwitch:=my_gun.TimeSwitch2
gun_range1:=my_gun.gun2_range1_target
gun_range2:=my_gun.gun2_range2_target
gun_range3:=my_gun.gun2_range3_target

tbs:=my_gun.tbs2
string_value:=strstr_TimeSwitch(my_gun.TimeSwitch2)
ToolTip(my_gun.gun2_parts.name . my_gun.gun2_parts.mirror . string_value)12
SoundPlay(my_gun.gun2_parts.name)
sleep,500
SoundPlay(my_gun.gun2_parts.mirror)
sleep,400
SoundPlay(string_value)
Return

;保存数据
save:
*f3::
;保存枪1的数据
if(my_gun.gun1_parts.name==my_gun.gun2_parts.name)
{
    MsgBox,% "保存数据时,请设置不同的枪!"
    Return
}

IniWrite,% my_gun.gun1_range1,%A_ScriptDir%\config\配置.ini,% my_gun.gun1_parts.name,% my_gun.gun1_parts.mirror
IniWrite,% my_gun.gun1_range2,%A_ScriptDir%\config\配置.ini,% my_gun.gun1_parts.name,% my_gun.gun1_parts.mirror . "1"
IniWrite,% my_gun.gun1_range3,%A_ScriptDir%\config\配置.ini,% my_gun.gun1_parts.name,% my_gun.gun1_parts.mirror . "2"

;保存枪2的数据
IniWrite,% my_gun.gun2_range1,%A_ScriptDir%\config\配置.ini,% my_gun.gun2_parts.name,% my_gun.gun2_parts.mirror
IniWrite,% my_gun.gun2_range2,%A_ScriptDir%\config\配置.ini,% my_gun.gun2_parts.name,% my_gun.gun2_parts.mirror . "1"
IniWrite,% my_gun.gun2_range3,%A_ScriptDir%\config\配置.ini,% my_gun.gun2_parts.name,% my_gun.gun2_parts.mirror . "2"

Return

$*CapsLock::
if(index_gun==1)
{
    if(TimeSwitch = 0)
    {
        TimeSwitch := 1
        my_gun.TimeSwitch1:=1
        SoundPlay("单点")
        ToolTip("单点")
    }
    else
    {
        TimeSwitch :=0
        my_gun.TimeSwitch1:=0
        SoundPlay("全自动")
        ToolTip("全自动")
    }    
}
else
{
    if(TimeSwitch = 0)
    {
        TimeSwitch := 1
        my_gun.TimeSwitch2:=1
        SoundPlay("单点")        
        ToolTip("单点")
    }
    else
    {
        TimeSwitch :=0
        my_gun.TimeSwitch2:=0 
        SoundPlay("全自动")
        ToolTip("全自动")
    }    

}

Return

退出:
f5::
ExitApp
Return

Left::  ;系数调整
if(index_gun==1)
{
    if(my_gun.gun1_range2>1)
    {
        my_gun.gun1_range2:=my_gun.gun1_range2-1
    }
    gun_range2:=my_gun.gun1_range2*my_gun.gun1_factor
	ToolTip(my_gun.gun1_range2)
    
}
else
{
    if(my_gun.gun2_range2>1)
    {
        my_gun.gun2_range2:=my_gun.gun2_range2-1  
    }
    gun_range2:=my_gun.gun2_range2*my_gun.gun2_factor
    ToolTip(my_gun.gun2_range2)
}
GuiControl,1:, edit11,% my_gun.gun1_range1
GuiControl,1:, edit12,% my_gun.gun1_range2
GuiControl,1:, edit21,% my_gun.gun2_range1
GuiControl,1:, edit22,% my_gun.gun2_range2
Return

Right::  ;系数调整
if(index_gun==1)
{
    my_gun.gun1_range2:=my_gun.gun1_range2+1
    gun_range2:=my_gun.gun1_range2*my_gun.gun1_factor
    ToolTip(my_gun.gun1_range2)   
}

else
{
    my_gun.gun2_range2:=my_gun.gun2_range2+1
    gun_range2:=my_gun.gun2_range2*my_gun.gun2_factor
    ToolTip(my_gun.gun2_range2)  
}
GuiControl,1:, edit11,% my_gun.gun1_range1
GuiControl,1:, edit12,% my_gun.gun1_range2
GuiControl,1:, edit21,% my_gun.gun2_range1
GuiControl,1:, edit22,% my_gun.gun2_range2
Return
^Right::
if(index_gun==1)
{
    my_gun.gun1_range3:=my_gun.gun1_range3+1
    gun_range3:=my_gun.gun1_range3*my_gun.gun1_factor
    ToolTip(my_gun.gun1_range3)       
}
else
{
    my_gun.gun2_range3:=my_gun.gun2_range3+1
    gun_range3:=my_gun.gun2_range3*my_gun.gun2_factor
    ToolTip(my_gun.gun2_range3)       
}
GuiControl,1:, edit11,% my_gun.gun1_range1
GuiControl,1:, edit12,% my_gun.gun1_range2
GuiControl,1:, edit13,% my_gun.gun1_range3

GuiControl,1:, edit21,% my_gun.gun2_range1
GuiControl,1:, edit22,% my_gun.gun2_range2
GuiControl,1:, edit23,% my_gun.gun2_range3

Return
^Left::
if(index_gun==1)
{
    my_gun.gun1_range3:=my_gun.gun1_range3-1
    gun_range3:=my_gun.gun1_range3*my_gun.gun1_factor
    ToolTip(my_gun.gun1_range3)       
}
else
{
    my_gun.gun2_range3:=my_gun.gun2_range3-1
    gun_range3:=my_gun.gun2_range3*my_gun.gun2_factor
    ToolTip(my_gun.gun2_range3)       
}
GuiControl,1:, edit11,% my_gun.gun1_range1
GuiControl,1:, edit12,% my_gun.gun1_range2
GuiControl,1:, edit13,% my_gun.gun1_range3

GuiControl,1:, edit21,% my_gun.gun2_range1
GuiControl,1:, edit22,% my_gun.gun2_range2
GuiControl,1:, edit23,% my_gun.gun2_range3



Return


*Up::  ;压枪幅度调整
if(index_gun==1)
{
    my_gun.gun1_range1:=my_gun.gun1_range1+1
    gun_range1:=my_gun.gun1_range1*my_gun.gun1_factor
    ToolTip(my_gun.gun1_range1)       
}
else
{
    my_gun.gun2_range1:=my_gun.gun2_range1+1
    gun_range1:=my_gun.gun2_range1*my_gun.gun2_factor
    ToolTip(my_gun.gun2_range1)       
}
GuiControl,1:, edit11,% my_gun.gun1_range1
GuiControl,1:, edit12,% my_gun.gun1_range2
GuiControl,1:, edit21,% my_gun.gun2_range1
GuiControl,1:, edit22,% my_gun.gun2_range2
Return

*Down::
if(index_gun==1)
{
    if(my_gun.gun1_range1>1)
    {
        my_gun.gun1_range1:=my_gun.gun1_range1-1
        gun_range1:=my_gun.gun1_range1*my_gun.gun1_factor
        ToolTip(my_gun.gun1_range1)              
    }
    
}
else
{
    if(my_gun.gun2_range1>1)
    {
        my_gun.gun2_range1:=my_gun.gun2_range1-1
        gun_range1:=my_gun.gun2_range1*my_gun.gun2_factor
        ToolTip(my_gun.gun2_range1)              
    }

}
GuiControl,1:, edit11,% my_gun.gun1_range1
GuiControl,1:, edit12,% my_gun.gun1_range2
GuiControl,1:, edit21,% my_gun.gun2_range1
GuiControl,1:, edit22,% my_gun.gun2_range2
Return

~$*LButton::
if(!(isMouseShown() and  GetKeyState("alt","P")!=1))
{
   Return
}

if(TimeSwitch==0)
{   
starttime:=A_TickCount
    while (GetKeyState("LButton","P") and a_index < mgsz)
    {       
        if(A_Index<segment1)
        {
            ;MsgBox,% gun_range1  gun_range2
            
            y:=gun_range1+(gun_range2-gun_range1)/segment1*a_index
            
            x1:=Floor(tbs/sys_delay)
            x2:=Floor(y/x1)
            x3:=Mod(y,x1)
            loop,%x3%
            {
                mouseXY(0,x2+1)
                sleep(sys_delay)
            }
            x4:=x1-x3
            loop,%x4%
            {
                mouseXY(0, x2)
                sleep(sys_delay)
            }  
        }
        else
        {
            y:=gun_range2+(gun_range3-gun_range2)/(40-segment1)*(a_index-segment1)
            x1:=Floor(tbs/sys_delay)
            x2:=Floor(y/x1)
            x3:=Mod(y,x1)
            loop,%x3%
            {
                mouseXY(0,x2+1)
                sleep(sys_delay)
            }
            x4:=x1-x3
            loop,%x4%
            {
                mouseXY(0,x2 )
                sleep(sys_delay)
            }							
        }

    }
    ;MsgBox,% A_TickCount-starttime "tbs:" tbs
}
Else
{
    if(GetKeyState("LButton","P"))
    {
        Random, Randomdump, %min%, %max%
        y:=Randomdump+gun_range1
        mouseXY(0, y)
    }
}
Return

;标签
机瞄:
红点:
2x:
3x:
4x:
6x:
8x:
ToolTip
SoundPlay(A_ThisLabel)

index := A_ThisLabel
if(index_gun==1)
{
    GuiControl,1: ChooseString, gui_mirror1,% index        
}
Else
{
    GuiControl,1: ChooseString, gui_mirror2,% index            
}
gui,1:Submit,NoHide
Gosub ok
Return


通用:
无:
AK:
M16:
SCAR:
M4:
UMP:
mini:
sks:
大狙:
ToolTip
SoundPlay(A_ThisLabel)
index := A_ThisLabel
if(index_gun==1)
{
    GuiControl,1: ChooseString, gui_gun1,% index        
}
Else
{
    GuiControl,1: ChooseString, gui_gun2,% index            
}
gui,1:Submit,NoHide
Gosub ok

Return

adjust:
Gui,2:Destroy
Gui,2:+hWndhMainWnd2 +Owner1 +Resize +ToolWindow  -DPIScale +AlwaysOnTop
Gui,2: Add, GroupBox, x5 y3 w503 h141, 枪1
Gui,2: Add, GroupBox, x3 y163 w508 h149, 枪2
Gui,2: Add, Slider, x20 y22 w342 h32 hWndhSldr11 vSldr11 gsldr +Tooltip Range0-300,%edit11%
Gui,2: Add, Slider, x20 y63 w342 h32 hWndhSldr12 vSldr12 gsldr +Tooltip Range0-300,%edit12%
Gui,2: Add, Slider, x20 y107 w342 h32 hWndhSldr13 vSldr13 gsldr +Tooltip Range0-300,%edit13%
Gui,2: Add, Slider, x20 y192 w342 h32 hWndhSldr21 vSldr21 gsldr +Tooltip Range0-300,%edit21%
Gui,2: Add, Slider, x20 y234 w342 h32 hWndhSldr21 vSldr22 gsldr +Tooltip Range0-300,%edit22%
Gui,2: Add, Slider, x20 y276 w342 h32 hWndhSldr23 vSldr23 gsldr +Tooltip Range0-300,%edit23%
Gui,2: Add, Edit, x373 y23 w56 h21 vgui2_edit11 ,%edit11%
Gui,2: Add, Edit, x373 y70 w56 h21 vgui2_edit12 ,%edit12%
Gui,2: Add, Edit, x373 y117 w56 h21 vgui2_edit13 ,%edit13%
Gui,2: Add, Edit, x373 y200 w56 h21 vgui2_edit21 ,%edit21%
Gui,2: Add, Edit, x373 y241 w56 h21 vgui2_edit22,%edit22%
Gui,2: Add, Edit, x373 y279 w56 h21 vgui2_edit23 ,%edit23%

Gui,2: Show, w518 h339, Window

Return

sldr:
gui,2:Submit,NoHide
GuiControl,1:, edit11,% sldr11
GuiControl,2:, gui2_edit11,% sldr11
GuiControl,1:, edit12,% sldr12
GuiControl,2:, gui2_edit12,% sldr12
GuiControl,1:, edit13,% sldr13
GuiControl,2:, gui2_edit13,% sldr13
GuiControl,1:, edit21,% sldr21
GuiControl,2:, gui2_edit21,% sldr21
GuiControl,1:, edit22,% sldr22
GuiControl,2:, gui2_edit22,% sldr22
GuiControl,1:, edit23,% sldr23
GuiControl,2:, gui2_edit23,% sldr23
Gosub down_up
Return


down_up:
gui,1:Submit,NoHide

my_gun.gun1_range1:=edit11
my_gun.gun1_range2:=edit12
my_gun.gun1_range3:=edit13

my_gun.gun2_range1:=edit21
my_gun.gun2_range2:=edit22
my_gun.gun2_range3:=edit23

my_gun.get_range_save()
if(index_gun==1)
{
    gun_range1:=my_gun.gun1_range1_target
    gun_range2:=my_gun.gun1_range2_target
    gun_range3:=my_gun.gun1_range3_target
    
}
Else
{
    gun_range1:=my_gun.gun2_range1_target
    gun_range2:=my_gun.gun2_range2_target
    gun_range3:=my_gun.gun2_range3_target
}
Return

ok:
gui,1:Submit,NoHide
my_gun.get_parts()
my_gun.get_range()
if(index_gun==1)
{
    gun_range1:=my_gun.gun1_range1_target
    gun_range2:=my_gun.gun1_range2_target
    gun_range3:=my_gun.gun1_range3_target   
    tbs:=my_gun.tbs1  
}
Else
{
    gun_range1:=my_gun.gun2_range1_target
    gun_range2:=my_gun.gun2_range2_target
    gun_range3:=my_gun.gun2_range3_target    
    tbs:=my_gun.tbs2    
}
GuiControl,1:, edit11,% my_gun.gun1_range1
GuiControl,1:, edit12,% my_gun.gun1_range2
GuiControl,1:, edit13,% my_gun.gun1_range3

GuiControl,1:, edit21,% my_gun.gun2_range1
GuiControl,1:, edit22,% my_gun.gun2_range2
GuiControl,1:, edit23,% my_gun.gun2_range3

Return

;-----------------------------判断鼠标指针------------------------------------------
isMouseShown()			; Suspends the script when mouse is visible ie: inventory, menu, map.
{
    StructSize := A_PtrSize + 16 
    VarSetCapacity(InfoStruct, StructSize)  ;设置infostruct变量可以指向的内存为structsize
    NumPut(StructSize, InfoStruct)  ;已二进制形式存储structsize大小bit的数据到infostruct变量
    DllCall("GetCursorInfo", UInt, &InfoStruct)
    Result := NumGet(InfoStruct, 8)

    if Result > 1
         Return 0
    else
        Return 1
}
;----------------------------鼠标下拉函数----------------------------------------
mouseXY(dx,dy)
{
DllCall("mouse_event", "UInt", 0x0001, "UInt", dx, "UInt", dy, "UInt", 0, "UPtr", 0)
}

class gun
{ 
    ;枪名 name
    ;镜子 mirror
    ;枪托 butt
    ;握把 grip
    ;枪口 muzzle
    
    Static gun1_range1:=""
    Static gun1_range1_target:="" 
    static gun1_range2:=""
    Static gun1_range2_target:=""
    static gun1_range3:=""
    Static gun1_range3_target:=""
    static gun1_parts:={name:"",mirror:"",butt:"",grip:"",muzzle:""}
    
    static gun2_range1:=""
    Static gun2_range1_target:="" 
    static gun2_range2:=""
    Static gun2_range2_target:=""
    static gun2_range3:=""
    Static gun2_range3_target:=""    
    static gun2_parts:={name:"",mirror:"",butt:"",grip:"",muzzle:""}
    
    Static tbs1:=""
    Static tbs2:=""
    
    Static gun1_factor1:=""
    Static gun1_factor2:=""
    Static gun1_factor3:=""
    Static gun1_factor:=""
    
    Static gun2_factor1:=""
    Static gun2_factor2:=""
    Static gun2_factor3:=""
    Static gun2_factor:=""
    Static TimeSwitch1:=0
    Static TimeSwitch2:=0  
    get_range()
    {
        ;--------------------枪1参数配置-------------------------------------------
        IniRead, OutputVar, %A_ScriptDir%\config\配置.ini,% this.gun1_parts.name,tbs
        this.tbs1:=OutputVar
        IniRead, OutputVar, %A_ScriptDir%\config\配置.ini,% this.gun1_parts.name,% this.gun1_parts.mirror
        this.gun1_range1:=OutputVar
        IniRead, OutputVar, %A_ScriptDir%\config\配置.ini,% this.gun1_parts.name,% this.gun1_parts.mirror . "1"
        this.gun1_range2:=OutputVar
        IniRead, OutputVar, %A_ScriptDir%\config\配置.ini,% this.gun1_parts.name,% this.gun1_parts.mirror . "2"
        this.gun1_range3:=OutputVar        
        ;考虑配件的影响
        this.gun1_factor1:=factor_value[this.gun1_parts.muzzle]
        this.gun1_factor2:=factor_value[this.gun1_parts.grip]
        this.gun1_factor3:=factor_value[this.gun1_parts.butt]
        
        this.gun1_factor:=1-(this.gun1_factor1+this.gun1_factor2+this.gun1_factor3)
        this.gun1_range1_target:=this.gun1_range1*this.gun1_factor
        this.gun1_range2_target:=this.gun1_range2*this.gun1_factor
        this.gun1_range3_target:=this.gun1_range3*this.gun1_factor
        
        ;-------------------枪2参数配置-------------------------------------------
        IniRead, OutputVar, %A_ScriptDir%\config\配置.ini,% this.gun2_parts.name,tbs
        this.tbs2:=OutputVar
        IniRead, OutputVar, %A_ScriptDir%\config\配置.ini,% this.gun2_parts.name,% this.gun2_parts.mirror
        this.gun2_range1:=OutputVar
        IniRead, OutputVar, %A_ScriptDir%\config\配置.ini,% this.gun2_parts.name,% this.gun2_parts.mirror . "1"
        this.gun2_range2:=OutputVar
        IniRead, OutputVar, %A_ScriptDir%\config\配置.ini,% this.gun2_parts.name,% this.gun2_parts.mirror . "2"
        this.gun2_range3:=OutputVar        
        ;考虑配件的影响
        this.gun2_factor1:=factor_value[this.gun2_parts.muzzle]
        this.gun2_factor2:=factor_value[this.gun2_parts.grip]
        this.gun2_factor3:=factor_value[this.gun2_parts.butt]
        
        this.gun2_factor:=1-(this.gun2_factor1+this.gun2_factor2+this.gun2_factor3)
        this.gun2_range1_target:=this.gun2_range1*this.gun2_factor
        this.gun2_range2_target:=this.gun2_range2*this.gun2_factor
        this.gun2_range3_target:=this.gun2_range3*this.gun2_factor
        
    }
    get_range_save()
    {
        ;--------------------枪1参数配置-------------------------------------------    
        this.gun1_factor1:=factor_value[this.gun1_parts.muzzle]
        this.gun1_factor2:=factor_value[this.gun1_parts.grip]
        this.gun1_factor3:=factor_value[this.gun1_parts.butt]
        
        this.gun1_factor:=1-(this.gun1_factor1+this.gun1_factor2+this.gun1_factor3)
        this.gun1_range1_target:=this.gun1_range1*this.gun1_factor
        this.gun1_range2_target:=this.gun1_range2*this.gun1_factor
        this.gun1_range3_target:=this.gun1_range3*this.gun1_factor
        
        ;-------------------枪2参数配置-------------------------------------------

        this.gun2_factor1:=factor_value[this.gun2_parts.muzzle]
        this.gun2_factor2:=factor_value[this.gun2_parts.grip]
        this.gun2_factor3:=factor_value[this.gun2_parts.butt]
        
        this.gun2_factor:=1-(this.gun2_factor1+this.gun2_factor2+this.gun2_factor3)
        this.gun2_range1_target:=this.gun2_range1*this.gun2_factor
        this.gun2_range2_target:=this.gun2_range2*this.gun2_factor 
        this.gun2_range3_target:=this.gun2_range3*this.gun2_factor        
        
    }
    get_parts()
    {
        this.gun1_parts.name:=gui_gun1
        this.gun1_parts.mirror:=gui_mirror1
        this.gun1_parts.butt:=gui_butt1
        this.gun1_parts.grip:=gui_grip1
        this.gun1_parts.muzzle:=gui_muzzle1
        
        this.gun2_parts.name:=gui_gun2
        this.gun2_parts.mirror:=gui_mirror2
        this.gun2_parts.butt:=gui_butt2
        this.gun2_parts.grip:=gui_grip2
        this.gun2_parts.muzzle:=gui_muzzle2
    }
}
strstr_TimeSwitch(value)
{
    if(value==0)
    {
       value:="全自动" 
    }
    else
    {
       value:="单点"         
    }
    return value
}
ToolTip(label){
	
	global  mark_show
	if(mark_show==1)
	{
		ToolTip, %label%, 930, 650
	}

  SetTimer, RemoveToolTip, 1000
  return
  RemoveToolTip:
  SetTimer, RemoveToolTip, Off
  ToolTip
  Return
  }
; http://www.autohotkey.com/board/topic/104539-controlcol-set-background-and-text-color-gui-controls/

ControlColor(Control, Window, bc := "", tc := "", Redraw := 1) {
    a := {}
    a["c"]  := Control
    a["g"]  := Window
    a["bc"] := (bc = "") ? "" : (((bc & 255) << 16) + (((bc >> 8) & 255) << 8) + (bc >> 16))
    a["tc"] := (tc = "") ? "" : (((tc & 255) << 16) + (((tc >> 8) & 255) << 8) + (tc >> 16))
    WindowProc("Set", a, "", "")
    If (Redraw) {
        SizeOfWINDOWINFO := 60
        VarSetCapacity(WINDOWINFO, SizeOfWINDOWINFO, 0)
        NumPut(SizeOfWINDOWINFO, WINDOWINFO, "UInt")
        DllCall("GetWindowInfo",  "Ptr", Control, "Ptr", &WINDOWINFO)
        DllCall("ScreenToClient", "Ptr", Window,  "Ptr", &WINDOWINFO+20) ; x1, y1 of client area
        DllCall("ScreenToClient", "Ptr", Window,  "Ptr", &WINDOWINFO+28) ; x2, y2 of client area
        DllCall("RedrawWindow", "Ptr",  Window, "UInt", &WINDOWINFO+20, "UInt", 0, "UInt", 0x101)
    }
}

WindowProc(hWnd, uMsg, wParam, lParam) {
    Static Win := {}
    Critical
    If uMsg Between 0x132 And 0x138
    If (Win[hWnd].HasKey(lParam)) {
        If (tc := Win[hWnd, lParam, "tc"]) {
            DllCall("SetTextColor", "UInt", wParam, "UInt", tc)
        }
        If (bc := Win[hWnd, lParam, "bc"]) {
            DllCall("SetBkColor",   "UInt", wParam, "UInt", bc)
        }
        Return Win[hWnd, lParam, "Brush"] ; Return the HBRUSH to notify the OS that we altered the HDC.
    }

    If (hWnd = "Set") {
        a := uMsg
        Win[a.g, a.c] := a
        If (Win[a.g, a.c, "tc"] = "") And (Win[a.g, a.c, "bc"] = "")
            Win[a.g].Remove(a.c, "")
        If Not Win[a.g, "WindowProcOld"]
            Win[a.g,"WindowProcOld"] := DllCall("SetWindowLong", "Ptr", a.g, "Int", -4, "Int", RegisterCallback("WindowProc", "", 4), "UInt")
        If Win[a.g, a.c, "Brush"]
            DllCall("DeleteObject", "Ptr", Brush)
        If (Win[a.g, a.c, "bc"] != "")
            Win[a.g, a.c, "Brush"] := DllCall("CreateSolidBrush", "UInt", a.bc)
        Return
    }
    Return DllCall("CallWindowProcA", "UInt", Win[hWnd, "WindowProcOld"], "UInt", hWnd, "UInt", uMsg, "UInt", wParam, "UInt", lParam)
}
SoundPlay(sound)
{
    if(mark_music==1)
    {
        SoundPlay, %A_ScriptDir%\config\music\%sound%.mp3   
    }  
}


sleep(duration)
{

    SleepDuration:= duration ;这里有时可以根据下面的值进行细微调整(例如 2 与 3 的区别).


        DllCall("Sleep", UInt, SleepDuration)  ; 必须使用 DllCall 而不是 Sleep 命令.

    DllCall("Winmm\timeEndPeriod", UInt, TimePeriod)  ; 应该进行调用来让系统恢复正常.
    ;MsgBox % "Sleep duration = " . (A_TickCount - StartTime) / Iterations    
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;捡装备;;;;;;;;;;;;;;;;;;;;;;;;;;;
*XButton1::
        
		loop,1
		{
        	sendinput,{Tab}
			sleep,50
			Random, RandomTime, -2,2 ;1
			
			xpos1:=218+RandomTime
			ypos1:=167+RandomTime
			SendInput,{Click  %xpos1%, %ypos1%,0}
			sendinput,{Click Down}
			xpos2:=931+RandomTime
			ypos2:=371+RandomTime
			SendInput,{Click  %xpos2%, %ypos2%,0}
			sendinput,{Click Up}

			Random, RandomTime, -2,2 ;2

			
			xpos1:=218+RandomTime
			ypos1:=228+RandomTime
			SendInput,{Click  %xpos1%, %ypos1%,0}
			sendinput,{Click Down}
			xpos2:=931+RandomTime
			ypos2:=371+RandomTime
			SendInput,{Click  %xpos2%, %ypos2%,0}
			sendinput,{Click Up}
			
			Random, RandomTime, -2,2 ;3

			
			xpos1:=218+RandomTime
			ypos1:=289+RandomTime
			SendInput,{Click  %xpos1%, %ypos1%,0}
			sendinput,{Click Down}
			xpos2:=931+RandomTime
			ypos2:=371+RandomTime
			SendInput,{Click  %xpos2%, %ypos2%,0}
			sendinput,{Click Up}
			
			Random, RandomTime, -2,2 ;4

			
			xpos1:=218+RandomTime
			ypos1:=350+RandomTime
			SendInput,{Click  %xpos1%, %ypos1%,0}
			sendinput,{Click Down}
			xpos2:=931+RandomTime
			ypos2:=371+RandomTime
			SendInput,{Click  %xpos2%, %ypos2%,0}
			sendinput,{Click Up}
			
			Random, RandomTime, -2,2 ;5

			
			xpos1:=218+RandomTime
			ypos1:=411+RandomTime
			SendInput,{Click  %xpos1%, %ypos1%,0}
			sendinput,{Click Down}
			xpos2:=931+RandomTime
			ypos2:=371+RandomTime
			SendInput,{Click  %xpos2%, %ypos2%,0}
			sendinput,{Click Up}
			
			Random, RandomTime, -2,2 ;6

			
			xpos1:=218+RandomTime
			ypos1:=472+RandomTime
			SendInput,{Click  %xpos1%, %ypos1%,0}
			sendinput,{Click Down}
			xpos2:=931+RandomTime
			ypos2:=371+RandomTime
			SendInput,{Click  %xpos2%, %ypos2%,0}
			sendinput,{Click Up}
			SendInput,{Tab}
			
		}
return
;---------------------图像识别---------------------
/*通用:
无:
AK:
M16:
SCAR:
M4:
UMP:
mini:
sks:
机瞄:
红点:
2x:
3x:
4x:
6x:
8x:
*/
G::


GUN1_OCR:="无"
GUN2_OCR:="无"

GUN1_mirror_OCR:="无"
GUN2_mirror_OCR:="无"

for index, element in gun_key_value ; 在大多数情况下建议使用枚举的方式.
{
    ;MsgBox % "Element number " . index . " is " . element
    if 查找文字(1378,151,150,150,element,"**50",X,Y,OCR,0.1,0.1)
    {
        GUN1_OCR:=index
        ;MsgBox,% GUN1_OCR
        break
    }
}
for index, element in gun_key_value ; 在大多数情况下建议使用枚举的方式.
{
    ;MsgBox % "Element number " . index . " is " . element
    if 查找文字(1378,364,150,150,element,"**50",X,Y,OCR,0.1,0.1)
    {
        GUN2_OCR:=index
        ;MsgBox,% GUN2_OCR
        break
    }
}
;------------------遍历查找镜子--------------------------
for index, element in mirror_key_value ; 在大多数情况下建议使用枚举的方式.
{
    ;MsgBox % "Element number " . index . " is " . element
    if 查找文字(1610,171,150,150,element,"**50",X,Y,OCR,0.1,0.1)
    {
        GUN1_mirror_OCR:=index
        ;MsgBox,% GUN1_OCR
        break
    }

}
for index, element in mirror_key_value ; 在大多数情况下建议使用枚举的方式.
{
    ;MsgBox % "Element number " . index . " is " . element
    if 查找文字(1610,385,150,150,element,"**50",X,Y,OCR,0.1,0.1)
    {
        GUN2_mirror_OCR:=index
        ;MsgBox,% GUN2_OCR
        break
    }

}
;ToolTip,% GUN1_OCR GUN1_mirror_OCR ", " GUN2_OCR GUN2_mirror_OCR
show_value:=GUN1_OCR GUN1_mirror_OCR . ","GUN2_OCR GUN2_mirror_OCR
ToolTip(show_value)
GuiControl,1: ChooseString, gui_gun1,% GUN1_OCR
GuiControl,1: ChooseString, gui_gun2,% GUN2_OCR
GuiControl,1: ChooseString, gui_mirror1,% GUN1_mirror_OCR        
GuiControl,1: ChooseString, gui_mirror2,% GUN2_mirror_OCR        

gui,1:Submit,NoHide
Gosub ok
Return

;---- 将后面的函数附加到自己的脚本中 ----
;-----------------------------------------
; 查找屏幕文字/图像字库及OCR识别
; 注意:参数中的x、y为中心点坐标,w、h为左右上下偏移
; cha1、cha0分别为0、_字符的容许减少百分比
;-----------------------------------------
查找文字(x,y,w,h,wz,c,ByRef rx="",ByRef ry="",ByRef ocr=""
, cha1=0, cha0=0)
{
xywh2xywh(x-w,y-h,2*w+1,2*h+1,x,y,w,h)
if (w<1 or h<1)
Return, 0
bch:=A_BatchLines
SetBatchLines, -1
;--------------------------------------
GetBitsFromScreen(x,y,w,h,Scan0,Stride,bits)
;--------------------------------------
; 设定图内查找范围,注意不要越界
sx:=0, sy:=0, sw:=w, sh:=h
if PicOCR(Scan0,Stride,sx,sy,sw,sh,wz,c
,rx,ry,ocr,cha1,cha0)
{
rx+=x, ry+=y
SetBatchLines, %bch%
Return, 1
}
; 容差为0的若失败则使用 5% 的容差再找一次
if (cha1=0 and cha0=0)
and PicOCR(Scan0,Stride,sx,sy,sw,sh,wz,c
,rx,ry,ocr,0.05,0.05)
{
rx+=x, ry+=y
SetBatchLines, %bch%
Return, 1
}
SetBatchLines, %bch%
Return, 0
}

;-- 规范输入范围在屏幕范围内
xywh2xywh(x1,y1,w1,h1,ByRef x,ByRef y,ByRef w,ByRef h)
{
; 获取包含所有显示器的虚拟屏幕范围
SysGet, zx, 76
SysGet, zy, 77
SysGet, zw, 78
SysGet, zh, 79
left:=x1, right:=x1+w1-1, up:=y1, down:=y1+h1-1
left:=left<zx ? zx:left, right:=right>zx+zw-1 ? zx+zw-1:right
up:=up<zy ? zy:up, down:=down>zy+zh-1 ? zy+zh-1:down
x:=left, y:=up, w:=right-left+1, h:=down-up+1
}

;-- 获取屏幕图像的内存数据,图像包括透明窗口
GetBitsFromScreen(x,y,w,h,ByRef Scan0,ByRef Stride,ByRef bits)
{
VarSetCapacity(bits, w*h*4, 0)
Ptr:=A_PtrSize ? "Ptr" : "UInt"
; 桌面窗口对应包含所有显示器的虚拟屏幕
win:=DllCall("GetDesktopWindow", Ptr)
hDC:=DllCall("GetWindowDC", Ptr,win, Ptr)
mDC:=DllCall("CreateCompatibleDC", Ptr,hDC, Ptr)
hBM:=DllCall("CreateCompatibleBitmap", Ptr,hDC
, "int",w, "int",h, Ptr)
oBM:=DllCall("SelectObject", Ptr,mDC, Ptr,hBM, Ptr)
DllCall("BitBlt", Ptr,mDC, "int",0, "int",0, "int",w, "int",h
, Ptr,hDC, "int",x, "int",y, "uint",0x00CC0020|0x40000000)
;--------------------------
VarSetCapacity(bi, 40, 0)
NumPut(40, bi, 0, "int"), NumPut(w, bi, 4, "int")
NumPut(-h, bi, 8, "int"), NumPut(1, bi, 12, "short")
NumPut(bpp:=32, bi, 14, "short"), NumPut(0, bi, 16, "int")
;--------------------------
DllCall("GetDIBits", Ptr,mDC, Ptr,hBM
, "int",0, "int",h, Ptr,&bits, Ptr,&bi, "int",0)
DllCall("SelectObject", Ptr,mDC, Ptr,oBM)
DllCall("DeleteObject", Ptr,hBM)
DllCall("DeleteDC", Ptr,mDC)
DllCall("ReleaseDC", Ptr,win, Ptr,hDC)
Scan0:=&bits, Stride:=((w*bpp+31)//32)*4
}

;-----------------------------------------
; 图像内查找文字/图像字符串及OCR函数
;-----------------------------------------
PicOCR(Scan0, Stride, sx, sy, sw, sh, wenzi, c
, ByRef rx, ByRef ry, ByRef ocr, cha1, cha0)
{
static MyFunc
if !MyFunc
{
x32:="5589E55383EC608B45200FAF45188B551CC1E20201D0894"
. "5F08B5524B80000000029D0C1E00289C28B451801D08945ECC"
. "745E800000000C745D400000000C745D0000000008B4524894"
. "5CC8B45288945C8C745C400000000837D08000F85B20000008"
. "B450CC1E81025FF0000008945C08B450CC1E80825FF0000008"
. "945BC8B450C25FF0000008945B8C745F400000000EB75C745F"
. "800000000EB5A8B45F083C00289C28B451401D00FB6000FB6C"
. "03B45C075368B45F083C00189C28B451401D00FB6000FB6C03"
. "B45BC751E8B55F08B451401D00FB6000FB6C03B45B8750B8B5"
. "5E88B453001D0C600318345F8018345F0048345E8018B45F83"
. "B45247C9E8345F4018B45EC0145F08B45F43B45287C83E9170"
. "20000837D08010F85A30000008B450C83C001C1E00789450CC"
. "745F400000000EB7DC745F800000000EB628B45F083C00289C"
. "28B451401D00FB6000FB6C06BD0268B45F083C00189C18B451"
. "401C80FB6000FB6C06BC04B8D0C028B55F08B451401D00FB60"
. "00FB6D089D0C1E00429D001C83B450C730B8B55E88B453001D"
. "0C600318345F8018345F0048345E8018B45F83B45247C96834"
. "5F4018B45EC0145F08B45F43B45280F8C77FFFFFFE96A01000"
. "0C745F400000000EB7BC745F800000000EB608B55E88B452C8"
. "D0C028B45F083C00289C28B451401D00FB6000FB6C06BD0268"
. "B45F083C00189C38B451401D80FB6000FB6C06BC04B8D1C028"
. "B55F08B451401D00FB6000FB6D089D0C1E00429D001D8C1F80"
. "788018345F8018345F0048345E8018B45F83B45247C988345F"
. "4018B45EC0145F08B45F43B45280F8C79FFFFFF8B452483E80"
. "18945B48B452883E8018945B0C745F401000000E9B0000000C"
. "745F801000000E9940000008B45F40FAF452489C28B45F801D"
. "08945E88B55E88B452C01D00FB6000FB6D08B450C01D08945E"
. "C8B45E88D50FF8B452C01D00FB6000FB6C03B45EC7F488B45E"
. "88D50018B452C01D00FB6000FB6C03B45EC7F328B45E82B452"
. "489C28B452C01D00FB6000FB6C03B45EC7F1A8B55E88B45240"
. "1D089C28B452C01D00FB6000FB6C03B45EC7E0B8B55E88B453"
. "001D0C600318345F8018B45F83B45B40F8C60FFFFFF8345F40"
. "18B45F43B45B00F8C44FFFFFFC745E800000000E9E30000008"
. "B45E88D1485000000008B454001D08B008945E08B45E08945E"
. "48B45E48945F08B45E883C0018D1485000000008B454001D08"
. "B008945B48B45E883C0028D1485000000008B454001D08B008"
. "945B0C745F400000000EB7CC745F800000000EB678B45F08D5"
. "0018955F089C28B453401D00FB6003C3175278B45E48D50018"
. "955E48D1485000000008B453801C28B45F40FAF452489C18B4"
. "5F801C88902EB258B45E08D50018955E08D1485000000008B4"
. "53C01C28B45F40FAF452489C18B45F801C889028345F8018B4"
. "5F83B45B47C918345F4018B45F43B45B00F8C78FFFFFF8345E"
. "8078B45E83B45440F8C11FFFFFF8B45D00FAF452489C28B45D"
. "401D08945F08B45240FAF45C8BA0100000029C289D08945E4C"
. "745F800000000E9B5020000C745F400000000E993020000C74"
. "5E800000000E9710200008B45E883C0018D1485000000008B4"
. "54001D08B008945B48B45E883C0028D1485000000008B45400"
. "1D08B008945B08B55F88B45B401D03B45CC0F8F2D0200008B5"
. "5F48B45B001D03B45C80F8F1C0200008B45E88D14850000000"
. "08B454001D08B008945E08B45E883C0038D1485000000008B4"
. "54001D08B008945AC8B45E883C0048D1485000000008B45400"
. "1D08B008945A88B45E883C0058D1485000000008B454001D08"
. "B008945DC8B45E883C0068D1485000000008B454001D08B008"
. "945D88B45AC3945A80F4D45A88945A4C745EC00000000E9820"
. "000008B45EC3B45AC7D378B55E08B45EC01D08D14850000000"
. "08B453801D08B108B45F001D089C28B453001D00FB6003C317"
. "40E836DDC01837DDC000F884E0100008B45EC3B45A87D378B5"
. "5E08B45EC01D08D1485000000008B453C01D08B108B45F001D"
. "089C28B453001D00FB6003C30740E836DD801837DD8000F881"
. "20100008345EC018B45EC3B45A40F8C72FFFFFF837DC4000F8"
. "5840000008B551C8B45F801C28B454889108B454883C0048B4"
. "D208B55F401CA89108B45488D50088B45B489028B45488D500"
. "C8B45B08902C745C4040000008B45F42B45B08945D08B55B08"
. "9D001C001D08945C88B55B089D0C1E00201D001C083C064894"
. "5CC837DD0007907C745D0000000008B45282B45D03B45C87D2"
. "E8B45282B45D08945C8EB238B45F83B45107E1B8B45C48D500"
. "18955C48D1485000000008B454801D0C700FFFFFFFF8B45C48"
. "D50018955C48D1485000000008B454801D08B55E883C207891"
. "0817DC4FD0300007F788B55F88B45B401D00145D48B45242B4"
. "5D43B45CC0F8D60FDFFFF8B45242B45D48945CCE952FDFFFF9"
. "0EB0490EB01908345E8078B45E83B45440F8C83FDFFFF8345F"
. "4018B45240145F08B45F43B45C80F8C61FDFFFF8345F8018B4"
. "5E40145F08B45F83B45CC0F8C3FFDFFFF837DC4007508B8000"
. "00000EB1B908B45C48D1485000000008B454801D0C70000000"
. "000B80100000083C4605B5DC2440090"
x64:="554889E54883EC60894D10895518448945204C894D288B4"
. "5400FAF45308B5538C1E20201D08945F48B5548B8000000002"
. "9D0C1E00289C28B453001D08945F0C745EC00000000C745D80"
. "0000000C745D4000000008B45488945D08B45508945CCC745C"
. "800000000837D10000F85C90000008B4518C1E81025FF00000"
. "08945C48B4518C1E80825FF0000008945C08B451825FF00000"
. "08945BCC745F800000000E985000000C745FC00000000EB6A8"
. "B45F483C0024863D0488B45284801D00FB6000FB6C03B45C47"
. "5438B45F483C0014863D0488B45284801D00FB6000FB6C03B4"
. "5C075288B45F44863D0488B45284801D00FB6000FB6C03B45B"
. "C75108B45EC4863D0488B45604801D0C600318345FC018345F"
. "4048345EC018B45FC3B45487C8E8345F8018B45F00145F48B4"
. "5F83B45500F8C6FFFFFFFE959020000837D10010F85B600000"
. "08B451883C001C1E007894518C745F800000000E98D000000C"
. "745FC00000000EB728B45F483C0024863D0488B45284801D00"
. "FB6000FB6C06BD0268B45F483C0014863C8488B45284801C80"
. "FB6000FB6C06BC04B8D0C028B45F44863D0488B45284801D00"
. "FB6000FB6D089D0C1E00429D001C83B451873108B45EC4863D"
. "0488B45604801D0C600318345FC018345F4048345EC018B45F"
. "C3B45487C868345F8018B45F00145F48B45F83B45500F8C67F"
. "FFFFFE999010000C745F800000000E98D000000C745FC00000"
. "000EB728B45EC4863D0488B4558488D0C028B45F483C002486"
. "3D0488B45284801D00FB6000FB6C06BD0268B45F483C0014C6"
. "3C0488B45284C01C00FB6000FB6C06BC04B448D04028B45F44"
. "863D0488B45284801D00FB6000FB6D089D0C1E00429D04401C"
. "0C1F80788018345FC018345F4048345EC018B45FC3B45487C8"
. "68345F8018B45F00145F48B45F83B45500F8C67FFFFFF8B454"
. "883E8018945B88B455083E8018945B4C745F801000000E9CA0"
. "00000C745FC01000000E9AE0000008B45F80FAF454889C28B4"
. "5FC01D08945EC8B45EC4863D0488B45584801D00FB6000FB6D"
. "08B451801D08945F08B45EC4898488D50FF488B45584801D00"
. "FB6000FB6C03B45F07F538B45EC4898488D5001488B4558480"
. "1D00FB6000FB6C03B45F07F388B45EC2B45484863D0488B455"
. "84801D00FB6000FB6C03B45F07F1D8B55EC8B454801D04863D"
. "0488B45584801D00FB6000FB6C03B45F07E108B45EC4863D04"
. "88B45604801D0C600318345FC018B45FC3B45B80F8C46FFFFF"
. "F8345F8018B45F83B45B40F8C2AFFFFFFC745EC00000000E90"
. "D0100008B45EC4898488D148500000000488B8580000000480"
. "1D08B008945E48B45E48945E88B45E88945F48B45EC4898488"
. "3C001488D148500000000488B85800000004801D08B008945B"
. "88B45EC48984883C002488D148500000000488B85800000004"
. "801D08B008945B4C745F800000000E989000000C745FC00000"
. "000EB748B45F48D50018955F44863D0488B45684801D00FB60"
. "03C31752C8B45E88D50018955E84898488D148500000000488"
. "B45704801C28B45F80FAF454889C18B45FC01C88902EB2A8B4"
. "5E48D50018955E44898488D148500000000488B45784801C28"
. "B45F80FAF454889C18B45FC01C889028345FC018B45FC3B45B"
. "87C848345F8018B45F83B45B40F8C6BFFFFFF8345EC078B45E"
. "C3B85880000000F8CE4FEFFFF8B45D40FAF454889C28B45D80"
. "1D08945F48B45480FAF45CCBA0100000029C289D08945E8C74"
. "5FC00000000E929030000C745F800000000E907030000C745E"
. "C00000000E9E20200008B45EC48984883C001488D148500000"
. "000488B85800000004801D08B008945B88B45EC48984883C00"
. "2488D148500000000488B85800000004801D08B008945B48B5"
. "5FC8B45B801D03B45D00F8F8C0200008B55F88B45B401D03B4"
. "5CC0F8F7B0200008B45EC4898488D148500000000488B85800"
. "000004801D08B008945E48B45EC48984883C003488D1485000"
. "00000488B85800000004801D08B008945B08B45EC48984883C"
. "004488D148500000000488B85800000004801D08B008945AC8"
. "B45EC48984883C005488D148500000000488B8580000000480"
. "1D08B008945E08B45EC48984883C006488D148500000000488"
. "B85800000004801D08B008945DC8B45B03945AC0F4D45AC894"
. "5A8C745F000000000E9920000008B45F03B45B07D3F8B55E48"
. "B45F001D04898488D148500000000488B45704801D08B108B4"
. "5F401D04863D0488B45604801D00FB6003C31740E836DE0018"
. "37DE0000F88790100008B45F03B45AC7D3F8B55E48B45F001D"
. "04898488D148500000000488B45784801D08B108B45F401D04"
. "863D0488B45604801D00FB6003C30740E836DDC01837DDC000"
. "F88350100008345F0018B45F03B45A80F8C62FFFFFF837DC80"
. "00F85970000008B55388B45FC01C2488B85900000008910488"
. "B85900000004883C0048B4D408B55F801CA8910488B8590000"
. "000488D50088B45B88902488B8590000000488D500C8B45B48"
. "902C745C8040000008B45F82B45B48945D48B55B489D001C00"
. "1D08945CC8B55B489D0C1E00201D001C083C0648945D0837DD"
. "4007907C745D4000000008B45502B45D43B45CC7D368B45502"
. "B45D48945CCEB2B8B45FC3B45207E238B45C88D50018955C84"
. "898488D148500000000488B85900000004801D0C700FFFFFFF"
. "F8B45C88D50018955C84898488D148500000000488B8590000"
. "0004801D08B55EC83C2078910817DC8FD0300007F7B8B55FC8"
. "B45B801D00145D88B45482B45D83B45D00F8DEFFCFFFF8B454"
. "82B45D88945D0E9E1FCFFFF90EB0490EB01908345EC078B45E"
. "C3B85880000000F8C0FFDFFFF8345F8018B45480145F48B45F"
. "83B45CC0F8CEDFCFFFF8345FC018B45E80145F48B45FC3B45D"
. "00F8CCBFCFFFF837DC8007508B800000000EB23908B45C8489"
. "8488D148500000000488B85900000004801D0C70000000000B"
. "8010000004883C4605DC390909090909090909090"
MCode(MyFunc, A_PtrSize=8 ? x64:x32)
}
;--------------------------------------
; 统计字库文字的个数和宽高,将解释文字存入数组并删除<>
;--------------------------------------
wenzitab:=[], num:=0, wz:="", j:=""
Loop, Parse, wenzi, |
{
v:=A_LoopField, txt:="", e1:=cha1, e0:=cha0
; 用角括号输入每个字库字符串的识别结果文字
if RegExMatch(v,"<([^>]*)>",r)
v:=StrReplace(v,r), txt:=r1
; 可以用中括号输入每个文字的两个容差,以逗号分隔
if RegExMatch(v,"\[([^\]]*)]",r)
{
v:=StrReplace(v,r), r2:=""
StringSplit, r, r1, `,
e1:=r1, e0:=r2
}
; 记录每个文字的起始位置、宽、高、10字符的数量和容差
StringSplit, r, v, .
w:=r1, v:=base64tobit(r2), h:=StrLen(v)//w
if (r0<2 or w>sw or h>sh or StrLen(v)!=w*h)
Continue
if InStr(c,"-")
{
r:=e1, e1:=e0, e0:=r, v:=StrReplace(v,"1","_")
v:=StrReplace(StrReplace(v,"0","1"),"_","0")
}
len1:=StrLen(StrReplace(v,"0"))
len0:=StrLen(StrReplace(v,"1"))
e1:=Round(len1*e1), e0:=Round(len0*e0)
j.=StrLen(wz) "|" w "|" h
. "|" len1 "|" len0 "|" e1 "|" e0 "|"
wz.=v, wenzitab[++num]:=Trim(txt)
}
IfEqual, wz,, Return, 0
;--------------------------------------
; wz 使用Astr参数类型可以自动转为ANSI版字符串
; in 输入各文字的起始位置等信息,out 返回结果
; ss 等为临时内存,jiange 超过间隔就会加入*号
;--------------------------------------
mode:=InStr(c,"**") ? 2 : InStr(c,"*") ? 1 : 0
c:=RegExReplace(c,"[*\-]"), jiange:=5, num*=7
VarSetCapacity(in,num*4,0), i:=-4
Loop, Parse, j, |
if (A_Index<=num)
NumPut(A_LoopField, in, i+=4, "int")
VarSetCapacity(gs, sw*sh)
VarSetCapacity(ss, sw*sh, Asc("0"))
k:=StrLen(wz)*4
VarSetCapacity(s1, k, 0), VarSetCapacity(s0, k, 0)
VarSetCapacity(out, 1024*4, 0)
if DllCall(&MyFunc, "int",mode, "uint",c
, "int",jiange, "ptr",Scan0, "int",Stride
, "int",sx, "int",sy, "int",sw, "int",sh
, "ptr",&gs, "ptr",&ss
, "Astr",wz, "ptr",&s1, "ptr",&s0
, "ptr",&in, "int",num, "ptr",&out)
{
ocr:="", i:=-4 ; 返回第一个文字的中心位置
x:=NumGet(out,i+=4,"int"), y:=NumGet(out,i+=4,"int")
w:=NumGet(out,i+=4,"int"), h:=NumGet(out,i+=4,"int")
rx:=x+w//2, ry:=y+h//2
While (k:=NumGet(out,i+=4,"int"))
v:=wenzitab[k//7], ocr.=v="" ? "*" : v
Return, 1
}
Return, 0
}

MCode(ByRef code, hex)
{
ListLines, Off
bch:=A_BatchLines
SetBatchLines, -1
VarSetCapacity(code, StrLen(hex)//2)
Loop, % StrLen(hex)//2
NumPut("0x" . SubStr(hex,2*A_Index-1,2)
, code, A_Index-1, "char")
Ptr:=A_PtrSize ? "Ptr" : "UInt"
DllCall("VirtualProtect", Ptr,&code, Ptr
,VarSetCapacity(code), "uint",0x40, Ptr . "*",0)
SetBatchLines, %bch%
ListLines, On
}

base64tobit(s) {
ListLines, Off
s:=RegExReplace(s,"\s+")
Chars:="0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZ"
. "abcdefghijklmnopqrstuvwxyz"
SetFormat, IntegerFast, d
StringCaseSense, On
Loop, Parse, Chars
{
i:=A_Index-1, v:=(i>>5&1) . (i>>4&1)
. (i>>3&1) . (i>>2&1) . (i>>1&1) . (i&1)
s:=StrReplace(s,A_LoopField,v)
}
StringCaseSense, Off
s:=SubStr(s,1,InStr(s,"1",0,0)-1)
ListLines, On
Return, s
}

bit2base64(s) {
ListLines, Off
s:=RegExReplace(s,"\s+")
s.=SubStr("100000",1,6-Mod(StrLen(s),6))
s:=RegExReplace(s,".{6}","|$0")
Chars:="0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZ"
. "abcdefghijklmnopqrstuvwxyz"
SetFormat, IntegerFast, d
Loop, Parse, Chars
{
i:=A_Index-1, v:="|" . (i>>5&1) . (i>>4&1)
. (i>>3&1) . (i>>2&1) . (i>>1&1) . (i&1)
s:=StrReplace(s,v,A_LoopField)
}
ListLines, On
Return, s
}
/************ 机器码的C源码 ************

int __attribute__((__stdcall__)) OCR( int mode
, unsigned int c, int jiange, unsigned char * Bmp
, int Stride, int sx, int sy, int sw, int sh
, unsigned char * gs, char * ss
, char * wz, int * s1, int * s0
, int * in, int num, int * out )
{
int x, y, o=sy*Stride+sx*4, j=Stride-4*sw, i=0;
int o1, o2, w, h, max, len1, len0, e1, e0;
int sx1=0, sy1=0, sw1=sw, sh1=sh, Ptr=0;

//准备工作一:先将图像各点在ss中转化为01字符
if (mode==0) //颜色模式
{
int R=(c>>16)&0xFF, G=(c>>8)&0xFF, B=c&0xFF;
for (y=0; y<sh; y++, o+=j)
for (x=0; x<sw; x++, o+=4, i++)
if (Bmp[2+o]==R && Bmp[1+o]==G && Bmp[o]==B)
ss[i]='1';
}
else if (mode==1) //灰度阀值模式
{
c=(c+1)*128;
for (y=0; y<sh; y++, o+=j)
for (x=0; x<sw; x++, o+=4, i++)
if (Bmp[2+o]*38+Bmp[1+o]*75+Bmp[o]*15<c)
ss[i]='1';
}
else //mode==2,边缘灰差模式
{
for (y=0; y<sh; y++, o+=j)
{
for (x=0; x<sw; x++, o+=4, i++)
gs[i]=(Bmp[2+o]*38+Bmp[1+o]*75+Bmp[o]*15)>>7;
}
w=sw-1; h=sh-1;
for (y=1; y<h; y++)
{
for (x=1; x<w; x++)
{
i=y*sw+x; j=gs[i]+c;
if (gs[i-1]>j || gs[i+1]>j
|| gs[i-sw]>j || gs[i+sw]>j)
ss[i]='1';
}
}
}

//准备工作二:生成s1、s0查表数组
for (i=0; i<num; i+=7)
{
o=o1=o2=in[i]; w=in[i+1]; h=in[i+2];
for (y=0; y<h; y++)
{
for (x=0; x<w; x++)
{
if (wz[o++]=='1')
s1[o1++]=y*sw+x;
else
s0[o2++]=y*sw+x;
}
}
}

//正式工作:ss中每一点都进行一次全字库匹配
NextWenzi:
o=sy1*sw+sx1; o1=1-sw*sh1;
for (x=0; x<sw1; x++, o+=o1)
{
for (y=0; y<sh1; y++, o+=sw)
{
for (i=0; i<num; i+=7)
{
w=in[i+1]; h=in[i+2];
if (x+w>sw1 || y+h>sh1)
continue;
o2=in[i]; len1=in[i+3]; len0=in[i+4];
e1=in[i+5]; e0=in[i+6];
max=len1>len0 ? len1 : len0;
for (j=0; j<max; j++)
{
if (j<len1 && ss[o+s1[o2+j]]!='1' && (--e1)<0)
goto NoMatch;
if (j<len0 && ss[o+s0[o2+j]]!='0' && (--e0)<0)
goto NoMatch;
}
//成功找到文字或图像
if (Ptr==0)
{
out[0]=sx+x; out[1]=sy+y;
out[2]=w; out[3]=h; Ptr=4;
//找到第一个字就确定后续查找的上下范围和右边范围
sy1=y-h; sh1=h*3; sw1=h*10+100;
if (sy1<0)
sy1=0;
if (sh1>sh-sy1)
sh1=sh-sy1;
}
else if (x>jiange) //与前一字间隔较远就添加*号
out[Ptr++]=-1;
out[Ptr++]=i+7;
if (Ptr>1021) //返回的int数组中元素个数不超过1024
goto ReturnOK;
//继续从当前文字右边再次查找
sx1+=x+w;
if (sw1>sw-sx1)
sw1=sw-sx1;
goto NextWenzi;
//------------
NoMatch:
continue;
}
}
}
if (Ptr==0)
return 0;
ReturnOK:
out[Ptr]=0;
return 1;
}

*/
;============ 脚本结束 =================;

使用说明

除了界面选强和选镜,可以通过按小键盘方式:
除号键+小键盘:选枪
乘号键+小键盘:选镜
自动识别:1080P,TAB界面打开,按G

配置文件

config

人已赞赏
ahkerr作品集AHKV1

数组转xml并读取

2019-12-1 22:20:15

河许人作品集精选内容

[更新1.5]AutoHotkey从入门到精通

2019-12-17 21:49:39

12 条回复 A文章作者 M管理员
  1. 牛逼 在下白嫖了

  2. 怎么用啊?

  3. 不明觉厉 lbw NB

  4. 1

  5. 打算用feiyue最新版本的findtext更新下

  6. 大佬说下怎么加载ini,

    • 你知道怎么用了么????

    • 小键盘相关的功能,F8暂停

    • ahk用上号器上不去pubg,不敢用自己的号

    • 请问 csgo 的怎么用啊 我想买一个 我不会这个东西想买一个做好的

  7. 哪你告诉我怎么玩? 怎么开启?

个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
有新消息 消息中心
搜索