TracePrint "2秒过程开始获取句柄"
Delay 1000
dim letu_hwnd,rect,letu_rect,x,y
Plugin letu_hwnd=Window.MousePoint()
TracePrint letu_hwnd
Plugin rect=Window.GetClientRect(letu_hwnd)
letu_rect=split(rect,"|")
TracePrint rect
//调用杀怪过程
Gosub letu_kill_monst_sub
//结束脚本
EndScript 
//杀怪过程
Sub letu_kill_monst_sub
    //定义杀怪屏幕区域和杀怪的颜色------用户变量
    dim letukillmonstxy
    UserVar letu_kill_monst_left=400  //屏幕左边
    UserVar letu_kill_monst_top=100  //屏幕上边
    UserVar letu_kill_monst_right=1440  //屏幕右边
    UserVar letu_kill_monst_bottom=700  //屏幕下边
    UserVar letu_kill_monst_c="00A5FF"  //怪的颜色
    //增加找到怪颜色点后的点击偏移
    UserVar letu_kill_monst_py=10   //鼠标偏移
    i=0
    //调用提示窗口处理过程:取消乐土游戏中的提示窗口
    While 1
        Gosub letu_ClearWindowSub
        //找怪
        Plugin letuxy=Bkgnd.FindColor(letu_hwnd,letu_kill_monst_left-letu_rect(0),letu_kill_monst_top-letu_rect(1),letu_kill_monst_right-letu_rect(0),letu_kill_monst_bottom-letu_rect(1),letu_kill_monst_c)
        If letuxy<>"-1|-1"
            letukillmonstxy=split(letuxy,"|")
            letu_kill_monst_x=letukillmonstxy(0)+letu_kill_monst_py
            letu_kill_monst_y=letukillmonstxy(1)+letu_kill_monst_py
            Plugin Bkgnd.LeftClick(letu_hwnd, letu_kill_monst_x, letu_kill_monst_y)
            Plugin Bkgnd.MoveTo(letu_hwnd, 400, 300)
            i=i+1  //作为移动控制参数
            TracePrint letuxy & "--------------" & i
            Delay 7000
            Gosub letu_yidong
        Else 
            Gosub letu_yidong
        EndIf 
        Delay 300
    EndWhile 
Return 
Sub chiyao
    Plugin htys=Bkgnd.GetPixelColor(hWnd,435,188)
    //后台取色
    If htys="EA5500"
        VBSCall MessageBox("Background Color has been found!")
        Plugin Bkgnd.KeyPress(hWnd,123)
    Else 
        VBSCall MessageBox("Can't find the Color!")
        Plugin Bkgnd.KeyPress(hWnd,123)
    EndIf 
    //F3红,F4蓝
    VBS hong=70
    //血量少于百分之多少(可自行设定)时,脚本自动吃红。
    VBS lan=30
    //蓝少于百分之多少(可自行设定)时,脚本自动吃蓝。
    Rem start
    Delay 32
    //如果启动脚本后有点卡,则视情况调整此延时。
    Rem 补红
    IfColor hong*1.28+21,5,4a5373,2
        //如果设定位置处的颜色大约等于没血时的颜色
        KeyPress 114,1
        //按键F3
        Delay 256
    EndIf 
    Rem 补蓝
    IfColor lan*1.28+21,18,734b4a,2
        //如果设定位置处的颜色大约等于没蓝时的颜色
        KeyPress 115,1
        //按键F4
        Delay 256
    EndIf 
Return 
Sub letu_yidong
    i1=i  //移动   取i 是否被2整除 决定上下移动方向
    If i1 mod 2 =0
        Plugin Bkgnd.Keydown(letu_hwnd,87)
        Delay 500
        Gosub letu_kill_monst_sub
    Else 
        Plugin Bkgnd.Keydown(letu_hwnd,83)
        Delay 500
        Gosub letu_kill_monst_sub
    EndIf 
Return 
//关闭:各种“提示”窗口,窗口宽度不变,确定按钮516一列颜色
Sub letu_ClearWindowSub
    dim Clear_Win_rect,Clear_Win_Color,Clear_Win_x,Clear_Win_y
    Clear_Win_x1=400
    Clear_Win_y1=200
    Clear_Win_y2=800
    Plugin Clear_Win_rect=Bkgnd.FindColor(letu_hwnd,Clear_Win_x1,Clear_Win_y1-letu_rect(1),Clear_Win_x1+800,Clear_Win_y2-letu_rect(1),"717AD8")
    If Clear_Win_rect<>"-1|-1"
        Clear_Win_xy=split(Clear_Win_rect,"|")
        Clear_Win_x=Clear_Win_xy(0)