Can somebody explain me these functions and the use of them? I saw these in many scripts, I dont know what they do.
Simba Code:CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(Hue, Sat);
Can somebody explain me these functions and the use of them? I saw these in many scripts, I dont know what they do.
Simba Code:CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(Hue, Sat);
GetColorToleranceSpeed Grabs the current CTS, which is defaulted to 1 iirc.
The next line, ColorToleranceSpeed sets it to 2. You can use 0/1/2/3 for the parameter.
The modifiers are what modify what the client looks for. masterBB has a great tutorial on this, and I would suggest you read that![]()
Away for awhile, life is keeping me busy. | Want to get my attention in a thread? @Kyle Undefined; me.
{ MSI Phoenix || SRL Stats Sigs || Paste || Scripts || Quotes || Graphics }
When posting a bug, please post debug! Help us, help you!
I would love to change the world, but they won't give me the source code. || To be the best, you've got to beat the rest. || Logic never changes, just the syntax.
If you PM me with a stupid question or one listed in FAQ, or about a script that is not mine, I will NOT respond.
SRL is a Library of routines made by the SRL community written for the Program Simba. We produce Scripts for the game Runescape.
Here's the link:
http://villavu.com/forum/showthread....ght=Master+CTS
Simply a GOD beast...
My Tutorials
So CTS2 is a faster way to grab colors when using FindColorsTolerance? Sat and Hue should be different for each colors we grabbing? How to set them properly?
also if you have just stumbled upon this cts goes hand and hand with A.C.A irrasistably !!!
aca can function with cts mod 1 2 and 3 err a but im not sure how to use 3 with aca or in fact if even there are modifiers for it
Excerpt from 'Custom TPA Finding & ColorToleranceSpeed(2) Modifiers!':
First, paste this into a new script in Simba, and SAVE IT. You will need it if you continue to use TPA's.
I'll tell you what you need it for in a minute, so just hang on to your britches, kiddo.Simba Code:program New;
//By Mastaraymond
//0 = Min
//1 = Max
var
I,II : integer;
RGBColor : Array[1..3] of Integer;
RGB : Array[0..1] of Array[1..3] of Integer;
XYZColor, HSLColor : Array[1..3] of Extended;
HSL,XYZ : Array[0..1] of Array[1..3] of Extended;
Colors : TIntegerArray;
Strings : Array[0..9] of String;
Procedure Init;
begin;
Colors := [];
end;
begin
Init;
For I:= 1 to 3 do
begin;
Writeln('');
RGB[0][i] := 255;
HSL[0][i] := 255; //Max is 240?
XYZ[0][i] := 255; //Max is ...?
end;
Strings[1] := 'R: ';
Strings[0] := ' ';
Strings[2] := 'G: ';
Strings[3] := 'B: ';
Strings[4] := 'H: ';
Strings[5] := 'S: ';
Strings[6] := 'L: ';
Strings[7] := 'X: ';
Strings[8] := 'Y: ';
Strings[9] := 'Z: ';
For I:= 0 to High(Colors) do
begin;
Strings[0] := Strings[0] + Padr('Color: '+inttostr(Colors[i]),16) +' | ';
ColortoRGB(Colors[i],RGBColor[1],RGBColor[2],RGBColor[3]);
ColortoHSL(Colors[i],HSLColor[1],HSLColor[2],HSLColor[3]);
ColortoXYZ(Colors[i],XYZColor[1],XYZColor[2],XYZColor[3]);
For II:= 1 to 3 do
begin;
RGB[0][II] := Min(RGBColor[II],RGB[0][II]);
RGB[1][II] := Max(RGBColor[II],RGB[1][II]);
HSL[0][II] := MinE(HSLColor[II],HSL[0][II]);
HSL[1][II] := MaxE(HSLColor[II],HSL[1][II]);
XYZ[0][II] := MinE(XYZColor[II],XYZ[0][II]);
XYZ[1][II] := MaxE(XYZColor[II],XYZ[1][II]);
end;
For II := 1 to 3 do
Strings[II] := Strings[II] +Padr(IntToStr (RGBColor[II]),16) +' | ';
For II := 4 to 6 do
Strings[II] := Strings[II] +Padr(FloatToStr(HSLColor[II-3]),16) +' | ';
For II := 7 to 9 do
Strings[II] := Strings[II] +Padr(FloatToStr(XYZColor[II-6]),16) +' | ';
end;
For I:= 0 to 9 do
Delete(Strings[i],Length(Strings[i])-2,3);
For I:= 0 to 9 do
begin;
if (I = 1) or (I = 4)or (I = 7) then Writeln('');
Writeln(Strings[i]);
end;
Writeln('');
Writeln('Highest RGB values = R: '+ Padr(FloatToStr(RGB[1][1]),3) + ' | ' +'G: '+ Padr(FloatToStr(RGB[1][2]),3) + ' | ' +'B: '+ Padr(FloatToStr(RGB[1][3]),3) );
Writeln('Lowest RGB values = R: '+ Padr(FloatToStr(RGB[0][1]),3) + ' | ' +'G: '+ Padr(FloatToStr(RGB[0][2]),3) + ' | ' +'B: '+ Padr(FloatToStr(RGB[0][3]),3) );
Writeln('Differ RGB values = R: '+ Padr(IntToStr(RGB[1][1] - RGB[0][1]),3) + ' | G: '+ Padr(inttostr(RGB[1][2] - RGB[0][2]) ,3) + ' | B: '+Padr(inttostr(RGB[1][3] - RGB[0][3]),3));
Writeln('Middle RGB values = R: '+ Padr(IntToStr((RGB[1][1] + RGB[0][1]) div 2),3) + ' | G: '+ Padr(inttostr((RGB[1][2] + RGB[0][2]) div 2),3) + ' | B: '+Padr(inttostr((RGB[1][3] + RGB[0][3]) div 2),3));
Writeln('Middle RGB color = ' + IntToStr(RGBToColor((RGB[1][1] + RGB[0][1]) div 2,(RGB[1][2] + RGB[0][2]) div 2,(RGB[1][3] + RGB[0][3]) div 2)));
Writeln('');
Writeln('Highest HSL values = H: '+ Padr(FloatToStr(HSL[1][1]),16) + ' | ' +'S: '+ Padr(FloatToStr(HSL[1][2]),16) + ' | ' +'L: '+ Padr(FloatToStr(HSL[1][3]),16) );
Writeln('Lowest HSL values = H: '+ Padr(FloatToStr(HSL[0][1]),16) + ' | ' +'S: '+ Padr(FloatToStr(HSL[0][2]),16) + ' | ' +'L: '+ Padr(FloatToStr(HSL[0][3]),16) );
Writeln('Differ HSL values = H: '+ Padr(FloatToStr(HSL[1][1] - HSL[0][1]),16) + ' | S: '+ Padr(FloatToStr(HSL[1][2] - HSL[0][2]) ,16) + ' | L: '+Padr(FloatToStr(HSL[1][3] - HSL[0][3]),16));
Writeln('Middle HSL values = H: '+ FloatToStr((HSL[1][1] + HSL[0][1]) div 2) + ' | S: '+ FloatToStr((HSL[1][2] + HSL[0][2]) div 2) + ' | L: '+FloatToStr((HSL[1][3] + HSL[0][3]) div 2));
Writeln('Middle HSL color = ' + IntToStr(HSLToColor((HSL[1][1] + HSL[0][1]) div 2,(HSL[1][2] + HSL[0][2]) div 2,(HSL[1][3] + HSL[0][3]) div 2)));
Writeln('');
Writeln('Highest XYZ values = X: '+ Padr(FloatToStr(XYZ[1][1]),16) + ' | ' +'Y: '+ Padr(FloatToStr(XYZ[1][2]),16) + ' | ' +'Z: '+ Padr(FloatToStr(XYZ[1][3]),16) );
Writeln('Lowest XYZ values = X: '+ Padr(FloatToStr(XYZ[0][1]),16) + ' | ' +'Y: '+ Padr(FloatToStr(XYZ[0][2]),16) + ' | ' +'Z: '+ Padr(FloatToStr(XYZ[0][3]),16) );
Writeln('Differ XYZ values = X: '+ Padr(FloatToStr(XYZ[1][1] - XYZ[0][1]),16) + ' | Y: '+ Padr(FloatToStr(XYZ[1][2] - XYZ[0][2]) ,16) + ' | Z: '+Padr(FloatToStr(XYZ[1][3] - XYZ[0][3]),16));
Writeln('Middle XYZ values = X: '+ FloatToStr((XYZ[1][1] + XYZ[0][1]) div 2) + ' | Y: '+ FloatToStr((XYZ[1][2] + XYZ[0][2]) div 2) + ' | Z: '+FloatToStr((XYZ[1][3] + XYZ[0][3]) div 2));
Writeln('Middle XYZ color = ' + IntToStr(XYZToColor((XYZ[1][1] + XYZ[0][1]) div 2,(XYZ[1][2] + XYZ[0][2]) div 2,(XYZ[1][3] + XYZ[0][3]) div 2)));
WritelN('');
end.
So, we want to find something, right? Well, for that, we need colors. Go ahead, choose some colors from something or another. Be it from a tree, or a Lesser Demon. It doesn't really matter. Just get 3-5 different colors to make this work as well as it can.
Now, in that script I just had to paste in, find where it says Colors := [];
Paste in your 3-5 colors, separated by a comma (,);
Now click run. Like magic, things popped up in our Debug Box! Oh yay~
Find where it says Differ HSL Value. Everything surrounding this is important.
Okay. First, we need to change something in the TPA finding script we're developing. We're going to add a nice little thing we call... *drumroll* SetColorSpeed2Modifers.
YAY!
This sets the Hue and Saturation modifiers used for finding colors with tolerance. You'll see...
Simba Code:program TPALearningTut;
{.include SRL/SRL.simba}
function TPAFinder(x, y: Integer): Boolean;
var
CTS, I: Integer; //CTS will store the ColorToleranceSpeed before we change it, for later.
TPA: TPointArray; //The TPointArray in which all Coordinates which are found later will be stored
ATPA: Array of TPointArray;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2); //Sets the color tolerance speed to 2 so we can do HSL tolerance stuff
SetColorSpeed2Modifiers(HueMod, SatMod);
end;
begin
end.
It only has those two modifiers, so it's not that bad.
Now comes the math time.
Remember that info in the debug text box? Well, we'll need to do some stuff.
Here's what you need to do.
Divide H by L to get = HueMod
Divide S by L to get = SatMod
L is your Tolerance (rounded up)
Middle HSL color is the color (You'll need this and Tolerance in a sec.)
Remember, all these values are in Differ HSL values, after putting in the colors of whatever you did. At this point, you should almost understand what I'm talking about.
Put in your values for HueMod and SatMod.
Simply a GOD beast...
My Tutorials
Thanks for your input, abu! Will test it tomorrow!!![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)