SRL Archive - Help and Support

Entrana to Law Alter.


Claymore

2008-10-18 21:09:01

My progress for creating the Law Runecrafting script is progressing well. But i am having problems walking to the Law alter from the ship in the dock. Any tips from professional scripters on how this works? Thanks ;p

NiCbaZ

2008-10-18 21:30:56

I would AuToColor the Rock Walking Via The raod, autocolor the bridge or use a DDTM, As for the forest part mabbe Use a TPA to find all the trangle tree's and click in the middle of them?

Claymore

2008-10-18 21:33:17

Oh snap! I shouldve thought of that for finding the alter in the MM, thanks NiCbaz, and i already started autocoloring entrana road and used RRW to move around the roads, ill try the bridge, thanks again.

BTW whats rock walking =p

NiCbaZ

2008-10-18 21:49:14

Just use radialWalk on the rocks, autocolor the rock with SRL's function or make your own , and the use a DDTM or RRw

Claymore

2008-10-18 22:09:08


function FindMMAlter: Boolean;
var
TPA: TPointArray;
P: TPoint;
X, Y: Integer;
begin
FindColorsTolerance(TPA, 537660, MMX1, MMY1, MMX2, MMY2, 5);
Result := (Length(TPA) > 5);
if (Result) then
begin
P := MiddleTPA(TPA);
X := P.X;
Y := P.Y;
Mouse(X, Y, 5, 5, True);
FFlag(5);
Exit;
end;
Exit;
end;

I used the shrubs surrounding the alter, but the color is just too common, (I tried 0 tolerance) and also thanks for the other tips, it made it into the bridge, than it just got out of track, landed some random place.

I used a Road DDTM (Some curve of a road) and used its position and added/subtracted to the MM alter. Works but it might not work sometimes (Hasn't fail but i'm sure it will soon.) My fail safe is a blind click =p

Well thanks NiCbaZ.

tarajunky

2008-10-19 01:14:43

You should be able to autocolor one of the Tree colors on the minimap, then use that to make a DDTM for the position of the altar.

Create the DDTM, then do DTMRotated to find the position.


Claymore

2008-10-19 02:13:10


function FindTreeColor: Integer;
var
GC, A, L, TestColor: Integer;
P: TPointArray;
begin
GC := 801817;
Flag;
FindColorsSpiralTolerance(MMCX, MMCY, P, GC, MMX1, MMY1, MMX2, MMY2, 70);
L := GetArrayLength(P);
for A := 0 to L-1 do
begin
if rs_OnMinimap(P[A].X, P[A].Y) then
begin
TestColor := GetColor(P[A].X, P[A].Y);
if GetColor(P[A].X+1, P[A].Y) = TestColor - 525792 then
begin
Result := TestColor;
WriteLn('Tree Color = ' + IntToStr(TestColor));
Exit;
end;
end;
end;
WriteLn('Could not find Tree Color.');
Result := 0;
end;

You are awesome! How did you figure this all out! Thanks dude! Now to make the DTM (DDTM) and I'm on my way to crafting a stuff!

EDIT:


EDIT EDIT:

Never mind, i forgot to specificly search for the DTM rather than just the whole mini-map, :p I'm so smart :D

Thanks tarajunky and NiCBaZ, looks like i solved 1 out of 5 problems in the script, the walking is flawless so far.

Progress:

Can walk to Draynor Bank to Monks. Hitches a ride on the boat, than gets off the boat if it finds itself on the ship (in MM) and finds message 'arrived'. Than walks to dock to ALTAR! YES! Now ill test it for a couple of days, if anything goes wrong, than thats life :D

Enters Law Altar using tally or tiara. Than walks to center. (Didnt take a while at all, it was an easy task.)

well thats the progress so far, see you in like a month when im finished!

Zezi

2008-10-19 12:18:36

need beta testers for this beast? :|!!

Claymore

2008-10-19 12:38:09

tarajunky, the auto-color works no more (The difference) but i changed it and it works now, wont tell the range because i get a feeling a jagex staff is watching… ;p stange feeling thing.

Cazax

2008-10-19 12:48:33

From: Deathscytex
tarajunky, the auto-color works no more (The difference) but i changed it and it works now, wont tell the range because i get a feeling a jagex staff is watching… ;p stange feeling thing.


If the difference is changing then make a range:
If InRange(A - B, LowestDifference, HighestDifference) Then

Get the colors a couple of times and use the lowest and highest difference.

Claymore

2008-10-19 12:51:56

Slappy-my-face

Why didnt i think of that!…

Wait, whats a and b?

a := getcolor(original)
b := getcolor(next to original)

or is it one of those RGB/XYZ auto colors?

Cazax

2008-10-19 12:56:50

From: Deathscytex
Slappy-my-face

Why didnt i think of that!…

Wait, whats a and b?

a := getcolor(original)
b := getcolor(next to original)

or is it one of those RGB/XYZ auto colors?


a := getcolor(original)
b := getcolor(next to original)

To know if you have to do a - b or b - a use this:
Max(a, b)  - Min(a, b)

or:
iAbs(a - b)
they are the same.

