|
Post by jeppis on Jul 2, 2016 20:09:14 GMT
Sup,
im trying to prospect the grade of runes in summoners war, im attempting to do this by comparing the color in my specified region (i found a spot i can safely recognize every 5star rune, the thing is i'd like to keep only legendary ones).
Currently im testing this with following script:
r, g, b = GetColor(Pattern("5star.png"):similar(0.9))
print ("r="..r.."g="..g.."b="..b)
and
r, g, b = GetColor("5star.png")
print ("r="..r.."g="..g.."b="..b)
Which both give me "Runtime error: attempt to call global "GetColor" (a nil value)"
What is the proper usage of it?
|
|
Kako
Contributors
Posts: 105
|
Post by Kako on Jul 2, 2016 21:54:55 GMT
Are you sure the pattern is found? How about you wrap the getColor (starting with a lowercase G) in an exists()?
ptrn = Pattern("5star.png"):similar(0.9) match = exists(ptrn)
if match then r, g, b = getColor(match) end
|
|
|
Post by AnkuLua on Jul 3, 2016 1:32:13 GMT
What's your AnkuLua version? Please update to latest version.
|
|
|
Post by jeppis on Jul 3, 2016 18:49:44 GMT
I have the most latest version of Pro, also im using media projection for ss. I can safely recognize the image with FindAll (have a checker for testing) but getcolor somehow fucks it up. I will test Kako's method when i have the time, thanks for help.
|
|
|
Post by jeppis on Jul 4, 2016 7:29:45 GMT
How does the getColor() determine the pixel it analyzes? is it the center of image, or left/right corner?
I managed to fix the script, problem was case sensitivity, the problem is now it scans an area on top of the stars so it only changes between +1-14 and +15 runes while i were hoping to scan the little bit of rune background. Is it possible to find coordinates for the image match in the picture and then choose the getColor() position with an offset?
|
|
|
Post by AnkuLua on Jul 4, 2016 9:29:08 GMT
How does the getColor() determine the pixel it analyzes? is it the center of image, or left/right corner? I managed to fix the script, problem was case sensitivity, the problem is now it scans an area on top of the stars so it only changes between +1-14 and +15 runes while i were hoping to scan the little bit of rune background. Is it possible to find coordinates for the image match in the picture and then choose the getColor() position with an offset? It's the same as other PSMRL. If there is no targetOffset, it's the center. Use getX and getY to get the upper left coordinates. match = find("target.png") upperLeft = Location(match:getX(), match:getY())
|
|