|
Post by paladiex on Aug 28, 2017 4:56:28 GMT
I have a screen that will change based on the power up results. In order to determine which stat increased after a power up I would like the bot to crop an image beside each stat and set it as a baseline, then check to see if that image has changed after a certain point. In the below example Accuracy increased from 7 to 14, the amount it increased by is not important; just that it increased. Let's say that red box is a statRegionX. How could I program this?
|
|
|
Post by AnkuLua on Aug 28, 2017 6:14:38 GMT
First, you save the image with region. Then get the score of the image one original screenshot. Then you find the image with region on new screenshot. If the image exists, the score should be very high and almost the same as the original. If not, then it changes.
|
|
|
Post by paladiex on Aug 28, 2017 14:53:42 GMT
First, you save the image with region. Then get the score of the image one original screenshot. Then you find the image with region on new screenshot. If the image exists, the score should be very high and almost the same as the original. If not, then it changes. How would that look when coded?
|
|
|
Post by AnkuLua on Aug 28, 2017 15:12:24 GMT
For your reference.
reg:save("original.png") -- reg is the region with percentage reg:exists("original.png") score = reg:getLastMatch():getScore() print("score = " .. score) -- power up here
if (reg:exists("original.png")) then newScore = reg:getLastMatch():getScore() print("new score = " .. score) if (newScore > (score - 0.2)) then change = false else change = true end else change = true end
-- change is the result
|
|
|
Post by paladiex on Aug 28, 2017 15:33:03 GMT
For your reference. reg:save("original.png") -- reg is the region with percentage reg:exists("original.png") score = reg:getLastMatch():getScore() print("score = " .. score) -- power up here if (reg:exists("original.png")) then newScore = reg:getLastMatch():getScore() print("new score = " .. score) if (newScore > (score - 0.2)) then change = false else change = true end else change = true end -- change is the result Thanks, I will try this out on wednesday
|
|