Jump to content

Recommended Posts

Posted (edited)

hey guys,

i've got another question:

I've written a code which is fully working now.

But there is 1 problem left, i'll explain the situation and my problem in the hope u can solve it.

So, i've written a code which is doing some stuff for me.

@the end of the code i've written

;--------------------------------------------------------------------win-------------------------------------------------------------

$WaitPixelColor1=0xFFF46A

Do

$waitpixel1=PixelSearch (515, 241, 890, 322, $WaitPixelColor1,2)

Until Not @error

MouseClick("left",695,560,2)

sleep (5000)

;--------------------------------------------------------------------lose-------------------------------------------------------------

$WaitPixelColor2=0xAA0303

Do

$waitpixel2=PixelSearch (515, 241, 890, 322, $WaitPixelColor2,2)

Until Not @error

MouseClick("left",695,560,2)

sleep (5000)

So whenever a box pops up with those colors, than it should just click this point (695,560) and than STOP the code.

Now my problem is:

the script is running, the box pops up, the scrips keeps on running till it is finished and than the last part of the script (which i posted) will eventually click on the location i want

But this way i lose lots of time, so i would just like to change it.

It should become like this:

The script is running, the box pops up, it clicks on the location, and the script stops running (no mather where it will end @the box pop up)

I've searched some forums, and only found ProcessSetPriority ( "process", priority), but this is to give priority to a programm and not to a part of a script....

Can someone please help me out?

I really can't find a solution.

Kind regard,

stefan

Edited by Qsert18
Posted (edited)

;--------------------------------------------------------------------win-------------------------------------------------------------

;--------------------------------------------------------------------lose-------------------------------------------------------------

Win what? Lose what?

Edited by MrMitchell
Posted

ah win just means if it turns green, red if the box turns red...

I'm trying it out with paint right now but can't get it to work :unsure:

Could u answer my question now? xd

Posted

no...

Look I've got a script which is doing things like:

mouseclick (...)

sleep (50)

mouseclick (...)

(1)

sleep (50)

mouseclick (...)

sleep (50)

mouseclick (...)

sleep (50)

mouseclick (...)

sleep (50)

;--------------------------------------------------------------------win-------------------------------------------------------------

$WaitPixelColor1=0xFFF46A

Do

$waitpixel1=PixelSearch (515, 241, 890, 322, $WaitPixelColor1,2)

Until Not @error

MouseClick("left",695,560,2)

sleep (5000)

;--------------------------------------------------------------------lose-------------------------------------------------------------

$WaitPixelColor2=0xAA0303

Do

$waitpixel2=PixelSearch (515, 241, 890, 322, $WaitPixelColor2,2)

Until Not @error

MouseClick("left",695,560,2)

But during that script a box MIGHT pop up (time = unknown), if it's green/red it has to click a certain button.

If it turns up at the end of all the mouseclicks, than the program will probly function: and the mouse will click the certain button

BUT if the box pops up @ (1): than it will just continue the rest of the mouseclicks, untill it's finished and than just click the certain button.

Now my question is: how can i set a priority

Like: the scripts (mouseclicks) is running BUT if the box pops up it jumps to the pixelsearch stuff....?

Posted

Like: the scripts (mouseclicks) is running BUT if the box pops up it jumps to the pixelsearch stuff....?

Ok so what do you use to determine when the box pops up? Don't you use pixelsearch to figure that out?

Posted (edited)

$WaitPixelColor1=0xFFF46A

Do

$waitpixel1=PixelSearch (515, 241, 890, 322, $WaitPixelColor1,2)

Until Not @error

MouseClick("left",695,560,2

I guess this means:

If the color @ in a certain area changes into green, than it will click @ (695,560)

So it's quite a pixelsearch right?

But do u mean that i should do a pixelsearch after every mousclick(...) code?

that's possible i think, but it would take lots of work, and i might try it out tomorrow, but i guess there is another solution.

Edited by Qsert18
Posted

So again:

A script is running in cronologic order, from top to bottom

let's say this is my script: (- = represent words,codes)

--------(1)

--------(2)

--------(3)

--------(4)

--------(5)

It should run from 1 to 4, but If the color pops up it should immedialy jump to (5) and not just continue running 1,2,3,4...untill 5.

So the code (5) should actuelly have priority on the other 4 lines

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
×
×
  • Create New...