SRL Archive - Reflection Development

Path Tool, SMART Based.


Nava2

2008-09-07 01:31:29

Just run this script.

Fill in the variable name, and it will output the path.

Instructions:
  1. Fill in the name of the path you want to make, in the constants.
  2. Press Run.
  3. Press F2 to add Tiles, F3 to remove the most recent tile, and F4 or Stop the script to get an output.

Sorry, its rather simple.

Btw, there are some standards included. If you copy and paste the text it out puts, it has some enters, but you have to copy and paste it.

Credits to Timer for his original version.

program PathCreater;
{.include SRL/SRL/misc/smart.scar}
{.include SRL\SRL.Scar}
{.include SRL/SRL/reflection/reflection.scar}

const
VarName = 'Path';

var
I, II : integer;
S, SPC : string;
P, OP : TPoint;

procedure ScriptTerminate;
begin
Delete(s, Length(s) - 1, Length(s));
S := S + '];';
Writeln('');
if Pos('Point', S) = 0 then
Writeln('Error: No Path Created!')
else
Writeln(s);
end;

begin
ClearDebug;
SmartSetupEx(115, true, true, false);
SetTargetDC(SmartGetDC);

for I := 0 to Length(VarName) + 4 do
SPC := ' ' + SPC;
I := 0;
repeat
if (IsFKeyDown(2)) then
begin
P := GetMyPos;
if (OP.x = P.x) and (OP.y = P.y) then
begin
Writeln('Point: (' + IntToStr(p.X) + ', ' + IntToStr(p.Y) + ') is the same as last, ignoring addition.');
while IsFKeyDown(2) do
Wait(1);
Op := Point(-1, -1);
Continue;
end;
OP := P;
if I = 0 then
S := VarName + ' := [Point(' + IntToStr(p.X) + ', ' + IntToStr(p.Y) + '), '
else
S := S + 'Point(' + IntToStr(p.X) + ', ' + IntToStr(p.Y) + '), ';
Inc(II);
if II = 2 then
begin
S := S + #10#13 + SPC;
II := 0;
end;
WriteLn('[' + IntToStr(I) + '] Added Point(' + IntToStr(p.X) + ', ' + IntToStr(p.Y) + ')');
Inc(I);
while IsFKeyDown(2) do
Wait(1);
end;
if IsFKeyDown(3) then
begin
if I = 0 then
begin
Writeln('No point to remove!');
while IsFKeyDown(3) do
Wait(1);
Continue;
end;
Writeln('Removing Point [' + IntToStr(I - 1) + '].');
Delete(S, LastPos('Point', S), Length(S));
Dec(I);
Dec(II);
while IsFKeyDown(3) do
Wait(1);
end;
Wait(1);
until IsFKeyDown(4);
end.

Naum

2008-09-07 06:35:38

Lol is this an alternative to sumilions awesome pather??

J/k very nice. Origonal and simple at the sametime.
Thank-you.

3Garrett3

2008-09-07 09:37:25

It's actually just what we needed :). Much easier IMO, if you are already at the spot.

Nava2

2008-09-07 10:01:27

Thanks for the input. :)

Looking at the code, I also realized that I had t(Wai1); So i fixed that.

Tniffoc

2008-09-07 10:06:46

Wow, this has a better UI than the one I built off of Timer's. :)

Nava2

2008-09-07 20:47:50

UI?

Sorry, I don't understand.

Bonfield

2008-09-07 21:34:46

user interface

goodjob i think it is easiere and a more accurate than sumillions

Nava2

2008-09-08 21:51:45

Haven't heavily tested Sumilions, but I have tested mine. It is accurate. :)

Nava2

2009-02-08 18:27:10

Rather large update. :)

Heavenguard

2010-07-24 21:42:13

This Pathtool should be put into Reflection - Tools. It looks very nice ;D