Jump to content

Recommended Posts

Posted

Hi everyone,

Hope this is the right sections.

Im trying to write a code that does the following:

Checks if a mark1 is on the screen then clicks on it, once mark1 is on the center of the screen, the script will click on mark2 and so on.

I managed to make this work, althought I want to add a check: If after x seconds mark1 wasnt reached, then click again on mark1 until mark1 is on center of the screen.

 

The Red Cross is always in the center of the screen.

A mark is considered to be reached, when the redcross is not visible anymore.

 

Can someone help me with this?

Thanks alot!

 

image.png.ceddcf7e648f843bb7ff745b9fd6470b.pngimage.png.4eeb11b72c0e6968a4924086070e4a07.png

#include <ImageSearch2015.au3>

$x1=0
$y1=0

$x2=0
$y2=0

$mark1 = "C:\Users\jm\OneDrive\Área de Trabalho\markers\ImageSearch2015\mark1.png"
$mark2 = "C:\Users\jm\OneDrive\Área de Trabalho\markers\ImageSearch2015\mark2.png"
$center = PixelGetColor (1805, 83)



While 1

$resultmark1 = _ImageSearch($mark1,1,$x1,$y1,0,0)
If $resultmark1=1 and ($center = "0xFFFFFF") Then
   MouseClick('left',$x1,$y1,50)
   Sleep(3000)

$resultmark2 = _ImageSearch($mark2,1,$x2,$y2,0,0)
If $resultmark2=1 and ($center = "0xFFFFFF") Then
   MouseClick('left',$x2,$y2,50)
   Sleep(3000)

EndIf
EndIf


Wend

 

 

  • Moderators
Posted

@Chimerians this looks an awful lot like a game automation script. I am locking until you convince me otherwise via PM.

In the meantime, please review our Forum Rules: 

And realize, the "yes it's for a game, but I should be able to ask it because...." and "this is just an example for learning..." tired excuses won't get you very far :)

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Guest
This topic is now closed to further replies.
×
×
  • Create New...