SRL Archive - OSR Help

CTS0 or 1?


Footy

2012-08-28 13:47:35

I often use ACA to find a best color to use in findcolor functions, but when doing this, should I have CTS set to 0 or 1? Or if using ACA for this is bad practice, let me know! Thanks in advance

Solar

2012-08-28 13:51:51

I thought CTS2 was the better option, at least that's what was in YoHoJo's video tut.

Footy

2012-08-28 13:53:21

Findcolorstolerance doesent support hue mod and sat mod, and I currently dont know how to use CTS2 for object finding.

CephaXz

2012-08-28 13:55:18

From: Footy
Findcolorstolerance doesent support hue mod and sat mod, and I currently dont know how to use CTS2 for object finding.


It does. As long as you set the CTS and modefiers.

    
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(2.67, 2.07);
FindColorsTolerance(TPA, 8025465, MSX1, MSY1, MSX2, MSY2, 5);

Solar

2012-08-28 13:56:44

Wouldn't you be able to use SetColorspeed2Modifiers?

x[Warrior]x3500

2012-08-28 13:57:07

i use CTS 2 for almost everything. all of my object finding is cts 2. its way more accurate than 0,1,3. i would highly recommend u use it

Footy

2012-08-28 13:57:31

:O So i can do something like this and it will use CTS2?

Procedure this
var
ColorTPA:TPointArray
begin
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(huemod, satmod);
findcolorspiraltolerance(...)
end;


CephaXz

2012-08-28 13:58:49

From: Footy
:O So i can do something like this and it will use CTS2?

Procedure this
var
ColorTPA:TPointArray
begin
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(huemod, satmod);
findcolorspiraltolerance(...)
end;



Yes. And don't forget to set it back to the normal CTS at the end of the procedure or function. One of my old function:


Function ClickAltar7 :Boolean;
var
a,t, CurrentXP: Integer;
TPA : TPointArray;
ATPA : T2DPointArray;
MP : TPoint;
tmpCTS : Integer;
begin
if(not(LoggedIn))then Exit;
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(2.67, 2.07);

FindColorsTolerance(TPA, 8025465, MSX1, MSY1, MSX2, MSY2, 5);
SortTPAFrom(TPA, Point(MSCX, MSCY));
ATPA := TPAtoATPAEx(TPA, 40, 40);
SortATPAFromSize(ATPA, 500, true);

CurrentXP := GetXPBarTotal;

for a := 0 to High(ATPA) do
begin
SMART_DrawDotsEx(true,ATPA[a], clAqua);
MP := MiddleTPA(ATPA[a]);
//MMouse(MP.X, MP.Y, 4, 4);
MoveMouse(MP.X, MP.Y);
if WaitUpTextMulti(['raft', 'ft-ru', 'rune', 'ne Altar'], 2000) then
begin
//ClickMouse2(mouse_Left);
ClickMouse(MP.X, MP.Y, mouse_Left);
writeln('Crafting Runes');
MarkTime(t);
repeat
wait(10);
if TimeFromMark(t) > 4000 then
ClickAltar6;
until CurrentXP < GetXPBarTotal;
writeln('Crafted runes');
wait(RandomRange(400, 500));
Result := True;
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
end;

You can see tmpCTS := GetColorToleranceSpeed; is to take the current CTS before setting it is CTS 2. And at the end of the function, I set it back to the previous CTS and 0.2 in both hue and sat (Default in CTS 1 I think).

Footy

2012-08-28 13:59:49

Alright, Thanks! Ill be sure to use this in scripts for now on!

litoris

2012-08-28 14:19:20

