和之前战士差不多的功能,挂机地图是尸魔洞2层。玩了两天,腻了,游戏也删了。把脚本记录下来,好歹算是学习按键精灵的过程。
功能
自动打怪、捡物、买双倍卷轴、买药,自动修复装备。
脚本
//设置大漠路径以及字库名=("")("d:")=(0,"")//绑定窗口和模式hwnd=()=dm.BindWindow(hwnd,"dx2","windows","windows",0)//初始化跑图路径Dimnnnn=1Rem开始Call买物品()Call打宝箱()Call打身边怪()Call捡身边物()Call打半屏怪()Delay1000Call捡全屏物()Call打全屏怪()Call找怪()Call跑图()Goto开始Sub打宝箱()dm_ret=dm.FindStrFast(0,0,800,438,"宝|箱","ffffff-000000",1.0,intX,intY)IfintX=0andintY=0Thendm.MoveTointX+20,intY+10Delay20dm.KeyPress113Delay1500Goto开始EndIfEndSubSub打身边怪()//身边怪物(名字判断)dm_ret=dm.FindStrFast(279,119,508,294,"恶|灵","ffffff-000000",1.0,intX,intY)IfintX=0andintY=0Thendm.MoveTo390,230Delay20dm.KeyPress113Delay500dm.MoveToEx20,400,5,5Delay500dm.MoveToEx20,400,5,5Delay500Goto开始EndIfEndSubSub打半屏怪()//半屏怪物(名字判断)dm_ret=dm.FindStrFast(155,76,661,358,"恶|灵","ffffff-000000",1.0,intX,intY)IfintX=0andintY=0Thendm.MoveTointX+20,intY+20Delayboos脚本传奇私服20dm.KeyPress113Delay500dm.MoveToEx20,400,5,5Delay500dm.MoveToEx20,400,5,5Delay500Goto开始EndIfEndSubSub打全屏怪()//全屏怪物(名字判断)dm_ret=dm.FindStrFast(0,0,800,438,"恶|灵","ffffff-000000",1.0,intX,intY)IfintX=0andintY=0Thendm.MoveTointX+20,intY+20Delay20dm.KeyPress113Delay500dm.MoveToEx20,400,5,5Delay500dm.MoveToEx20,400,5,5Delay500Goto开始EndIfEndSubSub捡身边物()//身边物品dm_ret=dm.FindStrFast(213,63,574,354,"神|强|金","ff0000-000000|ffffff-000000|88ddee-000000",1.0,intX,intY)IfintX=0andintY=0Thendm.MoveTointX+20,intY+20Delay200dm.LeftClickDelay100dm.MoveToEx20,400,5,5Delay100dm.MoveToEx20,400,5,5Delay700Goto开始EndIfEndSubSub捡全屏物()//全屏物品dm_ret=dm.FindStrFast(0,0,800,438,"神|强|金","ff0000-000000|ffffff-000000|88ddee-000000",1.0,intX,intY)IfintX=0andintY=0Thendm.MoveTointX+20,intY+20Delay200dm.LeftClickDelay100dm.MoveToEx20,400,5,5Delay100dm.MoveToEx20,400,5,5Delay700Goto开始EndIfEndSubSub找怪()//小地图找怪dm_ret=dm.FindMultiColor(608,0,800,160,"ff0000","0|1|ff0000,0|2|ff0000,0|3|ff0000,1|1|ff0000",1.0,0,intX,intY)IfintX=0andintY=0Theni=1For5dm.MoveTointX+i,intY+idm.RightClicki=i+1Delay100NextEndIfDelay1000//判断是否有怪,有怪停止移动dm_ret=dm.FindStrFast(0,0,800,438,"恶|灵","ffffff-000000",1.0,intX,intY)IfintX=0andintY=0Thendm.MoveTo390,230Delay20dm.RightClickGoto开始ElseFor3Delay1000dm_ret=dm.FindStrFast(0,0,800,438,"恶|灵","ffffff-000000",1.0,intA,intB)IfintA=0andintB=0Thendm.MoveTo390,230Delay20dm.RightClickGoto开始EndIfNextEndIfEndSubSub买物品()hong=dm.Ocr(304,425,318,440,"ffffff-000000",1.0)lan=dm.Ocr(346,423,366,439,"ffffff-000000",1.0)suiji=dm.Ocr(517,424,536,438,"ffffff-000000",1.0)TracePrint"红:"hong"蓝:"lan"随机:"suijiIfhong=0ThenDelay1000hong=dm.Ocr(304,425,318,440,"ffffff-000000",1.0)Ifhong=0ThenCall买红()EndIfEndIfIflan=0ThenDelay1000lan=dm.Ocr(346,423,366,439,"ffffff-000000",1.0)Iflan=0ThenCall买蓝()EndIfEndIfIfsuiji=0ThenDelay1000suiji=dm.Ocr(517,424,536,438,"ffffff-000000",1.0)Ifsuiji=0ThenCall买随机()EndIfEndIfdm_ret=dm.FindMultiColor(0,0,800,438,"440000","1|0|993300,2|0|dd7700,3|0|ffaa00,4|0|eebb00",1.0,0,intX,intY)Ifdm_ret=0ThenCall买双倍()EndIfEndSubSub买红()dm.MoveTo766,566Delay20dm.LeftClickDelay2000dm_ret=dm.FindStrFast(0,0,800,438,"金币区","efd6ad-000000",1.0,intX,intY)IfintX=0andintY=0Thendm.MoveTointX+20,intY+10Delay20dm.LeftClickEndIfDelay1000dm_ret=dm.FindStrFast(0,0,800,438,"金创药","00ff00-000000",1.0,intX,intY)IfintX=0andintY=0Thendm.MoveTointX+20,intY+10Delay20dm.LeftClickEndIfDelay1000//加号dm_ret=dm.FindMultiColor(0,0,800,438,"080000","0|1|f7de39,0|2|f7de39,0|3|080000,0|4|6b5239",1.0,0,intX,intY)IfintX=0andintY=0ThenTracePrint123dm.MoveTointX-30,intYDelay200dm.LeftClickDelay20dm.KeyPress48EndIfDelay1000//付费购买按钮dm_ret=dm.FindMultiColor(0,0,800,438,"8c8439","0|1|fff76b,0|2|efe763,0|3|efe763,0|4|efe763",1.0,0,intX,intY)IfintX=0andintY=0Thendm.MoveTointX+20,intY+10Delay20dm.LeftClickEndIfDelay1000//确定按钮dm_ret=dm.FindStrFast(0,0,800,438,"确定","efd6ad-000000",1.0,intX,intY)IfintX=0andintY=0Thendm.MoveTointX+20,intY+10Delay20dm.LeftClickEndIf//打开背包dm.MoveTo693,399Delay20dm.LeftClickDelay1000//解开红药dm_ret=dm.FindMultiColor(0,0,800,600,"7b3118","1|0|6b3118,2|0|6b3118,3|0|7b3118,4|0|942918",1.0,0,intX,intY)IfintX=0andintY=0Thendm.MoveTointX,intYDelay2000dm.RightClickDelay2000EndIf//修理装备dm_ret=dm.FindMultiColor(0,0,800,600,"d6c6ad","1|0|bda57b,2|0|efc68c,3|0|f7f7de,4|0|b5a594",1.0,0,intX,intY)IfintX=0andintY=0Thendm.MoveTointX,intYDelay2000dm.RightClickDelay2000EndIfdm.KeyPress27Delay1000dm.KeyPress27Delay1000dm.KeyPress27dm.MoveToEx20,400,5,5EndSubSub买蓝()dm.MoveTo766,566Delay20dm.LeftClickDelay2000dm_ret=dm.FindStrFast(0,0,800,438,"金币区","efd6ad-000000",1.0,intX,intY)IfintX=0andintY=0Thendm.MoveTointX+20,intY+10Delay20dm.LeftClickEndIfDelay1000dm_ret=dm.FindStrFast(0,0,800,438,"魔法药","00ff00-000000",1.0,intX,intY)IfintX=0andintY=0Thendm.MoveTointX+20,intY+10Delay20dm.LeftClickEndIfDelay1000//加号dm_ret=dm.FindMultiColor(0,0,800,438,"080000","0|1|f7de39,0|2|f7de39,0|3|080000,0|4|6b5239",1.0,0,intX,intY)IfintX=0andintY=0ThenTracePrint123dm.MoveTointX-30,intYDelay200dm.LeftClickDelay20dm.KeyPress48EndIfDelay1000//付费购买按钮dm_ret=dm.FindMultiColor(0,0,800,438,"8c8439","0|1|fff76b,0|2|efe763,0|3|efe763,0|4|efe763",1.0,0,intX,intY)IfintX=0andintY=0Thendm.MoveTointX+20,intY+10Delay20dm.LeftClickEndIfDelay1000//确定按钮dm_ret=dm.FindStrFast(0,0,800,438,"确定","efd6ad-000000",1.0,intX,intY)IfintX=0andintY=0Thendm.MoveTointX+20,intY+10Delay20dm.LeftClickEndIfDelay1000dm.MoveTo693,399Delay20dm.LeftClickDelay1000//解开蓝药dm_ret=dm.FindMultiColor(0,0,800,600,"104284","1|0|291884,2|0|291884,3|0|215aa5,4|0|738cff",1.0,0,intX,intY)IfintX=0andintY=0Thendm.MoveTointX,intYDelay2000dm.RightClickDelay2000EndIfdm_ret=dm.FindMultiColor(0,0,800,600,"d6c6ad","1|0|bda57b,2|0|efc68c,3|0|f7f7de,4|0|b5a594",1.0,0,intX,intY)IfintX=0andintY=0Thendm.MoveTointX,intYDelay2000dm.RightClickDelay2000EndIfdm.KeyPress27Delay1000dm.KeyPress27Delay1000dm.KeyPress27dm.MoveToEx20,400,5,5EndSubSub买随机()dm.MoveTo766,566Delay20dm.LeftClickDelay2000dm_ret=dm.FindStrFast(0,0,800,438,"金币区","efd6ad-000000",1.0,intX,intY)IfintX=0andintY=0Thendm.MoveTointX+20,intY+10Delay20dm.LeftClickEndIfDelay1000dm_ret=dm.FindStrFast(0,0,800,438,"随机传送石","00ff00-000000",1.0,intX,intY)IfintX=0andintY=0Thendm.MoveTointX+20,intY+10Delay20dm.LeftClickEndIfDelay1000dm_ret=dm.FindMultiColor(0,0,800,438,"8c8439","0|1|fff76b,0|2|efe763,0|3|efe763,0|4|efe763",1.0,0,intX,intY)IfintX=0andintY=0Thendm.MoveTointX+20,intY+10Delay20dm.LeftClickEndIfDelay1000//确定按钮dm_ret=dm.FindStrFast(0,0,800,438,"确定","efd6ad-000000",1.0,intX,intY)IfintX=0andintY=0Thendm.MoveTointX+20,intY+10Delay20dm.LeftClickEndIfDelay1000dm.MoveTo693,399Delay20dm.LeftClickDelay1000dm_ret=dm.FindMultiColor(0,0,800,600,"d6c6ad","1|0|bda57b,2|0|efc68c,3|0|f7f7de,4|0|b5a594",1.0,0,intX,intY)IfintX=0andintY=0Thendm.MoveTointX,intYDelay2000dm.RightClickDelay2000EndIfdm.KeyPress27Delay1000dm.KeyPress27Delay1000dm.KeyPress27dm.MoveToEx20,400,5,5EndSubSub买双倍()dm.MoveTo766,566Delay20dm.LeftClickDelay2000dm_ret=dm.FindStrFast(0,0,800,438,"金币区","efd6ad-000000",1.0,intX,intY)IfintX=0andintY=0Thendm.MoveTointX+20,intY+10Delay20dm.LeftClickEndIfDelay1000dm_ret=dm.FindStrFast(0,0,800,438,"双倍秘籍","00ff00-000000",1.0,intX,intY)IfintX=0andintY=0Thendm.MoveTointX+20,intY+10Delay20dm.LeftClickEndIfDelay1000dm_ret=dm.FindMultiColor(0,0,800,438,"8c8439","0|1|fff76b,0|2|efe763,0|3|efe763,0|4|efe763",1.0,0,intX,intY)IfintX=0andintY=0Thendm.MoveTointX+20,intY+10Delay20dm.LeftClickEndIfDelay1000//确定按钮dm_ret=dm.FindStrFast(0,0,800,438,"确定","efd6ad-000000",1.0,intX,intY)IfintX=0andintY=0Thendm.MoveTointX+20,intY+10Delay20dm.LeftClickEndIfDelay1000dm.MoveTo693,399Delay20dm.LeftClickDelay1000dm_ret=dm.FindMultiColor(0,0,800,600,"ce3129","0|1|ff5a5a,0|2|ff5a5a,0|3|d65a52,0|4|ce3129",1.0,0,intX,intY)IfintX=0andintY=0Thendm.MoveTointX,intYDelay2000dm.RightClickDelay2000EndIfdm.KeyPress27Delay1000dm.KeyPress27Delay1000dm.KeyPress27dm.MoveToEx20,400,5,5EndSubSub自动()dm.KeyDown17Delay20dm.KeyPress76Delay20dm.KeyUp17EndSubSub跑图()zuobiao=dm.Ocr(68,583,129,599,"ffffff-000000",1.0)zuobiaox=mid(zuobiao,1,instr(zuobiao,":")-1)zuobiaoy=mid(zuobiao,instr(zuobiao,":")+1,3)If86zuobiaox76and43zuobiaoy33Thennn=2ElseIf53zuobiaox43and33zuobiaoy22Thennn=3ElseIf25zuobiaox15and60zuobiaoy50Thennn=4ElseIf65zuobiaox55and87zuobiaoy77Thennn=1EndIfSelectcasennCase1dm.MoveTo750,68Delay20dm.RightClickDelay1000Case2dm.MoveTo700,57Delay20dm.RightClickDelay1000Case3dm.MoveTo659,85Delay20dm.RightClickDelay1000Case4dm.MoveTo720,112Delay20dm.RightClickDelay1000EndSelect//判断是否有怪,有怪停止移动dm_ret=dm.FindStrFast(0,0,800,438,"恶|灵|宝|箱","ffffff-000000",1.0,intX,intY)IfintX=0andintY=0Thendm.MoveTo390,230Delay20dm.RightClickGoto开始ElseFor3Delay1000dm_ret=dm.FindStrFast(0,0,800,438,"恶|灵","ffffff-000000",1.0,intA,intB)IfintA=0andintB=0Thendm.MoveTo390,230Delay20dm.RightClickGoto开始EndIfNextEndIfEndSub
发表评论