Cor="33CC66"
    If allx=1280 and ally=800 then    
      Call FindCenterColor(144,323,316,454,Cor,x,y)
    Else
      Call FindCenterColor(18,322,202,438,Cor,x,y)
    End if
    //MessageBox(x & "  " & y)
    //区域从中间向外查找颜色。144,323,316,454为区域范围,Cor为颜色变量,x,y为坐标变量
    //If x>0 and y>0 Then
    While x>0 and y>0
        //如果找到颜色
        Delay 100
        //MessageBox(MFi & "  " & MF(MFi,1))
        While MF(MFi,1)=0 and MFi<=10
          MFi=MFi+1
        Wend
       // MessageBox(MFi & "  " & MF(MFi,1))
        If MFi>10 THEN
          found=true //说明所有的建筑都无法升级,直接跳过升级建筑功能
          MFi=1
          goto 跳过建筑升级
        else
          MoveTo MF(MFi,1),MF(MFi,2)
          Delay 500
          LeftClick 2 
          Delay 1000
          found=false
        End If
        outi=0
        Call FindPic(150,100,1100,650,"傲视天地\按钮建筑升级.bmp",0.9,intX,intY)
        While not found and outi<3
            If intX>0 and intY>0 then
                MoveTo intX,intY
                Delay 500
                LeftClick 2                    
                found=true
            End if
            If not found then
                MoveTo MF(MFi,1),MF(MFi,2)
                Delay 500
                LeftClick 2 
                Delay 1000
                Call FindPic(150,100,1100,650,"傲视天地\按钮建筑升级.bmp",0.9,intX,intY)
                Delay 500
                Call FindPic(150,100,1100,650,"傲视天地\按钮建筑无法升级.bmp",0.9,intX1,intY1)
                Delay 500
                If intX1>0 and intY1>0 then
               //   MessageBox(MFi & "位置无法继续升级!" & MF(MFi,1))
                  MF(MFi,1)=0:MF(MFi,2)=0
                  
                  found=true
                End If
            end If
            outi=outi+1
        Wend

        MFi=MFi+1
        If MFi=11 Then
          MFi=1
        End If
        found=false:outi=0
        Call FindPic(150,100,1100,650,"傲视天地\按钮关闭窗口.bmp",0.9,intX,intY)
        While not found and outi<3
            If intX>0 and intY>0 then
                MoveTo intX,intY
                Delay 500
                LeftClick 2                    
                found=true
            End if
            If not found then
                Call FindPic(150,100,1100,650,"傲视天地\按钮关闭窗口.bmp",0.9,intX,intY)
                Delay 500
            end If
            outi=outi+1
        Wend
        If allx=1280 and ally=800 then    
          Call FindCenterColor(144,323,316,454,Cor,x,y)
        Else
          Call FindCenterColor(18,322,202,438,Cor,x,y)
        End if
    wend   
    //End If
    //条件结束
End If 
Rem 跳过建筑升级
if DateDiff("s",t2,now)>=t2jg then
t2=now
NTi=1 //自动占领空白农田 按照顺序
If NongTian=1 then
    Delay 500
    Call FindPic(150,100,1280,800,"傲视天地\场景按钮农田.bmp",0.9,intX,intY)
    If intX>0 and intY>0 then
       // MessageBox(intX & "," & intY)
        MoveTo intX,intY
        Delay 500
        LeftClick 2  
        Delay 2500
    
        found=false
        While not found and NTi<=5