Screw CTS2, skip right onto CTS3. Final version of ACA supports CTS3 and you add it onto Simba, like the DTM editor. If you set the colors correctly, it takes just about the same time as CTS2 to find the colors, and has more accurate results.(On the other hand, it's hard to get the colors right. Most colors give you 1-2 points in the array, which is very unreliable, and if you have too high tolerance, it may adds many points to the array and that takes 5+ minutes to compute in Simba) It has only one modifier, and you don't have to use it because it is directly derived from tolerance. I suggest you get your hand on the latest ACA and try it. The standalone ACA gets the colors wrong anyway.(acknowledged by the dev on the thread)

x[Warrior]x3500

2012-08-28 14:21:18

From: litoris
Screw CTS2, skip right onto CTS3. Final version of ACA supports CTS3 and you add it onto Simba, like the DTM editor. If you set the colors correctly, it takes just about the same time as CTS2 to find the colors, and has more accurate results.(On the other hand, it's hard to get the colors right. Most colors give you 1-2 points in the array, which is very unreliable, and if you have too high tolerance, it may adds many points to the array and that takes 5+ minutes to compute in Simba) It has only one modifier, and you don't have to use it because it is directly derived from tolerance. I suggest you get your hand on the latest ACA and try it. The standalone ACA gets the colors wrong anyway.(acknowledged by the dev on the thread)


i have still found cts2 far more accurate than cts3 in most cases

Footy

2012-08-28 14:30:22

I'm getting this error when running this script, can someone help me?
Error:
[Error] C:\Simba\Scripts\Agility.simba(58:23): Unknown identifier 'tmpCTS' at line 57
Compiling failed.

Script:
program new;
{$i srl/srl.simba}

procedure DeclarePlayers;
Begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

Players[0].Name := ''; //Username Here!
Players[0].Pass := ''; //Password Here!
Players[0].Pin := ''; //Pin here!
Players[0].Active := True;

Players[1].Name := ''; //Username Here!
Players[1].Pass := ''; //Password Here!
Players[1].Pin := ''; //Pin here!
Players[1].Active := False; //Set to true if you are using

End;

Procedure SetupStuff;
begin
SetupSRL;
DeclarePlayers;
Loginplayer;
wait(randomrange(500, 1000));
FindNormalRandoms;
wait(randomrange(500, 1000));
end;


Function ClickLog:boolean;
var
Sex, SeY, i, Counter:Integer;
LogTPA:TPointArray;
LogATPA: T2DPointArray;
begin

ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.15, 0.28);
FindColorsSpiralTolerance(SeX, SeY, LogTPA, 3556433, MSX1, MSY1, MSX2, MSY2, 2);
LogATPA := SplitTPA(LogTPA, 15);
for i := 0 to high(LogATPA) do
begin
if MiddleTPAEX(LogATPA[i], SeX, SeY) then
Mmouse(SeX, SeY, 3, 3);
wait(randomrange(150, 400));
if IsUptextMultiCustom(['cross', 'og b', 'alenc']) then
begin
writeln('Log found!');
Clickmouse2(mouse_left);
Result := true;
Exit;
end;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
wait(randomrange(500, 2000));

end;


begin
//SetupStuff
SetupSRL;
ClickLog




end.

Solar

2012-08-28 14:32:53

I think you need to define tmpCTS as a variable.

Footy

2012-08-28 14:35:02

What type would you define it as?

litoris

2012-08-28 14:39:33

From: x[Warrior]x3500
i have still found cts2 far more accurate than cts3 in most cases


http://villavu.com/forum/showthread.php?t=40686
One of the few threads comparing CTS modes.

I used to do CTS2, but through experiments I found CTS3 to be more accurate. Depends on what sort of accuracy you want though– if it's something with homogeneous colors(ie. ore on rock) 3 works much better, for larger objects with more similar but different colors, 2 could be better. Not having to bother with hue and saturation gets me :P
Edit:^Integer, bu you don't really have to because it is 0 1 by default. Just set it to 0 1 after finding the colors.(0 1 is used in text finding)

CephaXz

2012-08-28 14:40:11

From: Footy
What type would you define it as?


Integer. Look at the example I posted above :D

Footy

2012-08-28 14:49:13

:duh: Forgot about the example, thanks :D

masterBB

2012-08-28 14:56:16

From: litoris
Edit:^Integer, bu you don't really have to because it is 0 by default. Just set it to 0 after finding the colors.(0 is used in text finding)


1, CTS 1 is default iirc

litoris

2012-08-28 16:28:10

From: masterBB
1, CTS 1 is default iirc


Yeah, just checked:duh: Thanks.
Edit:You are the guy who wrote the master tutorial! /Respect