How to take action after a certain image flashes a certain number of times?

Asked by Luke

Hi there

I have trouble making sikuli script to click a button ONLY after an image appears 7 times exactly. How will I write the script?

Best
Luke

Question information

Language:
English Edit question
Status:
Expired
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Eugene S (shragovich) said :
#1

does it appear and then disappear? what are the intervals?

Revision history for this message
Luke (phiandpistudio) said :
#2

Yes the image appears and then disappears.

It's a game where the image 'WIN' or 'LOSE' appears.

I want to take action (click on the stop button) only when the image 'LOSE' appears 7 times in a row.

Is that possible?

Revision history for this message
Eugene S (shragovich) said :
#3

So a "win" button can appear in between and in that case the count restarts? what are the time intervals between when the text appears and disappears?

Revision history for this message
Luke (phiandpistudio) said :
#4

Yes absolutely. A win can be in between the losses and I only want specifically 7 losses consecutively. The time interval for a win or lose to appear is about 0.5 seconds.

Revision history for this message
Eugene S (shragovich) said :
#5

hmm, a time interval that short might be a problem then as what you generally need to do is (without going into details):
1. Detect "win"
2. Detect that "win" does not appear anymore (between 2 flashes)
3. Add count
4. If not 7 yest, wait for the next flash to appear (step 1)

So in that case, Sikuli might miss the periods when the "Win" text disappears because it flashes too quick.

Can you limit the area where this text appears so that the search will be performed on a limited area? That will make it work faster.
In other words, do you know where to physically expect this text to appear?

Revision history for this message
Luke (phiandpistudio) said :
#6

Hi

1. How do i write what you said into the script?
I tried detect ("win") but it doesn't work.

2. How do I add the count of 'loss'?

Yes I can limit the area where the text appears. It's on a limited area. I know where to expect the text.

Cheers

Revision history for this message
Luke (phiandpistudio) said :
#7

Hi

Any help?

Revision history for this message
Launchpad Janitor (janitor) said :
#8

This question was expired because it remained in the 'Open' state without activity for the last 15 days.