//后台控制开心宝贝跨栏比赛
UserVar LoopNum=10 循环比赛次数
UserVar ClassName=DropList{训练:训练|正式比赛:正式比赛}=1 是否正式比赛
UserVar Delaytime=150 延迟时间
UserVar LoopDelay=50 循环延迟时间
//运动类别坐标,下面是跨栏比赛
TYIcoX=240
TYIcoY=240
//跨栏比赛类型坐标,下面是比赛
If ClassName = "训练"
    ClassPosX=360
    ClassPosY=220
Else 
    ClassPosX=220
    ClassPosY=220
EndIf 
//选定比赛队员的OK按钮位置坐标
OkPosX=600
OkPosY=380
//开始比赛的按钮坐标位置
StartPosX=360
StartPosY=200
//宠物坐标
PetX=280
PetY=330
Plugin Hwnd=Window.MousePoint()
For LoopNum
    Delay 500
    Plugin Bkgnd.LeftClick(Hwnd,TYIcoX,TYIcoY)
    Delay 500
    //检查是否还可以进行正式比赛
    If ClassName = "正式比赛"
        Plugin Flag=Bkgnd.GetPixelColor(Hwnd,210,215)
        If Flag = "777777"
            MessageBox "正式比赛次数已经用完,脚本运行结束!"
            EndScript 
        EndIf 
    EndIf 
    Plugin Bkgnd.LeftClick(Hwnd,ClassPosX,ClassPosY)
    Delay 500
    Plugin Bkgnd.LeftClick(Hwnd,OkPosX,OkPosY)
    Delay 500
    Plugin Bkgnd.LeftClick(Hwnd,StartPosX,StartPosY)
    //
    //检查起跑标志
    //
    Rem 检查起跑标志
    Plugin GoColor = Bkgnd.GetPixelColor(Hwnd,350,250)
    If GoColor = "0099FF"
        Plugin Bkgnd.LeftClick(Hwnd,PetX,PetY)
    Else 
        Goto 检查起跑标志
    EndIf 
    //
    Rem 跨栏进行中
    //
    Delay LoopDelay
    //终点线标志,在发现终点线之前,循环进行跨栏
    Plugin EndLinePos = Bkgnd.FindColor(hwnd,350,390,380,415,"F4F4F4")
    If EndLinePos = "-1|-1"
        //
        //检查栏杆
        //
        Plugin LanGanPos = Bkgnd.FindColor(hwnd,315,400,345,425,"A3A89B")
        If LanGanPos <> "-1|-1"
            Plugin Bkgnd.LeftClick(Hwnd,PetX,PetY)
            //
            //检查是否有水坑
            //
            Delay delaytime
            Plugin WaterPos = Bkgnd.FindColor(hwnd,280,400,380,420,"D7D17D")
            If WaterPos <> "-1|-1"
                For 10
                    Delay 100
                    Plugin Bkgnd.LeftClick(Hwnd,PetX,PetY)
                EndFor 
            EndIf 
        EndIf 
        //
        //检查西瓜皮
        //
        Plugin GuoPiPos = Bkgnd.FindColor(hwnd,320,390,350,420,"310AA9")
        If GuoPiPos <> "-1|-1"
            Plugin Bkgnd.LeftClick(Hwnd,PetX,PetY)
            Delay delaytime
        EndIf 
        //
        //检查加速器
        //
        Plugin JiaSuPos = Bkgnd.FindColor(hwnd,220,390,320,420,"4DA33D")
        If JiaSuPos <> "-1|-1"
            Plugin Bkgnd.LeftClick(Hwnd,PetX,PetY)
            Delay delaytime
        EndIf 
        //Delay delaytime
        Rem 循环结束
        Goto 跨栏进行中
    EndIf 
    //
    //查看成绩