SRL Archive - Reflection Help

N00b Needs HELP :(


norrisemoe

2009-03-08 14:37:45

Sorry guys I know I am possibly the biggest noob here but yet again I am in need of help :(

Line 16: [Error] (21095:11): Unknown identifier 'WalkPath' in script C:\Program Files\SCAR 3.20\Scripts\SMITHER.scar
Failed when compiling

Reflection doesn't love me :S why is this I have actually looked everywhere to fix this and I realise what an identifier is but I was reading Cheesy's Tut and couldn't see that he had put it in there.

Frt

2009-03-08 14:41:58

You could start by posting your script.

norrisemoe

2009-03-09 16:02:26

Well Duh I am not that stupid :( rofl I can make a nice mess at times :P

program Smither;
{.Include SRL\SRL\Misc\Smart.Scar}
{.Include SRL\SRL.Scar}
{.Include SRL\SRL\Reflection\Reflection.Scar}
{.include srl/srl/skill/smithing.scar}
function LoadPath: TPointArray;
begin
SetLength(Result, 2);

Result[0] := Point(3276, 3173);
Result[1] := Point(3275, 3186);
end;

function WalkToSmelter: boolean;
begin
Result := WalkPath(LoadPath);
end;

begin
SetupSRL;
WalkToSmelter;
end.

Frt

2009-03-09 19:29:49

function WalkPath(Tiles: TPointArray): Boolean;
var
I: Integer;
Path: TPointArray;
begin
Path := Tiles;
for i := 0 to High(Path) do
begin
if not WalkToTile(Path[i], 1, 0) then
WalkToTile(Path[i + 1], 1, 0);
end;
Wait(500 + Random(300));
end;

Add that function before the WalkToSmelter function.

Your script will look like:

program Smither;
{.Include SRL\SRL\Misc\Smart.Scar}
{.Include SRL\SRL.Scar}
{.Include SRL\SRL\Reflection\Reflection.Scar}
{.include srl/srl/skill/smithing.scar}

function LoadPath: TPointArray;
begin
SetLength(Result, 2);

Result[0] := Point(3276, 3173);
Result[1] := Point(3275, 3186);
end;

function WalkPath(Tiles: TPointArray): Boolean;
var
I: Integer;
Path: TPointArray;
begin
Path := Tiles;
for i := 0 to High(Path) do
begin
if not WalkToTile(Path[i], 1, 0) then
WalkToTile(Path[i + 1], 1, 0);
end;
Wait(500 + Random(300));
end;

function WalkToSmelter: boolean;
begin
Result := WalkPath(LoadPath);
end;

begin
SetupSRL;
WalkToSmelter;
end.

P1nky

2009-03-09 19:37:57

and, hopefully you have downloaded Reflection.

Nava2

2009-03-09 20:46:42

From: Frt
function WalkPath(Tiles: TPointArray): Boolean;
var
I: Integer;
Path: TPointArray;
begin
Path := Tiles;
for i := 0 to High(Path) do
begin
if not WalkToTile(Path[i], 1, 0) then
WalkToTile(Path[i + 1], 1, 0);
end;
Wait(500 + Random(300));
end;

Add that function before the WalkToSmelter function.

Your script will look like:

program Smither;
{.Include SRL\SRL\Misc\Smart.Scar}
{.Include SRL\SRL.Scar}
{.Include SRL\SRL\Reflection\Reflection.Scar}
{.include srl/srl/skill/smithing.scar}

function LoadPath: TPointArray;
begin
SetLength(Result, 2);

Result[0] := Point(3276, 3173);
Result[1] := Point(3275, 3186);
end;

function WalkPath(Tiles: TPointArray): Boolean;
var
I: Integer;
Path: TPointArray;
begin
Path := Tiles;
for i := 0 to High(Path) do
begin
if not WalkToTile(Path[i], 1, 0) then
WalkToTile(Path[i + 1], 1, 0);
end;
Wait(500 + Random(300));
end;

function WalkToSmelter: boolean;
begin
Result := WalkPath(LoadPath);
end;

begin
SetupSRL;
WalkToSmelter;
end.


Here is mine:
function FindMeOnPath(var Index: integer; Path: TPointArray; MaxDist: integer): boolean;

var
I, H, DistC, DistS, T : integer;
P : TPoint;

begin
Debug('FindMeOnPath', '');
T := GetTimeRunning;
H := High(Path);
P := GetMyPos;
DistS := Distance(P.x, P.y, Path[0].x, Path[0].y);
for I := 0 to H do
begin
DistC := Distance(P.x, P.y, Path[I].x, Path[I].y);
if DistC <= DistS then
begin
DistS := DistC;
Index := I;
end;
end;
Result := DistS <= MaxDist;
if not Result then Index := -1;
Debug('FindMeOnPath', 'Index = ' + IntToStr(Index) + ' Time: ' + IntToStr(GetTimeRunning - T) + ' ms');
end;

// Metagen
//Returns in a TPoint:
//x as: The tile the player is closest to
//y as: The last tile in the array that can be sequentially seen.
Function TileRange(TPA : TPointArray) : TPoint;

var
I, H : Integer;

begin
if not FindMeOnPath(result.x, TPA, 20) then
Exit;
H := high(TPA)
for i := result.x to H do
begin
if not TileOnMM(TPA[i]) then
begin
if i = Result.x then
begin
Debug('TileRange', 'Could Not Find The Path');
Exit;
end;
result.y := Max(i-1, Result.x);
Debug('TileRange', 'TileRange is: ' + inttostr(result.x) + ', ' + IntToStr(result.y));
exit;
end;
end;
Debug('TileRange', 'Can See All Remaining Tiles');
result.y := High(TPA);
Debug('TileRange', 'TileRange is: ' + inttostr(result.x) + ', ' + IntToStr(result.y));
end;

// Metagen
// Picks a good human-like next Tile in the array to walk to and returns
// the array index
Function GenNextTile(TPA : TPointArray) : Integer;

var
PathRange : TPoint;
Variance : Integer;

begin
PathRange := TileRange(TPA);
Variance := (PathRange.y - PathRange.x) / 4;
Result := PathRange.y - Variance - Random(Variance);
Debug('GenNextTile', 'Next Path Tile: ' + IntToStr(Result));
end;

// Metagen / Nava2
function WalkPath(Path: TPointArray) : Boolean;

var
I, H : Integer;
NextTile : Integer;

begin
if not R_LoggedIn then Exit;
Debug('WalkPath', 'Walking the Path.');
H := High(Path);
for I := 0 to H do
begin
if NextTile >= I then Continue;
NextTile := GenNextTile(Path);
if not WebWalk(Path[NextTile]) then
begin
SRL_Warn('WalkPath', 'Could not make it to Path[' + IntToStr(I) + ']', Warn_AllVersions);
Exit;
end;
WaitWhileMoving(Path[NextTile], 8, false);
end;
R_Flag;
Result := DistanceFrom(Path[H]) < 5;
end;

From: ~~Joker~~
and, hopefully you have downloaded Reflection.


He wouldn't have WalkToTile if he didn't.