SRL Archive - Research & Development Lounge

procedure RecordPath;


Da 0wner

2009-05-03 11:04:52

procedure RecordPath;

This is a procedure that records a path for you. It puts it into a nice function in the end and is formatted like:

function LoadPath : TPointArray;
begin
SetArrayLength(Result, 1);

Result[0] := Point(3000, 3000);
end;

To use it you can use this script:
Program RecordPath;
{.Include SRL\SRL\Misc\Smart.Scar}
{.Include SRL\SRL.Scar}
{.Include SRL\SRL\Reflection\Reflection.Scar}

const
World = 118;
Members = false;
Signed = true;

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := '';
Players[0].Active := True;
end;


Procedure SetupSMART;
Begin
SmartSetupEx(World, Members, Signed, False);
SetTargetDC(SmartGetDC);
end;

procedure RecordPath;
var
Path : TPointArray;
Pos2 : TPoint;
OffMM : boolean;
i : integer;
begin
ClearDebug;
Writeln('function LoadPath : TPointArray;');
Writeln('begin');
Writeln(' SetArrayLength(Result, 1);');
Writeln('');
repeat
if IsFKeyDown(11) then
begin
SetArrayLength(Path, GetArrayLength(Path) + 1);
Pos2 := GetMyPos;
Writeln(' Result[' + IntToStr(High(Path)) + '] := Point(' + IntToStr(Pos2.x) + ', ' + IntToStr(Pos2.y) + ');');
Path[High(Path)] := Point(Pos2.x, Pos2.y);
if GetArrayLength(Path) > 1 then
begin
OffMM := not TileOnMM(Path[High(Path) - 1]);
if OffMM then Writeln(' //Warning: The recorded tile is not in range of last tile. Press F10 to delete it.');
end;
Wait(250);
end;
if ((IsFKeyDown(10)) and (GetArrayLength(Path) > 0)) then
begin
if OffMM then
for i := GetDebugLineCount - 1 downto 1 do
if pos('Warning', GetDebugLine(i)) > 0 then
DeleteDebugLine(i);
DeleteDebugLine(GetDebugLineCount - 1);
SetArrayLength(Path, GetArrayLength(Path) - 1);
Wait(250);
end;
until(IsFKeyDown(12));
if GetArrayLength(Path) = 0 then
begin
ClearDebug;
Writeln('No path was recorded.');
exit;
end;
Writeln('end;');
ReplaceDebugLine(2, ' SetArrayLength(Result, ' + IntToStr(GetArrayLength(Path)) + ');');
end;

begin
SetupSRL;
SetupSMART;
SetupReflection;
DeclarePlayers;
if not LoggedIn then
LoginPlayer;
RecordPath;
end.

Commands:
F11 - Record current tile
F12 - Stop script
F10 - Remove last recorded tile

I hope you find it easier to record a path with this :D.

Also this is for Reflection paths.

Hobbit

2009-05-03 11:06:13

Fixed your title ;)

Not bad proc

Da 0wner

2009-05-03 11:07:11

Haha, hopefully nobody saw the title :p.
Fail :'(.

senrath

2009-05-03 11:42:03

I saw the title, and it made me wonder what the heck was going on.

Anyway, this'll come in handy, as later today I'm planning on generating multiple paths. Thanks.

Da 0wner

2009-05-03 11:43:12

Senrath, hopefully you didn't view the topic/thread. I left my username and password in :'(.

senrath

2009-05-03 11:47:31

Oh, no, I didn't. I just saw the title.

Da 0wner

2009-05-03 11:49:46

Okay, tell me how it goes when you create path. Tell me if it works :).

Floor66

2009-05-03 11:54:03

Way to go! :D
This'll help lots of people.

Da 0wner

2009-05-03 11:55:25

Wtf Floor, go on msn :'(.

And how was Queen's birthday or whatever it is?

Nadeem

2009-05-03 12:04:41

Nice :P

Now time to use this and build some reflection tiles for our procs :D:D:D

Da 0wner

2009-05-03 12:05:45

Yup, this will be pretty useful to use with VAIO :).

cycrosism

2009-05-03 13:11:37

So your adding reflection into the VAIO?

Da 0wner

2009-05-03 13:13:50

Yes because mormonman has reflection in his script.

Also because since we are going to have it auto detect your current location and calculate a path to your destination this will make it EXTREMELY easier.

jakeyboy29

2009-05-03 14:37:09

From: Da 0wner


And how was Queen's birthday or whatever it is?


owww, u didnt hear? google it.

'Queens day 2009'

Camaro'

2009-05-04 05:51:31

nice proc, gj

mormonman

2009-05-04 05:59:27

From: Da 0wner
Yes because mormonman has reflection in his script.

Also because since we are going to have it auto detect your current location and calculate a path to your destination this will make it EXTREMELY easier.


ooo… I feel like I have power over the whole project :p

Da 0wner

2009-05-04 06:06:06

From: mormonman
ooo… I feel like I have power over the whole project :p


:D:norris:. Have you tested the procedure?

senrath

2009-05-04 06:09:50

I have. It works well.

Da 0wner

2009-05-04 06:10:22

Alright, thanks :D.

Sir R. M8gic1an

2009-05-04 07:00:42

It doesn't check if the tile is too far away ;)

~RM

Da 0wner

2009-05-04 07:15:17

Lol nub RM, I added that but it didn't work. Add it for me pl0x?

Sir R. M8gic1an

2009-05-05 00:54:03

From: Da 0wner
Lol nub RM, I added that but it didn't work. Add it for me pl0x?


they can't be further than 15 tiles from each other ;) you figure it out :D

~RM

Da 0wner

2009-05-18 17:30:48

Updated.
Checks if last recorded tile is off the minimap, if it is it warns you.