按键精灵脚本制作教程找图脚本问题急急急

你的位置:
区域找图与if判断问题
16:58:18 |
来源: 按键精灵资源站
某个位置有5种图片可能出现,当判断出现某种图片时,执行对应这种图片的操作。假如有五个位置或者更多,怎么样简写代码呢,如果不简写的话,感觉太多了,有没有简单的方法??
FindPic 585,380,624,442, &Attachment:\0.bmp&, 0.7, intX, intY
& & If intX & 0 And intY & 0 Then
& && &&&执行A
& & End If
FindPic 585, 380, 624, 442, &Attachment:\1.bmp&, 0.7, intX, intY
& & If intX & 0 And intY & 0 Then
& && &&&执行B
FindPic <font color="#8b0,687,442, &Attachment:\0.bmp&, 0.7, intX, intY
& & If intX & 0 And intY & 0 Then
& && & 执行A
& & End If
& & FindPic <font color="#8b0,687,442, &Attachment:\1.bmp&, 0.7, intX, intY
& & If intX & 0 And intY & 0 Then
& && & 执行B
& & End If
& & FindPic 712,380,751,442, &Attachment:\0.bmp&, 0.7, intX, intY
& & If intX & 0 And intY & 0 Then
& && &&&执行A
& & End If
& & FindPic 712,380,751,442, &Attachment:\1.bmp&, 0.7, intX, intY
& & If intX & 0 And intY & 0 Then
& && &&&执行B
& & FindPic 775,380,814,442,&Attachment:\0.bmp&, 0.9, intX, intY
& & If intX & 0 And intY & 0 Then
& && &&&执行A
& & End If
& & FindPic 775,380,814,442,&Attachment:\1.bmp&, 0.7, intX, intY
& & If intX & 0 And intY & 0 Then
& && &&&执行B
& & End If
& & FindPic 838,380,877,442,&Attachment:\0.bmp&, 0.7, intX, intY
& & If intX & 0 And intY & 0 Then
& && &&&执行A
& & End If
& & FindPic <font color="#8,380,877,442,&Attachment:\1.bmp&, 0.7, intX, intY
& & If intX & 0 And intY & 0 Then
& && &&&执行B
& & End If你的位置:
如何让找图命令找齐两个图之后再执行脚本操作?
20:49:54 |
来源: 按键精灵资源站
本帖最后由
20:54 编辑
set dm = createobject(&dm.dmsoft&)
ver = dm.Ver()
PutAttachment &E:\text game&,&*.bmp&
dm.Setpath &E:\text game&
all_pic = &图1.bmp|图2.bmp&
dm_ret = dm.LoadPic(all_pic)
hwnd = Plugin.Window.Find(0, &游戏&)
dm_ret = dm.BindWindow(hwnd, &dx2&, &windows&, &windows&, 0)
dm_ret = dm.FindPic(0, 0, , &图1.bmp|图2.bmp&, &000000&, 0.9, 0, intX, intY)
If intX & 0 and intY & 0 Then
dm.moveto intX + 50, intY + 95
dm.LeftClick
dm_ret = dm.UnBindWindow()
我现在的情况是:只要找图命令找到图1或者图2其中一个图片就会执行这个脚本。
我想要的是让找图命令找到图1和图2 之后才执行命令。就是说找到其中一个图不会执行命令,必须要找全2个图才会执行脚本操作。。请问大侠该怎么改?我是菜鸟 不太懂。。你的位置:
找图两个脚本一模一样的代码,附件都是一样,为什么其中一个脚本能找到图另一个找....
07:17:58 |
来源: 按键精灵资源站
&&Delay 350
& && &&&FindPic jbx(i)+0,jby(i)+150,jbx(i)+180,jby(i)+205,&Attachment:\一.bmp&,0.9,intX,intY
& && && && &If intX & 0 And intY & 0 Then
& && &&&TracePrint &找到&
& & 偏移x=int((Rnd*11)+1):偏移y=int((Rnd*1)+0)
& & MoveTo intx+偏移x,inty+偏移y
& & Delay 150
这个图片是个字,我用了大漠找字,还有其他的一些找也是这个效果,其中一个做测试的脚本能找到,另一个怎么都找不到,这个贴我看了,里面说的情况就差
出问题了&&就差这一项我搞不懂了
,求大神指点下按键精灵找图脚本问题._百度知道
按键精灵找图脚本问题.
&#47;&#47;原脚本写FindPic 0,0,,&D:&#92;我文档&#92;神曲&#92;VIP币.bmp&,0.9,intX,intYIf intX& 0 And intY& 0 ThenMoveTo intX+20, intY+20
Delay 1000
LeftClick 1End IfDelay 1000FindPic 0,0,,&D:&#92;我文档&#92;神曲&#92;使用.bmp&,1.0,intX,intYIf intX& 0 And intY& 0 ThenMoveTo intX, intY
LeftClick 1End IfDelay 1000&#47;&#47;药瓶张图片候没.我想现运行完药瓶脚本.重新运行脚本FindPic 0, 0, , &D:&#92;我文档&#92;神曲&#92;药瓶.bmp&, 1.0, intX, intYIf intX & 0 And intY & 0 ThenMoveTo Delay 1000LeftClick 1Delay 1000MoveTo 764, 567LeftClick 1End If&#47;&#47;没现直接面脚本运行完再重新运行脚本.Delay 1000MoveTo 838, 489LeftClick 1Delay 20000MoveTo LeftClick 1Delay 1000MoveTo 746, 568LeftClick 1Delay 3000
提问者采纳
//我觉改://设置循环语句whileFindPic 0,0,,&D:&#92;我文档&#92;神曲&#92;VIP币.bmp&,0.9,intX,intYIf intX& 0 And intY& 0 ThenMoveTo intX+20, intY+20
Delay 1000
LeftClick 1End IfDelay 1000FindPic 0,0,,&D:&#92;我文档&#92;神曲&#92;使用.bmp&,1.0,intX,intYIf intX& 0 And intY& 0 ThenMoveTo intX, intY
LeftClick 1End IfDelay 1000end subFindPic 0, 0, , &D:&#92;我文档&#92;神曲&#92;药瓶.bmp&, 1.0, intX, intYIf intX & 0 And intY & 0 ThenMoveTo Delay 1000LeftClick 1Delay 1000MoveTo 764, 567LeftClick 1else Delay 1000MoveTo 838, 489LeftClick 1Delay 20000MoveTo LeftClick 1Delay 1000MoveTo 746, 568LeftClick 1Delay 3000End If wend
(语句无法识别,可能有错误):while
While true
试试看。。
您的脚本存在下列错误,将不能正常运行:语法错误:脚本 我的脚本1 ,第17行,第1个字符:(错误码0)缺少符号。语法错误:脚本 我的脚本1 ,第17行,第1个字符:(错误码119)不是预期的符号 变量或标号。语法错误:脚本 我的脚本1 ,第18行,第67个字符:(错误码0)没有找到合法的符号。语法错误:脚本 我的脚本1 ,第39行,第1个字符:(错误码0)没有找到合法的符号。改完后
while trueFindPic 0,0,,&D:&#92;我的文档&#92;神曲&#92;VIP币.bmp&,0.9,intX,intYIf intX& 0 And intY& 0 ThenMoveTo intX+20, intY+20
Delay 1000
LeftClick 1End IfDelay 1000FindPic 0,0,,&D:&#92;我的文档&#92;神曲&#92;使用.bmp&,1.0,intX,intYIf intX& 0 And intY& 0 ThenMoveTo intX, intY
LeftClick 1End IfDelay 1000FindPic 0, 0, , &D:&#92;我的文档&#92;神曲&#92;小药瓶.bmp&, 1.0, intX, intYIf intX & 0 And intY & 0 ThenMoveTo Delay 1000LeftClick 1Delay 1000MoveTo 764, 567LeftClick 1else Delay 1000MoveTo 838, 489LeftClick 1Delay 20000MoveTo LeftClick 1Delay 1000MoveTo 746, 568LeftClick 1Delay 3000End If wend 在试试看,我是按照你的原版粘贴的,没有换行,我重新修改了一下,但是也没有在按键精灵里面调试,,,,看看还有什么问题。。。
你有QQ号么我的百度名字就是QQ号希望在脚本上帮助帮助.谢谢.
提问者评价
谢谢你的耐心解答,好详细呀
改完 测试吧应该没问题//原脚本写FindPic 0,0,,&D:&#92;我文档&#92;神曲&#92;VIP币.bmp&,0.9,intX,intYIf intX& 0 And intY& 0 ThenMoveTo intX+20, intY+20
Delay 1000
LeftClick 1End IfDelay 1000FindPic 0,0,,&D:&#92;我文档&#92;神曲&#92;使用.bmp&,1.0,intX,intYIf intX& 0 And intY& 0 ThenMoveTo intX, intY
LeftClick 1End IfDelay 1000//药瓶张图片候没.我想现运行完药瓶脚本.重新运行脚本FindPic 0, 0, , &D:&#92;我文档&#92;神曲&#92;药瓶.bmp&, 1.0, intX, intYIf intX & 0 And intY & 0 ThenCall 执行药瓶()End If//没现直接面脚本运行完再重新运行脚本.Delay 1000MoveTo 838, 489LeftClick 1Delay 20000MoveTo LeftClick 1Delay 1000MoveTo 746, 568LeftClick 1Delay 3000Sub 执行药瓶()MoveTo Delay 1000LeftClick 1Delay 1000MoveTo 764, 567LeftClick 1End Sub
你好.请问我执行完小药瓶的命令后没有重新运行.脚本把小药瓶下面的脚本也运行了.
这就对了,程序首先运行到“If intX & 0 And intY & 0 Then”进行判断是否执行“小药瓶”程序,是则跳转子程序“小药瓶”执行完毕后回到跳转处继续下面程序,否则跳过子程序直接执行下面程序,如果你在执行完“小药瓶”程序后需要再次判断可以做一个跳转,以下就是了:&#47;&#47;原来的脚本是这样写的FindPic 0,0,,&D:&#92;我的文档&#92;神曲&#92;VIP币.bmp&,0.9,intX,intYIf intX& 0 And intY& 0 ThenMoveTo intX+20, intY+20
Delay 1000
LeftClick 1End IfDelay 1000FindPic 0,0,,&D:&#92;我的文档&#92;神曲&#92;使用.bmp&,1.0,intX,intYIf intX& 0 And intY& 0 ThenMoveTo intX, intY
LeftClick 1End IfDelay 1000&#47;&#47;小药瓶这张图片有时候没有.我想如果出现就运行完小药瓶的脚本后.重新运行脚本Rem 验证药瓶FindPic 0, 0, , &D:&#92;我的文档&#92;神曲&#92;小药瓶.bmp&, 1.0, intX, intYIf intX & 0 And intY & 0 Then&#47;&#47;是则执行小药瓶并在执行后跳转到验证药瓶处,否则进行下面延时处Call 执行小药瓶()Goto 验证药瓶End If&#47;&#47;如果没出现就直接到下面的脚本运行完后再重新运行脚本.Delay 1000MoveTo 838, 489LeftClick 1Delay 20000MoveTo LeftClick 1Delay 1000MoveTo 746, 568LeftClick 1Delay 3000Sub 执行小药瓶()MoveTo Delay 1000LeftClick 1Delay 1000MoveTo 764, 567LeftClick 1End Sub
谢谢你啊,可以加一下好友么。百度hi
QQ我还有一些其他的问题,真是麻烦你了。
我比较忙,平时不怎么上QQ,你可以在百度中问我,我会找时间回答你的。
Rem x FindPic 0,0,,"Attachment:\图b.bmp",0.9,intX,intY If intX < 0 And intY < 0 Then
KeyPress "6", 1 Delay 1000 KeyPress "7", 1 End If Goto x 图片自己做好 然后添加进附件(否则无效) 是点击 还是按键盘上的6、7
如果是鼠标点击 请给出坐标
其他类似问题
46人觉得有用
为您推荐:
按键精灵的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁}

我要回帖

更多关于 按键精灵区域找图脚本 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信