SRL Archive - SRL Archives

Universal Road Color Finder


Cazax

2008-11-23 07:43:16

I made an universal road color finder that finds the RoadColor you are walking on. Example: You are walking in canifis, and your autocoloring function doesn't work properly or you don't know how to make one. This function gets the color of the road so you can walk using it without autocoloring. However, for better results you must start in the road, or else it will get other color. You can use it for roads, bridges, bank colors, etc.

Some pics:
Bank color:

road color(edgeville):

road color(varrock):

usage: (example) at the start of the script, you get the bank color, then you go to the mine and finally for entering to the bank you use the bank color you got + a bit of tolerance.
and the function:
Function FindAnyRoadColor: Integer;
Var
TPA, finalTPA : TPointArray;
I, J, C, tempC, maxC, placeC, tempColor, R : Integer;
Ccol, ArrC, Ccount, Dists, copiedDists : TIntegerArray;
Begin
SetArrayLength(Ccol, 25);
SetArrayLength(ArrC, 25);
For I := 625 To 629 Do
Begin
For J := 83 To 87 Do
Begin
tempC := GetColor(I, J);
Inc(C);
Ccol[C - 1] := tempC;
End;
End;
For I := 0 To High(Ccol) Do
If Ccol[I] = 16777215 Then
Begin
Ccol[I] := Ccol[Length(Ccol) - 1];
SetArrayLength(Ccol, Length(Ccol) - 1);
End;
ArrC := Ccol;
ClearSameIntegers(ArrC);
SetArrayLength(Ccount, Length(ArrC));
For I := 0 To High(ArrC) Do
For J := 0 To High(Ccol) Do
Begin
If ArrC[I] = Ccol[J] Then
Ccount[I] := Ccount[I] + 1;
End;
For I := 0 To High(Ccount) Do
maxC := Max(Ccount[I], maxC);
For I := 0 To High(Ccount) Do
If maxC = Ccount[I] Then
Begin
placeC := I;
Break;
End;
tempColor := ArrC[placeC];
FindColorsSpiralTolerance(MMCX, MMCY, TPA, tempColor, MMX1, MMY1, MMX2, MMY2, 0);
If Length(TPA) = 0 Then
Exit;
If((Length(TPA) / 18125) * 100) > 33 Then
Exit;
SetArrayLength(Dists, Length(TPA));
For I := 0 To High(TPA) Do
Dists[I] := Distance(MMCX, MMCY, TPA[I].X, TPA[I].Y);
copiedDists := Dists;
For I := 0 To High(Dists) Do
Begin
R := copiedDists[I + 1] - Dists[I];
If (R = 0) Or (R = 1) Then
Begin
SetArrayLength(finalTPA, Length(finalTPA) + 1);
finalTPA[Length(finalTPA) - 1] := TPA[I];
End;
If I + 1 = Length(copiedDists) - 1 Then
Break;
End;
If Length(finalTPA) < 100 Then
Exit;
Result := GetColor(finalTPA[Random(Length(finalTPA))].X, finalTPA[Random(Length(finalTPA))].Y);
End;

Nindustries

2008-11-23 16:05:15

very good ;)

markuska815

2008-11-23 16:11:18

Alright so I've been making a Seer's Script for a while now and I had to make my own find road color bc the normal one would find the bank color instead… Which one would yours find… the bank color or the road color?

Cazax

2008-11-23 16:14:05

From: markuska815
Alright so I've been making a Seer's Script for a while now and I had to make my own find road color bc the normal one would find the bank color instead… Which one would yours find… the bank color or the road color?

If you start(the function) in the bank, it'll give you the bank color. If you start in the road, it'll give you the road color. You can store the color for future uses(walking back).

markuska815

2008-11-23 16:16:49

Ok haha I'm too lazy to read through and think about it but basically it gives you the color youre on / close to… am i correct?

Cazax

2008-11-23 16:19:12

From: markuska815
Ok haha I'm too lazy to read through and think about it but basically it gives you the color youre on / close to… am i correct?

Basically it does that, but checking lengths, dists, etc

markuska815

2008-11-23 16:20:04

Alright i get it… well then nice work ill have to try it out.

Nava2

2008-11-24 14:42:17

I like it, but the only issue is failsafes. Like if its not perfect then it buggers it up.

Great work though :)

Also, is it fast? How about some time stamps ;)

Cazax

2008-11-24 16:41:28

From: Nava2
I like it, but the only issue is failsafes. Like if its not perfect then it buggers it up.

Great work though :)

Also, is it fast? How about some time stamps ;)

Hmm its not fast, but its not slow. 200 ms approx. I think the distance checker is wasting too much time.

Naike

2008-11-25 09:53:07

Nice one…
Now you can try using this to make a army relocater ;)

P1nky

2008-11-25 12:31:16

wow awsome, i see a future dev :P

btw, on 1 of your pics(varrock) it is not the road , it's the dirt so we can use it as well in dirt?

Nava2

2008-11-25 13:30:46

It gets the color around you P1nky.

Kasi

2008-11-25 14:22:05

wow nice u should ask to get it in to srl if it works and if u think it is ready i meen u posted it so every1 could use right or just to show off…