Jump to content

Repeat Imagesearch


Recommended Posts

Hello,

im pretty new to coding and i need your help.
i tried to create a script which should do the following steps:

1. search for image
2. if it appears right click on it
3. if it doesnt appear do some mouse clicks
4. search for image again
5. if it appears right click on it
6 if it doesnt appear do some mouse clicks
and so on and so on

my result is:
without the else part the script is fine and it would right click on the image if it appears, however when i added the else part it wouldnt click on the image anymore if it appeared. (i think i use the else function wrong but let me know what you guys think)

 

#include <ImageSearch.au3>

HotKeySet("s", "Start")
HotKeySet("e", "_Exit")

Global $y = 0, $x = 0

Func Start()
   While 1
      sleep (100)
      $file = @DesktopDir & '\Coronet.bmp'
      local $search = _ImageSearch($file, 1, $x, $y, 0)
      if $search = 1 Then
         MouseClick("right", $X, $Y)
         Sleep (50)
         Else
            MouseClick ("left", 929, 691) ;mble window schliessen
            Sleep (200)
            MouseClick ("left", 960, 459) ;Gheed
            Sleep (200)
            MouseClick ("left", 960, 359) ;auf glücksspiel drücken
            Sleep (500)
      EndIf
      Wend
   EndFunc

I appreciate your help!

Link to comment
Share on other sites

  • Developers

Sounds like a game script for Diablo, so guess you missed the forum rules on your way in?

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Jos locked this topic
Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...