找回密码
 加入
搜索
查看: 1948|回复: 6

[AU3基础] AU3有找图并获取坐标的命令吗?

  [复制链接]
发表于 2014-3-13 20:57:47 | 显示全部楼层 |阅读模式
AU3有找图并获取坐标的命令吗?
发表于 2014-3-13 21:17:22 | 显示全部楼层
没有。。论坛有找图的一些代码。。。自己找下
发表于 2014-3-14 09:08:03 | 显示全部楼层
没有一步到位的,都是一点一点来。搜搜看吧,做这个很有可能找不到您要的成品。需要自己改一下
发表于 2014-3-20 12:06:11 | 显示全部楼层
本帖最后由 处男1 于 2014-3-20 15:14 编辑

我这样写不知道符合你做游戏脚本的需求么
#include <WindowsConstants.au3>

#include <ButtonConstants.au3>

#include <GUIConstantsEx.au3>

#include <file.au3>

$hGui = GUICreate("找图片", 200, 150)

$pathpic=FileOpenDialog("你要找的图片",@DesktopCommonDir, "Images (*.jpg;*.bmp;*.png)", 1 + 4 )

$start=GUICtrlCreateButton("开始找图",70,100)

GUISetState(@SW_SHOW)

Dim $AccelKeys[1][2]=[["{enter}",$start]]

GUISetAccelerators($AccelKeys)

While 1
        
        $MSG=GUIGetMsg()
        
        Switch $MSG
                
        Case $GUI_EVENT_CLOSE
                
                Exit
                
        Case $start
                
                start()
                
        EndSwitch
        
WEnd        

Func start()
        
Dim $x=0,$y=0

$result = _ImageSearch($pathpic,1,$x,$y,0)

if $result=1 Then
        
        ToolTip("美女你要找的图片是这个不?",$x,$y,"提示",2,1)
        
Else
        
        MsgBox(16,"提示","没有发现目标")
        
EndIf

EndFunc

Func _ImageSearch($findImage,$resultPosition,ByRef $x, ByRef $y,$tolerance)
        
   return _ImageSearchArea($findImage,$resultPosition,0,0,@DesktopWidth,@DesktopHeight,$x,$y,$tolerance)
   
EndFunc

Func _ImageSearchArea($findImage,$resultPosition,$x1,$y1,$right,$bottom,ByRef $x, ByRef $y, $tolerance)

        if $tolerance>0 then $findImage = "*" & $tolerance & " " & $findImage
                
        $result = DllCall("ImageSearchDLL.dll","str","ImageSearch","int",$x1,"int",$y1,"int",$right,"int",$bottom,"str",$findImage)
        
    if $result[0]="0" then return 0
                
        $array = StringSplit($result[0],"|")

        $x=Int(Number($array[2]))
        
        $y=Int(Number($array[3]))
        
   if $resultPosition=1 then
           
      $x=$x + Int(Number($array[4])/2)
          
      $y=$y + Int(Number($array[5])/2)
          
  endif
  
   return 1
   
EndFunc


如果想要命令就可以把它变成一个函数调用




其实不建议用找色,找色不稳定且很多游戏动作不能达到效果,最好是用_MemoryOpen,_MemoryRead,找内存基址,在配合找色。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2014-3-20 13:50:02 | 显示全部楼层
1, ImageSearch
2, myImageSearch
3,调用大漠

我现在用调用大漠,但是总出问题,你那个需求应该没问题
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-10-4 17:26 , Processed in 0.072654 second(s), 21 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表