SRL Archive - News and General

a massive well done to nielsie


Waddo

2008-06-04 12:22:28

I recently came up with a script for walking it was no good but the concept was great however i was unable to get any where near what i needed

i described it to nielsie and he has created it it is the most road walking script i have ever seen


http://www.srl-forums.com/forum/waddos-varrock-east-p385517.html#post385517
thats my miner which uses this the walking is prety good (not perfect and thats cos of ddtms and radialwalk not this lol)

go on nielsie you are a leg-end

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

function FindEdges(P: TPointArray): TPointArray;
var
b: array of array of Boolean;
i, x, y, l, c: Integer;
Box: TBox;
begin
SetLength(Result, 0);
l := Length(p);
Box := GetTPABounds(p);
x := (Box.x2 - Box.x1) + 3;
y := (Box.y2 - Box.y1) + 3;
SetLength(b, x);
for i := 0 to x -1 do
SetLength(b[i], y);
for i := 0 to l -1 do
b[p[i].x +1 - Box.x1][p[i].y +1 - Box.y1] := True;
SetLength(Result, l);
c := 0;
for i := 0 to l -1 do
for x := -1 to 1 do
for y := -1 to 1 do
try
if not b[p[i].x + 1 + x - Box.x1][p[i].y + 1 + y - Box.y1] then
begin
Result[c] := p[i];
Inc(c);
x := 2;
Break;
end;
except end;
SetLength(Result, c);
end;

procedure QuickSortExtendedTPA(var A: TExtendedArray; var B: TPointArray; iLo, iHi: Integer) ;
var
Lo, Hi: Integer;
P: TPoint;
T, M: Extended;
begin
Lo := iLo;
Hi := iHi;
M := A[(Lo + Hi) shr 1];
repeat
while (A[Lo] < M) do Inc(Lo);
while (A[Hi] > M) do Dec(Hi);
if (Lo <= Hi) then
begin
T := A[Lo];
P := B[Lo];
A[Lo] := A[Hi];
B[Lo] := B[Hi];
A[Hi] := T;
B[Hi] := P;
Inc(Lo);
Dec(Hi);
end;
until (Lo > Hi);
if (Hi > iLo) then QuickSortExtendedTPA(A, B, iLo, Hi);
if (Lo < iHi) then QuickSortExtendedTPA(A, B, Lo, iHi);
end;

function EdgeRoadWalkEx(var rx, ry: Integer; Color, Tolerance, Degree: Integer; SameRoad: Boolean): Boolean;
var
p, c: TPointArray;
q, z: T2DPointArray;
i, ii, l, ll, Dist, cc, ec: Integer;
d: TExtendedArray;
begin
FindColorsTolerance(p, Color, MMX1, MMY1, MMX2, MMY2, Tolerance);
Degree := Degree mod 360;
q := SplitTPAEx(p, 2, 2);
SetLength(p, Length(q));
ll := 0;
for ii := 0 to High(q) do
begin
if (Length(q[ii]) < 200) then Continue;
c := FindEdges(q[ii]);
l := Length(c);
//DebugTPA(c);
//Wait(3000);
cc := 0;
ec := 0;
for i := 0 to l -1 do
begin
Dist := Distance(MMCX, MMCY, c[i].x, c[i].y);
//WriteLn(IntTostr(Dist));
if (Dist < 4) then
Inc(cc);
if (Dist < 65) then
c[i] := Point(-1, -1)
else
Inc(ec);
end;
//WriteLn(IntToStr(ec)+', '+IntToStr(cc));
if (ec > 5) and (((cc > 5) and SameRoad) or (not SameRoad)) then
begin
z := SplitTPAEx(c, 3, 3);
for ec := 0 to High(z) do
if (Length(z[ec]) > 6) and (z[ec][0].x > -1) then
begin
SetLength(p, ll + 1);
p[ll] := MiddleTPA(z[ec]);
Inc(ll);
end;
end;
end;
if (ll = 0) then Exit;
if (ll > 1) then
begin
SetLength(p, ll);
SetLength(d, ll);
for i := 0 to ll -1 do
begin
d[i] := Degrees(ArcTan2(p[i].y - MMCY, p[i].x - MMCX) + 1.570796);
while (d[i] < 0.0) do
d[i] := d[i] + 360.0;
d[i] := MinE(Abs(Degree - d[i]), MinE(Abs((Degree + 360) - d[i]), Abs(Degree - (d[i] + 360))));
end;
QuickSortExtendedTPA(d, p, 0, ll -1);
end;
rx := p[0].x;
ry := p[0].y;
SetLength(d, 1);
d[0] := Degrees(ArcTan2(ry - MMCY, rx - MMCX) + 1.570796);
while (d[0] < 0.0) do
d[0] := d[0] + 360.0;
Result := (MinE(Abs(Degree - d[0]), MinE(Abs((Degree + 360) - d[0]), Abs(Degree - (d[0] + 360)))) < 30.0);
end;

