SRL Archive - Reflection Development

[Function] Very Useful for Reflection


deathbyvirus

2008-08-07 14:59:34

well this function is really simple and is meant for reflection, it just reverses a path (TPointArray) which is incredibly useful for walking back from anything really, any script that uses a path to get to a location and then you need to get back to it, such as from a bank to mining spot, and then back again, instead of having the 2 paths, just use 1 and reverse it for the way back, anyways yea, i kinda over explained that haha


{*******************************************************************************
function ReversePath(Path: TPointArray): TPointArray;
By: DeathByVirus
Description: Reverses the points in a path, useful for walking back from a
location
*******************************************************************************}

function ReversePath(Path: TPointArray): TPointArray;
var
i: integer;
begin
if Length(path) < 2 then Exit;

SetLength(Result, Length(Path));

for i := 0 to high(Path) do begin
Result[i] := Path[high(Path) - i];
end;
end;

i don't mean to be pushy but i really think this should be in the svn, or atleast something like it because its really useful

Shuttleu

2008-08-07 15:04:56

quite useful but i think its unnecessary you could make something yourself to walk back

like if you do

for I := 1 to High(Path) do
begin
if TileOnMM(Path[i].x, Path[i].y) then
begin
If WalkToTile(Path[i].x, Path[i].y) then
fflag(8);
end else
exit;
end;
to walk there then all you have to do to get back is
for High(Path) downto i:=0 do
begin
if TileOnMM(Path[i].x, Path[i].y) then
begin
If WalkToTile(Path[i].x, Path[i].y) then
fflag(8);
end else
exit;
end;
nope dont think this should go in
sorry

~shut

deathbyvirus

2008-08-07 15:12:35

oh I see, I've just learned about reflection and don't know all the functions yet, but I was seeing it to be used with WalkThePath, which would require much less coding if this was used with it

n3ss3s

2008-08-07 15:13:20

Oh noes! I'll be just evil and use WizzyPlugin



Function ReversePath(TPA: TPointArray): TPointArray;

Begin
Result := InvertTPA(TPA);
End;


the scar noob

2008-08-07 15:15:06

From: n3ss3s
Oh noes! I'll be just evil and use WizzyPlugin



Function ReversePath(TPA: TPointArray): TPointArray;

Begin
Result := InvertTPA(TPA);
End;



Hah, ideed! But still nice thinking;)

-Tsn.

deathbyvirus

2008-08-07 15:23:53

oh lol, i hate when that happens hahah, but atleast i got the idea out there for it :P

Macrosoft

2008-08-07 16:38:55

Ouch…pwned by n3s. Dont worry you'll get used to it :p

Anyway, I would still like to congratulate you. You came up with an idea to help people and you scripted it yourself. Thats great scripting spirit!

deathbyvirus

2008-08-07 16:55:42

well working my way to SRL Members :P, i just haven't played runescape in over a year, and haven't been on SRL in almost 3 or 4 years lol

lordsaturn

2008-08-07 17:35:35

From: deathbyvirus
well working my way to SRL Members :P, i just haven't played runescape in over a year, and haven't been on SRL in almost 3 or 4 years lol



Lol, SRL hasn't existed for 3 or 4 years, its only been in existance since feb 2006. :p

deathbyvirus

2008-08-08 00:38:32

sorry meant scar for 3-4 years

Macrosoft

2008-08-08 19:30:08

o rly??

its ok if you were exaggerating…

BobboHobbo

2008-08-08 20:08:26

Is scar really that old :l! almost older then me :(

MylesMadness

2008-08-08 20:46:33

From: BobboHobbo
Is scar really that old :l! almost older then me :(
your almost 4…