Claymore

2008-10-19 13:01:33


function FindTree: Integer;
var
GC, A, L, TestColor, NextColor: Integer;
P: TPointArray;
begin
GC := 279098;
Flag;
FindColorsSpiralTolerance(MMCX, MMCY, P, GC, MMX1, MMY1, MMX2, MMY2, 60);
L := GetArrayLength(P);
for A := 0 to L-1 do
begin
if rs_OnMinimap(P[A].X, P[A].Y) then
begin
NextColor := GetColor(P[A].X-1, P[A].Y);
TestColor := GetColor(P[A].X, P[A].Y);
if InRange(NextColor - TestColor, 1504, 525792) then
begin
Result := TestColor;
WriteLn('Tree Color = ' + IntToStr(TestColor));
Exit;
end;
end;
end;
WriteLn('Could not find Tree Color.');
Result := 0;
end;

W00t! Its working now! Thanks Carax, my first auto-color that does this (Mine is based on RGB/HSL/XYZ) but now i fully (I think) understand auto-coloring.

Cazax

2008-10-19 13:12:55

From: Deathscytex

if InRange(TestColor - GetColor(P[A].X-1, P[A].Y), 1504, 525792) then

I forgot to tell you the difference range are a bit…. spread out.

If the difference is high then you shouldn't use that way of autocoloring. Use RGB, HSL or/and XYZ. Get a couple of times the color and get those values(RGB, HSL or/and XYZ). Use the lowest value and the highest value.
ColorToRGB(A, VarR, VarG, VarB); // HSL or XYZ
...
ColorToRGB(GetColor(Blah, Blah), VarR2, VarG2, VarB2);
If ((R - R2 < X) And (R - R2 > X)) And ((G - G2 < X) And (G - G2 > X)) And ((B - B2 < X) And (B - B2 > X)) Then

Claymore

2008-10-19 13:35:43

Alright, i got it, thanks


function FindTree: Integer;
var
GC, A, L, TestColor, NextColor: Integer;
P: TPointArray;
R1, G1, B1, R2, G2, B2: Integer;
//X, Y, Z: Extended;
begin
GC := 279098;
Flag;
FindColorsSpiralTolerance(MMCX, MMCY, P, GC, MMX1, MMY1, MMX2, MMY2, 60);
L := GetArrayLength(P);
for A := 0 to L-1 do
begin
if rs_OnMinimap(P[A].X, P[A].Y) then
begin
TestColor := GetColor(P[A].X, P[A].Y);
ColorToRGB(TestColor, R1, G1, B1);
ColorToRGB(GetColor(P[A].X-1, P[A].Y), R2, G2, B2);
if (R1 - R2 >= 28) and (R1 - R2 <= 34) and (G1 - G2 >= -6) and (G1 - G2 <= 0) and (B1 - B2 >= -1) and (B1 - B2 <= 1) then
begin
Result := TestColor;
WriteLn('Tree Color = ' + IntToStr(TestColor));
Exit;
end;
end;
end;
WriteLn('Could not find Tree Color.');
Result := 0;
end;

EDIT:

So is this correct? Because it is working. (Im adding XYZ later.), im fonna take it to the test corner and get people to help. Than release it to SRL hopefully (I want to have my name written in the Includes…ahhhh.)

Cazax

2008-10-19 14:04:04

From: Deathscytex
Alright, i got it, thanks


function FindTree: Integer;
var
GC, A, L, TestColor, NextColor: Integer;
P: TPointArray;
R1, G1, B1, R2, G2, B2: Integer;
//X, Y, Z: Extended;
begin
GC := 279098;
Flag;
FindColorsSpiralTolerance(MMCX, MMCY, P, GC, MMX1, MMY1, MMX2, MMY2, 60);
L := GetArrayLength(P);
for A := 0 to L-1 do
begin
if rs_OnMinimap(P[A].X, P[A].Y) then
begin
TestColor := GetColor(P[A].X, P[A].Y);
ColorToRGB(TestColor, R1, G1, B1);
ColorToRGB(GetColor(P[A].X-1, P[A].Y), R2, G2, B2);
if (R1 - R2 >= 28) and (R1 - R2 <= 34) and (G1 - G2 >= -6) and (G1 - G2 <= 0) and (B1 - B2 >= -1) and (B1 - B2 <= 1) then
begin
Result := TestColor;
WriteLn('Tree Color = ' + IntToStr(TestColor));
Exit;
end;
end;
end;
WriteLn('Could not find Tree Color.');
Result := 0;
end;

EDIT:

So is this correct? Because it is working. (Im adding XYZ later.), im fonna take it to the test corner and get people to help. Than release it to SRL hopefully (I want to have my name written in the Includes…ahhhh.)


Yes, thats ok. The only problem is i think that the function only works for that type of trees. Try with other trees.

Claymore

2008-10-19 14:21:10

I think it works for alot, i mean different trees get mixed in together in the MM, so it would probably 90% chance work. Otherwise yea ill try and do that.

Magiic

2008-10-20 14:23:08

so this is basically a autocolored dtm?