← Back to team overview

sikuli-driver team mailing list archive

[Question #656768]: How to control returning observation registered using onChange?

 

New question #656768 on Sikuli:
https://answers.launchpad.net/sikuli/+question/656768

I am trying to automate some parts of a game. In my code, i need a function called everytime the content of a region changes. The changes keep occurring often and the function needs to be called each time.

I am using Region.onChange to register my observe event.

The problem i am facing is that the handler is getting called multiple times for the same change. Say if change A occurred at 1500 hrs and change B at 1505 hrs, the observer is reacting multiple times to change A and calling the handler ~10-15 times between 1500 hrs and 1505 hrs.

Using ObserveEvent.repeat() in the handler does not seem to work. Also using Region.waitVanish(Pattern(capture(Region))) also doesn't seem to work to make the observer wait for change B.

How to stop it from reacting to the same change multiple times?

Thanks in advance

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.