Bonfield
2009-06-02 17:36:27
im trying to help senrath with his telegrabber script with the walking, i made a script and was wondering why when the tile is not found the writeln doesnt work, that isnt the actual reason for this thread, i was wondering how i can start the account anywhere on the path and the script will be able to walk th where it needs ie log in halfway to the temple and pickup from where it left off, atm if it gets lost it stays lost
anyways here is what i have so far
anyways here is what i have so far
program WineTelegrabber;
{.include SRL\SRL\Misc\Smart.scar}
{.include SRL\SRL.scar}
{.include SRL\SRL\Reflection\Reflection.scar}
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := 'name'; //Character Name
Players[0].Pass := 'pass'; //Character Pass
Players[0].Nick := 'nick'; //Nickname 3 - 4 Letter's of char name
Players[0].Integers[0] := 1; //0: to temple 1: to bank
Players[0].Active := True;
end;
function LoadPaths: TPointArray;
begin
case Random(3) of
0: Result := [Point(2945, 3371), Point(2951, 3377), Point(2956, 3381),
Point(2962, 3383), Point(2965, 3390), Point(2965, 3397),
Point(2964, 3404), Point(2961, 3411), Point(2957, 3417),
Point(2952, 3421), Point(2948, 3427), Point(2948, 3434),
Point(2947, 3442), Point(2947, 3450), Point(2944, 3456),
Point(2944, 3465), Point(2944, 3475), Point(2942, 3485),
Point(2943, 3492), Point(2941, 3500), Point(2941, 3507),
Point(2941, 3514), Point(2935, 3516)];
1: Result := [Point(2946, 3371), Point(2953, 3379), Point(2962, 3382),
Point(2966, 3391), Point(2966, 3404), Point(2966, 3411),
Point(2958, 3417), Point(2950, 3423), Point(2948, 3432),
Point(2948, 3440), Point(2947, 3449), Point(2944, 3460),
Point(2944, 3472), Point(2943, 3485), Point(2943, 3493),
Point(2941, 3502), Point(2941, 3512), Point(2935, 3516)];
2: Result := [Point(2944, 3371), Point(2949, 3375), Point(2961, 3380),
Point(2966, 3389), Point(2966, 3403), Point(2965, 3412),
Point(2954, 3419), Point(2949, 3425), Point(2947, 3433),
Point(2947, 3440), Point(2945, 3452), Point(2944, 3464),
Point(2943, 3476), Point(2943, 3487), Point(2942, 3496),
Point(2942, 3505), Point(2940, 3511), Point(2935, 3516)];
end;
end;
function WalkToPathTile(Tile: TPoint; Randomness: Integer): boolean;
var
wTile: TPoint;
t: Integer;
begin
if not LoggedIn then Exit;
Tile.X := RandomRange(Tile.X - Randomness, Tile.X + Randomness);
Tile.Y := RandomRange(Tile.Y - Randomness, Tile.Y + Randomness);
wTile := TileToMM(Tile);
while not TileOnMM(Tile) do
Wait(100 + Random(200));
if not TileOnMM(Tile) then
begin
Result := False;
Writeln('Tile not on MM!');
Exit;
end;
Result := True;
Mouse(wTile.x, wTile.y, 0, 0, true);
t := getsystemtime;
Result := (GetSystemTime - t) < 60000;
end;
function WalkPath(Path: TPointArray; FlagDist: Integer; Reverse:Boolean): boolean;
var
i: integer;
begin
if not LoggedIn then Exit;
if Reverse then InvertTPA(Path);
if not WalkToPathTile(Path[i], 2) then
Exit;
for i := 0 to High(Path) do
begin
if i < High(Path) then
begin
while not TileOnMM(Point(Path[i + 1].x, Path[i + 1].y)) do
Wait(100 + Random(100));
Wait(200 + Random(700));
WalkToPathTile(Path[i + 1], 1);
end
else
FFlag(FlagDist);
Wait(400 + Random(200));
end;
result := true;
end;
function ToTemple: boolean;
begin
if not LoggedIn then Exit;
Result := WalkPath(LoadPaths, 10, False);
if Result then
Writeln('Walked to Temple!');
end;
function ToBank: boolean;
begin
if not LoggedIn then Exit;
Result := WalkPath(LoadPaths, 10, True);
if Result then
Writeln('Walked to Bank!');
end;
procedure SetupSmart;
begin
SmartSetupEx(81, False, True, false);
wait(5000);
SetTargetDC(SmartGetDC);
repeat
wait(100);
until (SmartGetColor(253, 233) <> 1118604);
end;
begin
SetupSmart;
SetupSRL;
DeclarePlayers;
LoginPlayer;
repeat
ToTemple;
//ToBank;
until true;
end.