Multi onEvent

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
RaiCab
Newbie
Posts: 1
Joined: Tue Oct 07, 2014 8:12 am

Multi onEvent

Post by RaiCab » Tue Oct 07, 2014 9:42 am

Hi,

I'm new in this forum and i'm speaking in foreign language, so sorry for my English.

I'm trying to write a script which will automatic hits the targets. I have a small bullet shield, which show at screen always in the same place and has a random color, but there is a pixel in this bullet shield that change color very rarely.
I wrote a script that use onEvent Pixel_Color, then it move mouse to this pixel coordinate and LCLICK. It works, but it's too slow and sometimes can't see that Pixel_Color.

Example code:

Code: Select all

SRT>t1
  MouseMove>499,290
  LCLick
end>t1

SRT>t2
  MouseMove>701,290
  LCLick
end>t2

SRT>t3
  MouseMove>1000,290
  LCLick
end>t3

Label>start
OnEvent>PIXEL_COLOR,462:279,1255,t1
OnEvent>PIXEL_COLOR,666:279,3221677,t2
OnEvent>PIXEL_COLOR,871:279,525543,t3
Goto>start
Is there any way to make it smarter? When at screen is 8 targets it hits max in 2 target. Sometimes When there is a 4 targets it can't see any. The target shows for 1 second. Sometimes when 2 targets show at coord 462,279 script hit it then it jump to second target at coord 666,279 but with something like 1 second delay so the target is hidden. Or when the target show at coord 462,279 then at 666,279 and then again at 462,279 he can't go back.
Maybe i should use waitpixelchange function or waitrectchange function, but how should i do this? WPC or WRC only show WPC_RESULT=TRUE or FALSE, and it works when there is 1 target. There is any way to store WPC_RESULT to variable and when that variable is TRUE do something? for example: WPC_RESULT_a1=TRUE -> so hit the target.

Thanks in advance

EDIT:
The background is black. So maybe the best way will be wait for pixel to change color from black to any other and then if it change hit it. But how can i do this to handle about 8 pixels at the same time?

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts