How To Call It
This is an object method: call it with a colon on the Result object a search such as region:find(...) returns (nil when nothing matched) (match:<method>(...)). Result is not a global name; the method exists only on that object.
Returns the similarity score of the match, from 0 to 1.
Documented for app version 1.0.51Updated:
This is an object method: call it with a colon on the Result object a search such as region:find(...) returns (nil when nothing matched) (match:<method>(...)). Result is not a global name; the method exists only on that object.
In detection flow, refresh the screen with Snap.screenRefresh() first, then narrow the search area and confidence using Region and FindParam.
Takes no arguments. Returns a number.
It is typically combined with Snap, Region, Asset, and FindParam; you can feed the result into quickTap(), click(), or a follow-up OCR step.
The snippet below is a starter pattern that can be applied directly in runtime flow.
local match = Region():find(Asset.image("target"), FindParam.timeout(3000))
if match then
local result = match:getScore()
endFrom foundation to combined usage, each level is provided as a separate code block so you can copy the level you need and adapt it directly.
local match = Region():find(Asset.image("target"), FindParam.timeout(3000))
if match then
local result = match:getScore()
endlocal stepOk = true
local match = Region():find(Asset.image("target"), FindParam.timeout(3000))
if match then
local result = match:getScore()
end
if stepOk then
wait(200)
endlocal ok, err = pcall(function()
local match = Region():find(Asset.image("target"), FindParam.timeout(3000))
if match then
local result = match:getScore()
end
end)
if not ok then
print("API step failed: Result:getScore: " .. tostring(err))
requestStop()
end-- In detection flow, refresh the screen with Snap.screenRefresh() first, then narrow the search area and confidence using Region and FindParam.
local function run_getscore_step()
local match = Region():find(Asset.image("target"), FindParam.timeout(3000))
if match then
local result = match:getScore()
end
end
local ok, err = pcall(run_getscore_step)
if not ok then
toast("Step failed")
print(err)
endSnap.screenRefresh()
local match = Region():find(Asset.image("target"), FindParam.timeout(3000))
if match then
local result = match:getScore()
end
toast("Detection step completed")