// ***** ***** Function ***** ***** //

//**Function
//功能:判断屏幕分辨率
//返回:四个坐标的字符串
Function getParameter()
    Dim iLT,iRT,iLB,iRB        //int 四个角的坐标
    iWidth = Plugin.Sys.GetScRX() //得到屏幕的宽度
    iHeight = Plugin.Sys.GetScRY() //得到屏幕的高度
    If iWidth=800 Then
        iLT=0
        iRT=0
        iLB=0
        iRB=0
    ElseIf iWidth=1024 Then
        iLT=112 //加上坐标偏移
        iRT=84
        iLB=112
        iRB=84        
    ElseIf iWidth=1280 Then
        iLT=240 //加上坐标偏移
        iRT=100
        iLB=240
        iRB=100        
    End If

    iLT=iLT+380        //LeftTop 左上角
    iRT=iRT+345        //RightTop 右上角
    iLB=iLB+420        //LeftBottom 左下角
    iRB=iRB+355        //RightBottom 右下角
    getParameter=iLT&"|"&iRT&"|"&iLB&"|"&iRB        //返回字符串
End Function

//**Function
//功能:判断射程内是否有敌人
//返回:是True,否False
Function findFoe(iLT,iRT,iLB,iRB)
    Dim sColor(3)        //Array(string) 用于存放颜色的数组
    Dim i        //int 循环变量
    Dim iX,iY        //int 得到颜色的坐标
    Dim bHave        //boolean 是否找到敌人
    //初始化颜色
    sColor(0)="3239A0"
    sColor(1)="2A3EB8"
    sColor(2)="1849F0"
    sColor(3)="1849F0"
    
    bHave=false        //初始化
        
    //找颜色
    For i=0 to 3 step 1
        Call FindColorEx(iLT,iRT,iLB,iRB,sColor(i),1,0.8,iX,iY)
        If iX>0 And iY>0
            bHave=true        //找到了
            KeyPress 44, 1
            Goto rHave        //跳出
        End If
    Next
    
    Rem rHave
    findFoe=bHave//Return 函数返回值
End Function

//**Function
//功能:判断是否没有命中敌人
//返回:是True,否False
Function noBingo()
    Dim iX,iY        //int 得到颜色的坐标
    Call FindColorEx(iWidth/2-5,iHeight/2-5,iWidth/2+5,iHeight+5,"7E7EC0",1,0.8,iX,iY)
        
    If iX > 0 Then
        noBingo=True
    Else
        noBingo=False
    End If
        
End Function
        
// ***** ***** Sub ***** ***** //

//**Sub
//功能:射击
Sub shootFoe()
    LeftClick iFN //左键单击 * 次
    Delay iFD //延迟 * 毫秒
End Sub

//**Sun
//参数(字符串,秒,第几行)
//功能:显示字符串
Sub showStr(str,n,row)
    For n*100
        Delay 1
        Call Plugin.Msg.ShowScrTXT(0, (row-1)*19, 120, 19, str, "0000FF")
    Next
End Sub

//**Sun
//功能:设置开枪延迟
//# 多线程启动