nic
New Member
Posts: 1
|
Post by nic on Aug 11, 2019 14:31:14 GMT
I want to do an action like moving right until a particular region in screen stops changing (image in that region stays the same), any way or workaround to do this? thanks in advance
|
|
|
Post by Exilereven on Aug 11, 2019 15:52:37 GMT
Try using save() in a certain region.
Then use that save and compare it to the next, and so and etc ..
So something like :
local target = Region(856,42,40,40) --input your own region info local ss_name = "_ss_mob_temp_.png" local ss_val = get_values(target) local ss_region = Region(ss_val.x - 10, ss_val.y - 10, ss_val.w + 20, ss_val.h + 20) --make region for searching slightly bigger then ss size -- target:save(ss_name) --original picture to compare with --now this will loop until the image does not have 90% or higher score, meaning that it has obviously changed and we exit our while loop. while true do --if image is there if ss_region:exists(Pattern(ss_name)) then print("score = " .. tostring(ss_region:getLastMatch():getScore())) --print score to show you visually, you can make them toasts if you prefer. --if the last match in region, has a match score of 90% or higher if ss_region:getLastMatch():getScore() >= 0.9 then print("Image is still the same") --do something here based on if its still the same else print("Image has changed") --do something here based on if the imahe has changed. I use it for things like: telling if a creature has died, but not having to have original shots of every monster. this will take a pic of anything in desigated region, save it, then start comparing against it. break end end end
|
|