MatchList

Read several recognition results as a list of Match values. Use len(matches), matches[index], or a for loop. A non-empty list can include failed matches, especially after wait_any()/wait_all(); check each item's found value.

Syntax

MatchList

This class cannot be constructed directly.

Returns

—

Example

hits = Region(100, 200, 300, 400).find_all(["hp", "mp"], 5000)
if hits:
    click(hits, offset=(0, 4), random=0)

Methods

2 methods

MatchList.highlight

Mark each found result on screen, using its bounds or squares around its points. Skips results without a location. Drawing is scheduled, so the call can return before the frames appear. Only the latest update pending for the same instance is drawn at the next display frame.

Syntax

matches.highlight(color="green", line_width=2, region_width=36, auto_hide_ms=0)

Parameters

NameDescription
colorColor | String | Number
Highlight color.
Optional · Positional or named
Default: green
line_widthNumber
Outline width in pixels, with a minimum of 1.
Optional · Positional or named
Default: 2
region_widthNumber
Square width in pixels when only points are available, with a minimum of 1.
Optional · Positional or named
Default: 36
auto_hide_msNumber
Time before hiding, in milliseconds. 0 or a negative value keeps the highlight visible until highlight_off().
Optional · Positional or named
Default: 0

Returns

MatchList — The same MatchList, so you can continue calling its methods.

Example

hits = Region(100, 200, 300, 400).find_any(["enemy_a", "enemy_b"], 2500)
hits.highlight(color="yellow", line_width=3, auto_hide_ms=1200)

MatchList.highlight_off

Turn off all active highlights generated from this match list instance.

Syntax

matches.highlight_off()

Returns

MatchList — Returns the same match list after turning highlight off.

Example

hits = Region(100, 200, 300, 400).find_any(["enemy_a", "enemy_b"], 2500)
hits.highlight()
hits.highlight_off()