Jump to content

Repeating PixelSearch


Recommended Posts

Hello, first of all excuse me I have no experience in coding and I am new in here.

But I have this code that id like to change a bit:

$left = 880
$bottom =291
$right =1017
$top = 148
$color = 0xEEFBFB


while(1)
   $pix = PixelSearch($right, $bottom, $left, $top, $color, 1)
   if Not(@error) Then
      Sleep(300)
    MouseClick("right",959,553,2,1)
    Sleep(2000)
 EndIf
WEnd

MouseMove(959,553,2)

Id like the PixelSearch part to repeat 5 times (the pixel was found 5 times and it clicked on it 5 times) then i need to stop the pixel search, do the mouse move and repeat the whole script.

Thanks for your time and once again sorry for my lack of knowledge.
 

Link to comment
Share on other sites

  • Moderators

@Saurus There is little anyone can do to assist if they don't understand what you're trying to accomplish. If you're uncomfortable stating the app in the forum, if it is proprietary or for work for instance, feel free to PM

                                                                                    ***In case you missed it, this is a Mod stepping into a thread***

"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!

Link to comment
Share on other sites

On 8/1/2019 at 8:20 AM, JLogan3o13 said:

@Saurus There is little anyone can do to assist if they don't understand what you're trying to accomplish. If you're uncomfortable stating the app in the forum, if it is proprietary or for work for instance, feel free to PM

                                                                                    ***In case you missed it, this is a Mod stepping into a thread***

This is what he is trying to accomplish. He stated this in his first post.

"Id like the PixelSearch part to repeat 5 times (the pixel was found 5 times and it clicked on it 5 times) then i need to stop the pixel search, do the mouse move and repeat the whole script."

Link to comment
Share on other sites

  • Developers
9 minutes ago, yeto said:

This is what he is trying to accomplish. He stated this in his first post.

... please reread that last part you quoted and simply stay out of this thread until it is given the OK!

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

@JLogan3o13

@Jos

Thank you for your quick responses!
Meanwhile I managed to update the script a bit, but Id still like to keep its purpose confidential.
 

Here it is:

$left = 908
$bottom =291
$right =1017
$top = 175
$color = 0xEEFBFB
Global $MouseClicks = 1


while(1)
 $pix = PixelSearch($right, $bottom, $left, $top, $color, 1)
 if Not(@error) Then
      Sleep(300)
    MouseClick("right",960,553,2,1)
    Sleep(2000)
    $MouseClicks = $MouseClicks +1
    EndIf
 If $MouseClicks = 10 Then
    sleep(2000)
MouseWheel("up",1)
        sleep(1000)
        MouseClick("right",960,553,1)
        Sleep(2000)
MouseClick("left",854,567,1)
    Sleep(4000)
MouseClick("right",960,553,1)
        Sleep(2000)
MouseClick("left",854,567,1)
    Sleep(4000)
        MouseMove(960,900,1)
        Sleep(2000)
        MouseWheel("down",1)
        sleep(2000)
        MouseClick("right",960,553,1)
        sleep(2000)
    $MouseClicks -=10

 EndIf
 wend

But I have a different question about this script. Id like to implement a part that would sense that the pixel was not found for longer than X amout of time and then it would carry out a set of various actions and then restart the script. If youd help me with this I would highly appreciate it.
Thanks.

Edit: Ive had an idea of using if (@error) but how do I make it so it triggers itself lets say only after 30sec ?

Edited by Saurus
Link to comment
Share on other sites

  • Moderators

@Saurus if you do not want to publish the script purpose in the forum, that is fine, you can PM me with a full explanation.

@Saurus As I pointed out in the PM, please familiarize yourself with the forum rules, especially the section on game automation, before posting again.

 

Edited by JLogan3o13

"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!

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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