SRL Archive - Other Scripts

Color/Tolerance Matcher! - Get exact tolerance needed to find a certain color!


Ron

2006-10-28 21:12:26

Color/Tolerance Matcher! - Get exact tolerance needed to find a certain color!
by Ron


I made this small program to get the right colors I needed to make scripts for a different game, and it worked very well! Program is attached. Instructions are in the script, and they say to fill out the const. :P

Here is an example I got when I tried to match 3 colors (16114904,16579057,16711163) with the color 16777215.


/—– Matching colors with 16777215 —–\
16114904 matched at tol: 49
16579057 matched at tol: 16
16711163 matched at tol: 5

Thanks for using the ColorToleranceMatcher by Ron
Successfully executed


So with this information I could make a function more efficient by looking for the exact tolerance needed to find the color range I'm looking for.


program New;

var
x, y, x2, y2 : Integer;

begin
GetClientDimensions(x2, y2);
// Here I'm looking for a color, with a tolerance of 49, so I can find all
// the numbers within the same tolerance up to the color: 16114904
if(FindColorTolerance(x, y, 16777215, 0, 0, x2, y2, 49))then
begin
WriteLn('Color found at coords ('+IntToStr(x)+', '+IntToStr(y)+')');
end;
end.

I hope I helped a little. :D

~Ron

Yakman

2006-10-29 16:07:28

very nice Ron, this will help me lower some tolerances so i dont get false positives all the time,
im glad to see your on SRL as well as MoparIsTheBest :D

Ron

2006-10-29 19:38:02

Thanks Yakman. :)

I hope this helps all scripters!

_ChArMz

2006-10-29 21:30:20

From: Ron
Thanks Yakman. :)

I hope this helps all scripters!


I like it, I can try to use this for my autocolor finders, so they dont find the wrong color, atm im just using SimilarColors.

With this i will be able to find the exact tolerance, minimizing the max tolerance, then minimizing the chance of picking the wrong color :D


hope it works :P

CamHart

2006-11-24 22:46:30

This could be extremely useful. I have a script that i was messing around with today, and this is going to make it work all that much better. Thanks a bunch.

Avaphi

2007-02-03 00:19:16

Bravo Ron ! +Rep for a helpful script :)