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:
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;