Since I want to make a large script I need a procedure that will work globally. This function is supposed to see if your character is around the walking path to the selected area. It also has a banking parameter to invert the path. The problem is that even after it checks the minimap it never actually completes what it's supposed to do.
Simba Code:
function LoadPath(Which: string): TPointArray;
begin
case (Which) of
'lumby swamps','noob mine':
begin
SetLength(Result, 23);
Result[0] := Point(3973, 2572);
Result[1] := Point(3978, 2576);
Result[2] := Point(3977, 2581);
Result[3] := Point(3984, 2581);
Result[4] := Point(3990, 2581);
Result[5] := Point(3995, 2581);
Result[6] := Point(3997, 2577);
Result[7] := Point(3998, 2572);
Result[8] := Point(3999, 2567);
Result[9] := Point(4002, 2563);
Result[10] := Point(4004, 2558);
Result[11] := Point(4007, 2554);
Result[12] := Point(4005, 2548);
Result[13] := Point(4005, 2544);
Result[14] := Point(4002, 2540);
Result[15] := Point(4001, 2536);
Result[16] := Point(3999, 2531);
Result[17] := Point(3998, 2525);
Result[18] := Point(3996, 2521);
Result[19] := Point(3994, 2517);
Result[20] := Point(3993, 2513);
Result[21] := Point(3989, 2512);
Result[22] := Point(3989, 2509);
end;
end;
end;
procedure InvertTpPath(var Path: TPointArray);
var
Temp: TPointArray;
i: integer;
begin
for i := High(Path) downto 0 do
begin
SetLength(Temp, Length(Temp)+1);
Temp[High(Temp)] := Path[i];
end;
Path := Temp;
end;
function DiscoverArea(Where: String; Bank: Boolean): Boolean;
var
i, Location: Integer;
Path: TPointArray;
begin
Writeln('Testing..');
Path := LoadPath(Where);
if Length(Path) = 0 then
begin
Writeln('INVALID PATH!');
TerminateScript;
end;
for i:= 0 to High(Path) do
begin
if (TileOnMM(Tile(Path[i].x, Path[i].y))) then
Location := i;
Writeln(IntToStr(i));
end;
if (Bank) then
InvertTpPath(Path);
for i:= (Location) to High(Path) do
begin
Result := WalkToTile(Tile(Path[i].x, Path[i].y), 5, 2+random(5));
if (Result) then
Writeln('Successfully Walked to tile [ '+ IntToStr(Path[i].x) + ', '
+ IntToStr(Path[i].y) + ' ]');
end;
end;
*Most of the begins are just to debug. *
It goes through each tile but even though the player is on the path it does not do anything. Location is always 0. 
It returns this:
Progress Report:
Testing..
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
0//location variable