function EdgeRoadWalk(Color, Degree: Integer; SameRoad: Boolean; xMod, yMod: Integer): Boolean;
var
x, y: Integer;
begin
if EdgeRoadWalkEx(x, y, Color, 0, Degree, SameRoad) then
begin
MFNF(x, y, xMod, yMod);
wait(100);
FFlag(10);
Result := True;
end;
end;

begin
SetupSRL;
RoadColor := FindRoadColor;
WriteLn(BoolToStr(EdgeRoadWalk(RoadColor, 90, True, 0, 1)));
end.


and nielsie you say its not that good again ill slap you =]

P1nky

2008-06-04 12:24:35

oh neat so its everywhere walker?

like lumby to draynor /draynor to varry?

Waddo

2008-06-04 12:38:57

yep as long as there is a road

and it shouldnt really get lost either =]

Scaper

2008-06-04 12:40:51

umm sound ok cant wait to see it released

Waddo

2008-06-04 13:33:30

no you underestimate it the time ive spent trying to perfect my banking on my miner and its still no where near perfect
took 10 mins to replace with this no failsafes and is almost perfect no just adjusting this and that but once i haveit probly will be perfect (without failsafes)


(and nielsie doesnt think its good enough yet (only improvement i can think of is small and ive told him and he is going to do it) dont know what he thinks is wrong)

EvilChicken!

2008-06-04 14:01:55

I seriously love Nielsie.
He´s rly cool.

And, I laugh inside me every time I think of 'the look he has when he´s banning noobs'.

Anyway. Can I take a look at the script? (PM..?)

P1nky

2008-06-04 14:05:31

yes i like him alot, he treats everyone the same / and is really fair keep it up nielsal even tho its hard to spell your name :)

nielsie95

2008-06-04 14:11:16

Thanks guys :)

It's a function, not a script, and it's not that great ;) Basically it finds the road you are standing on and finds the edges of the road on the edge of the MiniMap. Then it searches the part of the road that is closest to what you enter. When the road is broken up (by a symbol for example) it stops working though.

Waddo, you can post it if you want.

King of the Nites

2008-06-04 14:39:00

From: nielsie95
Thanks guys :)

It's a function, not a script, and it's not that great ;) Basically it finds the road you are standing on and finds the edges of the road on the edge of the MiniMap. Then it searches the part of the road that is closest to what you enter. When the road is broken up (by a symbol for example) it stops working though.

Waddo, you can post it if you want.


That is so sweet!! You are the coolest Nielsie and can you get any more awards under your name lol?? Haha you need some more room!!! Waddo please post it.

Jackrawl

2008-06-04 15:52:16

[british accent]A massive well done old chum, a massive well done![/british accent]

Waddo

2008-06-04 15:52:30

lol hermpie

and p1nky you have same views bout nielsie as i hae and his name is easy to spell remember lsei looks stupid and its ie ie so nIElsIE lol =]

and the way tou creat functions is in script style (thats why you put program at the top =] rite ill edit my first post and include it now

nielsies rep is disabled as if it wasnt the world would blow up as it would be infinite

hmm nielsie is a real life example of what comes aound he nice friendly and helpfull and very one loves him and respects him

bet he feels well happy =]

Sandstorm

2008-06-05 11:48:59

From: Hermpie
|_| 4r3 7h3 |337357 n13|513 w3 |0v3 y0u p|5 |37 15 |34rn m0r3 4nd r3|3453 y0ur 5(r1p7 50 w3 (4n |33(h 17 w007, 4|50 1 |0v3 7h15 n3w f1r3f0x p|u61n 15 5p33k5 1n |337 1 n3v3r (0u|d d0 7h47 w000h00007 u kn0w 7h15 15 v3ry (0000|| :)


My god, I read that o.O.


Nice Function Nielsie!

sk8terbitu

2008-06-05 16:11:37

nice work

G-man

2008-06-07 14:33:26

really, nobody thought of using the roads to walk from town to town. You're kidding right.

Well, kudos to you i guess!

itSchRis917

2008-06-07 15:36:42

Everyone thought of it obviously, however a failsafe way to do it was not developed until recently.. Great work(as usual) Nielsie!