I don't quite understand color tolerance, and what it should be at generally.
Also, how does color finding not mistake something for other things on the screen???
I don't quite understand color tolerance, and what it should be at generally.
Also, how does color finding not mistake something for other things on the screen???
Tolerance is like accuracy. If you're trying to find a color with a tolerance of 0, it will only find that color, but if you have a tolerance of 10, then it will find the original color plus colors that are close to that color.
And color finding can mistake one thing for another on the screen, that's why there are failsafes like uptext. If the mouse was to hover the wrong object, it wouldn't click if the uptext was wrong.
It also helps if you're using CTS 2/3 which makes it more accurate than CTS 1. See some guides on ColoerToleranceSpeeds in the tutorial section.![]()
SRL's F.A.Q. (Error fixes) | How to Convert SRL-5 Scripts to SRL-6 | Draynor Chop N' Bank (RS3)| AIO Superheater (RS3)
T - E - A - MTogether Everyone Achieves More
I'd like to know how tolerance works as a mechanism one day. For example, can anyone predict the range of colors it will search when attempting to find Color 1000000 with a tolerance of 5?
My scripts:
_( Runite Miner [R] )--( Infinity: Guild Miner [R] )--( Worldwalker [R] )--( TPA woodcutter [Color/probably outdated] )_![]()
http://pastebin.com/pLzndmMq
it searches withing 5 of the RGB values.
So if you had (213,100,134) and searched with tol of 3, (210->216, 97->103,131->137) would be valid.
E: thats only with CTS zero and one.
Writing an SRL Member Application | [Updated] Pascal Scripting Statements
My GitHub
Progress Report:13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you have serious physchological problems 13:46 <@BenLand100> HE GETS IT! 13:46 <@BenLand100> HE FINALLY GETS IT!!!!1
Colors in their decimal form are like 16777215, 255, 0 (white, red, black) and all colors are composed generally of three or four elements.
Like for example 255 (clRed) is 255 red 0 green 0 blue
16777215 (clWhite) is 255 red 255 green 255 blue
You get the picture, now of course there is more than RGB (red green blue) there is HSL (hue saturation luminance) XYZ, LAB... the list goes on.
Now colors (in runescape particularly) are designed to fluctuate. When you call a simple FindColor or GetColor() = 000000 in SCAR it's only going to return true if that exact same color was found. So in order to compensate for this we add in a thing called tolerance. What it does it determines the range of say a Max Red, Min Red, Max Green, Min Green, Max Blue, Min Blue of a color.... now depending on which CTS (color tolerance speed) you use the tolerance level will be different and target different types of color fluctuations.
Straight out of SCAR manual
To get a better understanding and to know how much tolerance you should use for a certain thing, there is a thing called ACA (auto color aid) it can be found in tools -> explorer folder -> includes -> SRL -> scripting tools.procedure ColorToleranceSpeed(x: Integer);
Sets the speed of tolerance comparisons. ColorToleranceSpeed(1) is a little slower then 0 but more accurate. ColorToleranceSpeed(0) is faster but not as accurate as 1. ColorToleranceSpeed(2) uses Hue, Saturation and Lightness to determine color similarity. ColorToleranceSpeed(3) uses the CIE colorspace to compare colors (XYZ), it's usually fairly slower than the other modes but it's extremely accurate.
There's also various tutorials on this in the scripting tutorial sections.
I use ACA aid a lot, it's great for making FindObj stuff.
What I don't understand from the above would be:
- What is decimal form of a color?
- How is 255/255/255 rgb = 16777215? Does that apply to the 16777215,255,0?
- How can there be a 16777215, 255, 0 (white, red, black), I thought they went up to 255 only
- If we have color x as something like 600000, if we subtract one, will it look sort of like the same color? Or could it vary wildly by just increasing the longint by 1?
I've actually been looking for tutorials on color. I feel lost without understanding *exactly* how color works. I know I can just use ACA for pretty much everything, but it leaves a huge gap in my knowledge of how and why it works. Pretty much, I'm like a physicist who can make a rocket go into space without knowing d/t=v.
I've looked through probably most guides as I attempted [and succeeded] at getting into SRL members. Now it's time to fill in all these gaps. I'd like to be more proficient with color too, and I'm sure this will aid me a lot
If you have any links that explain everything in the most minute of detail I will read [or re-read!] again with precision.
EDIT: Another reason tolerance can be confusing for me is because according to This tutorial, color tolerance is basically RANGE = COLOR - TOLERANCE, yet when I set a tolerance of 50 or 100... or even 300... it will cover the whole screen pretty much in red; thus confusing me on how tolerance works since I know all of the pixels are not 300 units away from the color chosen.
Last edited by Cstrike; 09-13-2010 at 04:40 AM.
My scripts:
_( Runite Miner [R] )--( Infinity: Guild Miner [R] )--( Worldwalker [R] )--( TPA woodcutter [Color/probably outdated] )_![]()
http://pastebin.com/pLzndmMq
white red black? It's Red Green Blue. The color 60000 is potentially very much different from 60001 such as green -> red (open the DTM editer up and manually edit the color value to change the preview, you'll see what I mean).
Colors in decimal form are this way because of bitwise operations http://villavu.com/forum/showthread.php?t=18514
http://villavu.com/forum/showthread.php?t=55234 (simpler)
Tolerance is just a formula that we use to define how similar colours are. If they are very similar, the tolerance will be low, if they are not at all similar, the tolerance will have to be high to match them. This makes it easy for example to find colour that look ``red''.
I never found the SCAR manual to give a pleasing description of each tolerance, so here's my try at quickly describing the tolerances in Simba: http://wizzup.org/simbadoc/scriptref...lour-tolerance
(The entire article may be of use for the OP)
For an even better understanding of the algorithms, we take a look at the Simba source:
Simba Code:function TMFinder.SimilarColors(Color1, Color2,Tolerance: Integer) : boolean;
var
R1,G1,B1,R2,G2,B2 : Byte;
H1,S1,L1,H2,S2,L2 : extended;
begin
Result := False;
ColorToRGB(Color1,R1,G1,B1);
ColorToRGB(Color2,R2,G2,B2);
if Color1 = Color2 then
Result := true
else
case CTS of
0: Result := ((Abs(R1-R2) <= Tolerance) and (Abs(G1-G2) <= Tolerance) and (Abs(B1-B2) <= Tolerance));
1: Result := (Sqrt(sqr(R1-R2) + sqr(G1-G2) + sqr(B1-B2)) <= Tolerance);
2: begin
RGBToHSL(R1,g1,b1,H1,S1,L1);
RGBToHSL(R2,g2,b2,H2,S2,L2);
Result := ((abs(H1 - H2) <= (hueMod * Tolerance)) and (abs(S2-S1) <= (satMod * Tolerance)) and (abs(L1-L2) <= Tolerance));
end;
end;
end;
Last edited by Wizzup?; 09-13-2010 at 07:13 AM.
The best way to contact me is by email, which you can find on my website: http://wizzup.org
I also get email notifications of private messages, though.
Simba (on Twitter | Group on Villavu | Website | Stable/Unstable releases
Documentation | Source | Simba Bug Tracker on Github and Villavu )
My (Blog | Website)
Nice! This one got me interested as well. Any tips where could I find the sources for ColorToRGB and RGBToHSL ?
A Chinese wiseman once said: "Shu ciu!", it was considered very smart, but now people know it means: "Something stinks here!"
FalBuggySmelter v.1.31
[Updated on the 1st of March 2010]
RimmBugger BETA V1.8
All my scripts are held on Googlecode git, so if you ever see a problem, fork it and send me a pull request
If a script is grey, it doesn't work, if it's colour then it does!
My Tutorials:-
Everything you need to know about setting up Simba, SRL and Reflection!, How to sort out the MSVCR71.dll error
How to set up players for autoing with Simba, SRL/Simba Standards (with examples), Defines
Auto Updater and Git, Using a testing branch for git, Adding SRL Stats to your script
Creating your own font set for Simba, Guide to Cups, How to make 1.45M (RSGP) a day (not really my tut)
Download a image and set it as your Desktop Wallpaper in C#, How to make your first PHP file uploader
<Coh3n> Shuttleu, fuck I love you right now
If you use CTS2 then you define those as globals, i suppose...
A Chinese wiseman once said: "Shu ciu!", it was considered very smart, but now people know it means: "Something stinks here!"
FalBuggySmelter v.1.31
[Updated on the 1st of March 2010]
RimmBugger BETA V1.8
Here. https://git.villavu.com/?p=simba.git...lour_conv.pas;
hueMod and satMod default to 0.2, Shuttleu.![]()
The best way to contact me is by email, which you can find on my website: http://wizzup.org
I also get email notifications of private messages, though.
Simba (on Twitter | Group on Villavu | Website | Stable/Unstable releases
Documentation | Source | Simba Bug Tracker on Github and Villavu )
My (Blog | Website)
Thanks! That cleared out couple of issues I had with colours![]()
A Chinese wiseman once said: "Shu ciu!", it was considered very smart, but now people know it means: "Something stinks here!"
FalBuggySmelter v.1.31
[Updated on the 1st of March 2010]
RimmBugger BETA V1.8
There are currently 1 users browsing this thread. (0 members and 1 guests)