SCAR Code:
// MY FIRST WORKING SCRIPT
// DESCRIPTION: Walks to the Grand Exchange from the Falador East Bank.
// Must have reflection
// Please tell me some ways that I could improve this script
// Thinking of adding something like this to another script
// that would walk to the G.E. after a specific amount
// of whatever is attained.
// ~Made By Carlover~
// Credit: Sumilion for showing me how to make
// it walk and for your path tool
//
//
// Made for SCAR Divi 3.15b SRL Revision 20 Reflection Revision 64
program GEWalker;
{.include SRL\SRL\misc\Smart.scar}
{.include SRL\SRL.scar}
{.include SRL\SRL\reflection\reflection.scar}
Procedure DeclarePlayers;
Begin
CurrentPlayer := 0;
HowManyPlayers := 1;
NumberOfPlayers( HowManyPlayers );
Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := '';
Players[0].Active:= True;
End;
{-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
Function WalkToTile2(TileX, TileY: Integer): Boolean;
By: Timer
Description: Walks to the tile using minimap.
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-}
Function WalkToTile2(TileX, TileY, Rx, Ry: Integer): Boolean;
Var
Tw: TPoint;
Begin
Tw := TileToMM(IntToPoint(Tilex, Tiley));
if (not (InCircle(Tw.x, Tw.y, MMCX, MMCY, 74))) then
begin
Writeln('Tile off minimap!');
Result := False;
Exit;
end;
Mouse(Tw.x, Tw.y, Rx, Rx, True);
Result := True;
end;
{-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
Function GetMyPosOnPath(Var aVar: Integer; Path: TPointArray): Boolean;
By: Timer
Description: Finds your character on a specified path. Results True If Sucsess.
aVar is the tile in array;
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-}
Function GetMyPosOnPath(Var aVar: Integer; Path: TPointArray): Boolean;
Var
aPath: TPointArray;
I: Integer;
PosG: TPoint;
Begin
PosG := GetMyPos;
aPath := Path;
SortTPAFrom(aPath, IntToPoint(PosG.x, PosG.y));
If (Not (TileOnMM(IntToPoint(aPath[0].X, aPath[0].Y)))) Then
Exit;
For I := 0 To High(Path) Do
If ((Path[i].X = aPath[0].X) And (Path[i].Y = aPath[0].Y)) Then
Begin
aVar := I;
Result := True;
Exit;
End;
End;
{-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
Function PathWalk(Path: TPointArray): Boolean;
By: Timer
Description: Walks The Path, If Lost, Finds Character, And Reverts To A
R_FFlag(0); Instead Of R_FFlag(8); - Randomizes Tiles.
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-}
Function PathWalk(Path: TPointArray): Boolean;
Var
I, I2: Integer;
Begin
For I := 0 To High(Path) Do
If (Not (WalkToTile2(Path[i].X + (Random(3) - Random(3)), Path[i].Y + (Random(3) - Random(3)), (Random(3) - Random(3)), (Random(3) - Random(3))))) Then
Begin
Result := False;
Break;
End Else
Begin
R_FFlag(8);
FindNormalRandoms;
Result := True;
End;
If (Result) Then
Exit;
If (GetMyPosOnPath(I2, Path)) Then
Begin
For I := I2 To High(Path) Do
If (Not (WalkToTile2(Path[i].X + (Random(3) - Random(3)), Path[i].Y + (Random(3) - Random(3)), 3, 3))) Then
Begin
Result := False;
Exit;
End Else
Begin
R_FFlag(0);
FindNormalRandoms;
Result := True;
End;
End;
End;
function LoadPath: TPointArray;
begin
SetLength(Result, 42);
Result[0] := Point(3012, 3354);
Result[1] := Point(3008, 3362);
Result[2] := Point(3000, 3362);
Result[3] := Point(2995, 3367);
Result[4] := Point(2987, 3371);
Result[5] := Point(2980, 3377);
Result[6] := Point(2971, 3378);
Result[7] := Point(2967, 3384);
Result[8] := Point(2967, 3394);
Result[9] := Point(2965, 3402);
Result[10] := Point(2969, 3409);
Result[11] := Point(2975, 3414);
Result[12] := Point(2984, 3419);
Result[13] := Point(2988, 3426);
Result[14] := Point(2997, 3432);
Result[15] := Point(3008, 3431);
Result[16] := Point(3016, 3425);
Result[17] := Point(3022, 3422);
Result[18] := Point(3027, 3425);
Result[19] := Point(3036, 3425);
Result[20] := Point(3041, 3415);
Result[21] := Point(3051, 3414);
Result[22] := Point(3057, 3415);
Result[23] := Point(3068, 3416);
Result[24] := Point(3079, 3416);
Result[25] := Point(3087, 3421);
Result[26] := Point(3098, 3420);
Result[27] := Point(3112, 3420);
Result[28] := Point(3119, 3417);
Result[29] := Point(3126, 3414);
Result[30] := Point(3137, 3416);
Result[31] := Point(3147, 3416);
Result[32] := Point(3158, 3418);
Result[33] := Point(3166, 3426);
Result[34] := Point(3176, 3428);
Result[35] := Point(3175, 3442);
Result[36] := Point(3171, 3453);
Result[37] := Point(3166, 3460);
Result[38] := Point(3164, 3467);
Result[39] := Point(3164, 3475);
Result[40] := Point(3164, 3481);
Result[41] := Point(3165, 3487);
end;
Procedure SetupSMART;
Begin
SmartSetupEx(136, True, True, False);
SetTargetDC(SmartGetDC);
If Not (LoggedIn) Then
While Not (SmartGetColor(360, 172) = 13158) Do
Wait(100);
End;
begin
SetupSRL;
SetupSMART;
DeclarePlayers;
LoginPlayer;
Wait(2000 + Random(500));
PathWalk(LoadPath);
end.