Yea, I know. Write now I'm just trying to get it written out and working then I'll go back and fix the little things like that.
EDIT: The function using cases works but after changing another small error it compiles then I get this.
SCAR Code:
Successfully compiled (4890 ms)
Line 80: [Hint] (18048:10): Variable 'Result' never used in script E:\Program Files\SCAR 3.15\Scripts\MyBurner.scar
SRL Compiled in 296 msec
[Runtime Error] : Out Of Range in line 84 in script E:\Program Files\SCAR 3.15\Scripts\MyBurner.scar
Line 84 is
SCAR Code:
if not WalkToPathTile(Path[i], 2)then Exit;
which is in
SCAR Code:
{*******************************************************************************
function WalkPath(Path: TPointArray): boolean;
By: Drags111
Description: Walks path (Path) human like. Usage: WalkPath(LoadPath1); (example)
*******************************************************************************}
function WalkPath(Path: TPointArray; FlagDist: Integer): boolean;
var
i: integer;
begin
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;
end;
Normally OutOfRange is do to not setting up declare players right but I don't see anything wrong with it (In mine it has user and pass). And the WalkPath procedure I got from the D-Include (so I wouldn't have to make people download D-Include when I eventually release it).
Also, here is the full script after edits
SCAR Code:
program New;
{.include srl/srl/misc/smart.scar}
{.include srl/srl.scar}
{.include srl/srl/skill/firemaking.scar}
{.include srl/srl/reflection/reflection.scar}
var
StartNumber:integer;
var
Bank, Start1, Start2: TPointArray;
Const
SmartWorld = 66;
{if openbankglass('db',true,true) then
if pinscreen then
inpin('')
if bankscreen then
writeln('Opened Bank')
else writeln('Coulnd''t open the bank')}
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := ''; //Runescape Username.
Players[0].Pass := ''; //Password for Runescape Username.
Players[0].Nick := 'ike'; //3-4 consecutive letters from Username.
Players[0].Active := True; //Player is active.
end;
Procedure LoadPaths;
begin
SetLength(Bank, 2);
Bank[0] := (Point(2598, 3097));
Bank[1] := (Point(2613, 3094));
SetLength(Start1, 1);
Start1[0] := (Point(2608, 3098));
SetLength(Start2, 1);
Start2[0] := (Point(2607, 3097));
end;
//Editted by Drags111 to work for WalkPath;
{*******************************************************************************
function WalkToPathTile(Tile: TPoint; Randomness: Integer): Boolean;
By: Wizzup and TheGuyWhoGotOn / Drags111
Description: Took any Flag procedures out to fit my WalkPath needs.
*******************************************************************************}
function WalkToPathTile(Tile: TPoint; Randomness: Integer): Boolean;
var
wTile: TPoint;
t: Integer;
begin
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): boolean;
By: Drags111
Description: Walks path (Path) human like. Usage: WalkPath(LoadPath1); (example)
*******************************************************************************}
function WalkPath(Path: TPointArray; FlagDist: Integer): boolean;
var
i: integer;
begin
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;
end;
function WalkToStart: Boolean;
begin
case StartNumber of
1: begin
if WalkPath(Start1, 8) then
begin
Result := True;
WriteLn('Walked to Start Position One.');
Inc(StartNumber);
end else
WriteLn('Couldn''t walk to Start Position One.');
end;
2: begin
if WalkPath(Start2, 8) then
begin
Result := True;
WriteLn('Walked to Start Position Two.');
StartNumber := StartNumber - 1;
end else
WriteLn('Couldn''t walk to Start Position Two.');
end;
end;
end;
Function WalkToBank: Boolean;
begin
If WalkPath(Bank,8) Then
Result := True
else Begin
Writeln('Couldnt Walk To Bank')
Nextplayer(False);
end;
end;
procedure FireWait; //By Dankness, Edited by me
var
i: Integer;
s: string;
begin
LastChatter(s);
if (Pos('att', s) > 0) or (Pos('emp', s) > 0) or (Pos('lig', s) > 0) then
begin
repeat
Wait(100 + Random(100));
FindTalk;
if (not (LoggedIn)) then
Exit;
LastChatter(s);
Inc(i);
until (Pos('cat', s) > 0) or (Pos('and', s) > 0) or (Pos('ire', s) > 0) or (i > 35);
end else wait(1350+Random(100));
end;
Procedure BurnLogs;
var i,x,y:integer;
begin
for i := 2 to 28 do
if(ExistsItem(i)) then
begin
mouseitem(1,true);
wait(50+random(100));
mmouseitem(i);
wait(50+random(100));
if (IsUpText('og')) then
begin
GetMousePos(x, y);
mouse(x,y,0,0,true);
end else mouseitem(i + 1, true);
wait(100+random(100));
FireWait;
FindNormalRandoms;
end;
for i := 2 to 28 do
if(ExistsItem(i)) then
begin
mouseitem(1,true);
wait(50+random(100));
mmouseitem(i);
if (IsUpText('og')) then
begin
GetMousePos(x, y);
mouse(x,y,0,0,true);
end else mouseitem(i + 1, true);
wait(50+random(200));
FireWait;
FindNormalRandoms;
end;
end;
Procedure SetupSMART;
begin
SmartSetupEx(SmartWorld, False, True, False);
SetTargetDC(SmartGetDC);
end;
begin
setupsrl;
setupfiremaking;
declareplayers;
StartNumber := 1
activateclient;
wait(500+random(500));
{burnlogs;}
If WalkToBank then
Writeln('Walked to Bank');
end.