///

Match Class

A Match object is returned by image-based region searches such as find, findAll, waitFor, and intercept, and by lastMatch().

x

The center coordinates of the match. For intercept, these are the predicted future coordinates.

let region = new Region(0, 0, Screen.getWidth(), Screen.getHeight()); let match = region.find("reward", { timeout: 3000 }); console.log(match.x); // x

y

The center coordinates of the match. For intercept, these are the predicted future coordinates.

let region = new Region(0, 0, Screen.getWidth(), Screen.getHeight()); let match = region.find("reward", { timeout: 3000 }); console.log(match.y); // y

cx

Alias for the center coordinates (x, y).

let region = new Region(0, 0, Screen.getWidth(), Screen.getHeight()); let match = region.find("reward", { timeout: 3000 }); console.log(match.cx); // cx

cy

Alias for the center coordinates (x, y).

let region = new Region(0, 0, Screen.getWidth(), Screen.getHeight()); let match = region.find("reward", { timeout: 3000 }); console.log(match.cy); // cy

vx

(intercept only) Estimated velocity in source pixels per millisecond.

let region = new Region(0, 0, Screen.getWidth(), Screen.getHeight()); let match = region.find("reward", { timeout: 3000 }); let result = match.vx; console.log(result);

vy

(intercept only) Estimated velocity in source pixels per millisecond.

let region = new Region(0, 0, Screen.getWidth(), Screen.getHeight()); let match = region.find("reward", { timeout: 3000 }); let result = match.vy; console.log(result);

point

A Point object for the center.

let region = new Region(0, 0, Screen.getWidth(), Screen.getHeight()); let match = region.find("reward", { timeout: 3000 }); console.log(match.point); // Point(cx, cy)

region

A Region object describing the matched bounds. Not present on intercept results, and null on a lastMatch() result whose detection recorded no bounds.

let region = new Region(0, 0, Screen.getWidth(), Screen.getHeight()); let match = region.find("reward", { timeout: 3000 }); console.log(match.region); // (x, y, w, h)

score

Confidence score when provided. Absent on lastMatch() results, detection actions do not record one.

let region = new Region(0, 0, Screen.getWidth(), Screen.getHeight()); let match = region.find("reward", { timeout: 3000 }); console.log(match.score); // score

template

The template name that produced this match. Absent on lastMatch() results.

let region = new Region(0, 0, Screen.getWidth(), Screen.getHeight()); let match = region.find("reward", { timeout: 3000 }); let result = match.template; console.log(result);

click()

Click the center of the match.

let region = new Region(0, 0, Screen.getWidth(), Screen.getHeight()); let match = region.find("reward", { timeout: 3000 }); match.click(); // Clicks the center point (cx, cy)