dim n,k
dim x(4),y(4)
xh=0
yd=1
// 用于检测当前图中是否有怪
n=5
// 控制扫描速度
k=40
// 控制扫描密度
Rem start
i=1
While i<5
    // 给方形四个角赋初值
    x(i)=512
    y(i)=384
    i=i+1
EndWhile 
x(1)=x(1)-k
x(2)=x(2)+k
x(3)=x(3)+k
x(4)=x(4)-k
y(1)=y(1)-k
y(2)=y(2)-k
y(3)=y(3)+k
y(4)=y(4)+k
j=0
// 沿方形上边移动
While x(1)<x(2)
    MoveTo x(1),y(1)
    Delay 20
    VBSCall Shape=GetCursorShape(0)
    If shape = 1223392300
        Goto pk
    EndIf 
    j=j+1
    x(1)=x(1)+n*j
    Delay 10
EndWhile 
j=0
// 沿方形右边移动
While y(2)<y(3)
    MoveTo x(2),y(2)
    Delay 20
    VBSCall Shape=GetCursorShape(0)
    If shape = 1223392300
        Goto pk
    EndIf 
    j=j+1
    y(2)=y(2)+n*j
    Delay 10
EndWhile 
j=0
// 沿方形下边移动
While x(3)>x(4)
    MoveTo x(3),y(3)
    Delay 20
    VBSCall Shape=GetCursorShape(0)
    If shape = 1223392300
        Goto pk
    EndIf 
    j=j+1
    x(3)=x(3)-n*j
    Delay 10
EndWhile 
j=0
// 沿方形左边移动
While y(4)>y(1)
    MoveTo x(4),y(4)
    Delay 20
    VBSCall Shape=GetCursorShape(0)
    If shape = 1223392300
        Goto pk
    EndIf 
    j=j+1
    y(4)=y(4)-n*j
    Delay 10
EndWhile 
// 搜索3次后,无怪,换位置
xh=xh+1
If xh>3
    If yd=1
        MoveTo 270,395
        yd=yd+1
        LeftDown 1
        Delay 2000
        LeftUp 1
        xh=0
        Goto start
    Else 
        MoveTo 754,395
        yd=yd-1
        LeftDown 1
        Delay 2000
        LeftUp 1
        xh=0
        Goto start
    EndIf 
EndIf 
Gosub jx
k=k+40