Sign in to follow this  
Followers 0
vadk123

Image search = 1 else click on a random place

6 posts in this topic

Hello people. I made a script but i had a problem.

I did the aprt the used to search a picture, and if it was find, will click it.

But my problem is that is that didn't find i would like to script start a random click and at the same moment searching the picture.

So... the image search i did, the random click also, buti couldn't make it search for the image as the same time it is random cliking with sleep function after any clicking.

So it would bee like that:

While

If imagesearch = 1 then

mouseclickonit

else

$y = random(y, y2)

$x = random(x, x2)

click("LEFT", $x, $y) ; BUT AT THE SAME TIME SEARCHING FOR THE IMAGE, AND IF IT WAS FOUND click on it, if there is another one, click on it, or else it would start randomclicks again.

 

I tried many times but couldn't make it. Tnx

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I see no problem with your logic.

; F6 to close
HotKeySet("{F6}", "_Exit")


While 1

    $fImageSearch = Random(0, 1, 1)

    If $fImageSearch = True Then
        MouseClick("left", 1, 1)
    Else
        MouseClick("left", Random(1, @DesktopWidth, 1), Random(1, @DesktopHeight, 1))
    EndIf

WEnd


Func _Exit()

    Exit

EndFunc   ;==>_Exit

 

Edited by GordonFreeman

Share this post


Link to post
Share on other sites

No, i'm saying that if the image i was searching find then click it and if it no one more like this image, make a random click.

In your case it will make clicks on every parts without stopping if it's finding the image. I want to the random click click somewhere and start again searching the image, but the random click need have a sleep time, but if i put that sleep time the imagesearch won't working at this sleep moment,

Share this post


Link to post
Share on other sites

Because i'm new on autoit and don't know much things...

I was thinking something like that:

While 1

If $imagesearchresult = 1

then Mouseclick("LEFT", x, y, 1)

else

Mouseclick(random, random)

;and return to the first part of the while, searching the image. But if i put sleep, it will pause all the script, is there any other way to make a wait time after the random click and make the image search working?

 

Endif

Wend

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Because i'm new on autoit and don't know much things...

You are not that new as you were here before under a different account asking the same questions to automate a game.
So I can only conclude you haven't made much progress and are doing again stuff that isn't allowed around here.

Did you actually read those forum rules I pointed you too when I closed your first topic?
Maybe it is a good time to start with that now and beter stick to it from here on.

Jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0