SRL Archive - OSR Help

Autocolor


void_hatred

2010-02-13 12:08:25

Hello again,

so today I've been experimenting with some more SCAR/SRL procedure/functions and have come to a little problem.

I'm wanting to use RadialWalk to navigate throughout Lumby Castle; the first time I pick the color and execute the function it works great, but after that it doesn't (the colors must be dynamic and not static)

So I've come looking in hope for some autocolor help (because I don't know where to begin)

I've looked through AutoColor.scar and could find FindFallyRoadColor, FindLumbyRoadColor etc, but no mention of Lumbridge castle.

help would be greatly appreciated!


program CookChickens;
{.include SRL/SRL.scar}

var
i, x, y: Integer;
colors: TPointArray;

begin
SetupSRL;
MakeCompass('S');

RadialWalk(8816269, 10, 0, 52, 2, 2);
FFlag(0);

FindColorsSpiralTolerance(x, y, colors, 3225920, MSX1, MSY1, MSX2, MSY2, 0);

for i := 0 to High(colors) do
begin
MMouse(colors[i].x, colors[i].y, 3, 3);

if IsUpText('air') then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, true);
break;
end;
end;

Wait(750 + Random(500));
Mouse(x, y, 0, 0, false);
ChooseOption('own');
end.

(does not have failsafe for RadialWalk etc atm, but will get around to that)

void_hatred.

Frement

2010-02-13 12:18:31

ACA Is the thing you want :)

SRL/Scripting Tools/Auto Color Aid v2.exe

I would explain more but i have to go now, maybe some1 else will take over.

noidea

2010-02-13 13:42:56

I'm 100% sure the lumbridge castle uses findLumbyRoadColor or one of the colour finders in there

void_hatred

2010-02-13 15:27:27

noidea, thanks for the post; however FindLumbyRoadColor doesn't appear to work for me (I've tried different tolerances, e.g. 1, 6, 10 but it still didn't work

void_hatred

Blumblebee

2010-02-13 15:32:41

From: void_hatred
noidea, thanks for the post; however FindLumbyRoadColor doesn't appear to work for me (I've tried different tolerances, e.g. 1, 6, 10 but it still didn't work

void_hatred


most autocolors in SRL are broken atm. I could toss a few different autocolor type functions i've made if you would like, just let me know ;)

void_hatred

2010-02-13 15:56:40

blumblebee that would be amazing! I could study the code to try and develop a deeper understanding :)

I wish I could attempt to make my own, but I'm a noob at the moment :)

void_hatred

Gu3st...

2010-02-13 15:58:31

The best method to understand how autocoloring works is to open ACA found in Scripting Tools/ and designing one yourself :)

void_hatred

2010-02-13 16:08:37

Zyt3x thanks again, Frement also recommended ACA. I have searched but cannot find any tutorials on ACA, so I am not entirely sure how to use correctly.

it appears that I am posting a lot, and so some may think that I am spamming (I hope not), so could someone possibly assist me on an instant messenger, e.g. MSN? thank you.

[email]void.hatred@hotmail.com[/email]

thanks a bunch,
void_hatred

Gu3st...

2010-02-13 16:13:01

From: void_hatred
Zyt3x thanks again, Frement also recommended ACA. I have searched but cannot find any tutorials on ACA, so I am not entirely sure how to use correctly.

it appears that I am posting a lot, and so some may think that I am spamming (I hope not), so could someone possibly assist me on an instant messenger, e.g. MSN? thank you.

[email]void.hatred@hotmail.com[/email]

thanks a bunch,
void_hatred
I have you added, but you're not online

bbri06

2010-02-13 16:53:04

http://www.villavu.com/forum/showpost.php?p=618675&postcount=4

Autocoloring section in that.

Blumblebee

2010-02-13 18:59:34

From: void_hatred
blumblebee that would be amazing! I could study the code to try and develop a deeper understanding :)

I wish I could attempt to make my own, but I'm a noob at the moment :)

void_hatred



Procedure SortColors(var Colors: tIntegerArray; col: Integer);
var
tempB: tIntegerArray;
Tol: ShortInt;
I: Integer;
timer, L: LongInt;
begin
timer := getsystemtime;
tempB := Colors;
SetArrayLength(Colors, 0);
Tol := 0;
while Length(Colors) < (Length(tempB)/2 or 5) do
begin
if Getsystemtime-timer > 100 then Break;
for i := 0 to High(tempB) do
begin
if SimilarColors(tempB[i], col, Tol) then
begin
L := GetArrayLength(Colors);
SetArrayLength(Colors, L+1);
Colors[L] := tempB[i];
end;
if Tol > 10 then Break;
Inc(Tol);
end;
end;
// WriteLn('Sort took : '+IntToStr(getsystemtime-timer)+' ms');
end;

Function AutoColorMM(const color: Integer): Integer;
var
TPA: tPointArray;
List: tIntegerArray;
I: Integer;
begin
for i := 0 to 15 do
begin
FindColorsTolerance(TPA, color, MMx1, MMy1, MMx2, MMy2, 10+i);
if Length(TPA) > 0 then Break;
end;
if Length(TPA) <= 0 then Exit;
List := getColors(TPA);
sortColors(List, color);
if Length(List) <= 0 then Exit;
result := List[0];
end;

used like:

const
MM_COLOR_white = 15267825;

begin
AutoColor := AutoColorMM(MM_COLOR_white);
debug('AutoColor = '+IntToStr(AutoColor));
end.

you can mess with the syntax to allow custom tolerances and ranges, but I found that a basic range from 10-25 always works for me nicely.

I autocolour funny compared to other people, but it works for me so I use it :)