pir_wait_for_change
Monitor a screen region and block until it changes or a timeout expires, returning a change flag and score. Ideal for waiting on UI updates, dialog closures, or page loads.
Instructions
Block until the region looks different from how it looked when this call started, or until timeout_ms. Returns changed=true with the score, or changed=false with the largest score seen. Use it as a doorbell: 'wake me when the build output moves', 'when the dialog closes', 'when the game loads'.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| metric | No | what the threshold applies to. rmse (default): the whole region moved. peak: any single cell moved, for a small thing that should tick inside a larger region (a clock in a bar). | |
| threshold | No | score that counts as a change, 0..1 (default 0.05). With metric=rmse a caret or cursor edge scores about 0.02 and a dialog opening 0.1+. With metric=peak a digit flipping in one cell scores about 0.05-0.2. | |
| timeout_ms | No | give up after this long (default 55000, max 540000) | |
| interval_ms | No | sampling period (default 500) |