SRL Archive - Help and Support

Help Plawkz.


TViYH

2008-11-08 12:21:06

Script:

program New;
{.include SRL\SRL.scar}

const
NumOfPlayers = 1; // Number of Players
FirstPlayer = 0;

var
i, z: Integer;
SkillsToGet: TStringArray;

procedure DeclarePlayers;
begin
CurrentPlayer := FirstPlayer;
NumberOfPlayers(NumOfPlayers);

SkillsToGet := ['attack', 'fishing'];

Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := '';
Players[0].Active := True;

end;

procedure GetLevels;
begin
if not LoggedIn then Exit;
ClearDebug;
FindNormalRandoms;
try
for i := 0 to High(SkillsToGet) do
begin
Players[CurrentPlayer].Integers[i] := GetSkillLevel(SkillsToGet[i]);
FindNormalRandoms;
end;
except
WriteLn('Error finding skill levels..');
end;
end;

procedure WriteLevels;
var
m: Integer;
begin
WriteLn('TViYH''s Army Stats Grabber');
for m := 0 to High(SkillsToGet) do
begin
for z := 0 to NumOfPlayers-1 do
begin
WriteLn(Players[z].Name ': ' + SkillsToGet[m] + ': ' + IntToStr(Players[z].Integers[m])); //Error Line
end;
end;
end;

procedure LoopPlayers;
begin
LoginPlayer;
repeat
FindNormalRandoms;
GetLevels;
NextPlayer(False);
until(AllPlayersInActive);
WriteLevels;
end;

begin
SetupSRL;
DeclarePlayers;
LoopPlayers;
end.

Used to grab stats of army members.
Tell me what needs improved/fixed.

I also keep getting this error:
Line 51: [Error] (16273:25): comma (',') expected in script
The line of error is expressed in the script above.

Thanks!

Method

2008-11-08 13:05:25

You need a + right after Players[z].Name on that line to fix that error.

TViYH

2008-11-08 13:25:03

Ok. Thanks for the help~

Nava2

2008-11-08 18:59:12

Dude, why not use this:

function HSGet(C : ChatMsg; Username, Skill: string; Options : TStringArray) : TStringArray;

var
I, II, III, L : Integer;
S : String;
arrS : TStringArray;
arrarrS : Array of TStringArray;

begin
try
S := GetPage('http://hiscore.runescape.com/index_lite.ws?player=' + Replace(UserName, ' ', '_'))
except
Result := ['N/A', 'N/A', 'N/A']
Exit;
end;
arrS := Explode(#10, S);

SetArrayLength(arrarrS, 29);
for I := 0 to 28 do
arrarrS[I] := Explode(',', ArrS[I]);
case LowerCase(Skill) of
'overall' : I := 0;
'attack' : I := 1;
'defence' : I := 2;
'strength' : I := 3;
'hitpoints' : I := 4;
'ranged' : I := 5;
'prayer' : I := 6;
'magic' : I := 7;
'cooking' : I := 8;
'woodcutting' : I := 9;
'fletching' : I := 10;
'fishing' : I := 11;
'firemaking' : I := 12;
'crafting' : I := 13;
'smithing' : I := 14;
'mining' : I := 15;
'herblore' : I := 16;
'agility' : I := 17;
'thieving' : I := 18;
'slayer' : I := 19;
'farming' : I := 20;
'runecraft' : I := 21;
'hunter' : I := 22;
'construction': I := 23;
'summoning' : I := 24;

'duel tournament' : I := 25;
'bounty hunters' : I := 26;
'bounty hunters rougue' : I := 27;
'fist of guthix' : I := 28;
else
begin
Notice(C.Nick, 'Invalid Skill inputted.');
Exit;
end;
end;

for III := 0 to High(Options) do
begin
case LowerCase(Options[III]) of
'rank' : II := 0;
'level', 'lvl', 'score' : II := 1;
'xp' : II := 2;
else II := -1;
end;
if II <> -1 then
begin
L := Length(Result);
SetArrayLength(Result, L + 1);
Result[L] := arrarrS[I][II];
if Result[L] = '-1' then
Result[L] := 'N/A';
end;
end;
end;

This will return the stats you put in the options in the order you put them in. In a TStringArray! :)

It uses the RS HighScores.

TViYH

2008-11-08 19:04:28

Because what if your army members aren't on the highscores?

Daniel

2008-11-08 22:07:19

BTW, you could've made Z a local variable and this:
procedure WriteLevels;
var
m: Integer;
begin
WriteLn('TViYH''s Army Stats Grabber');
for m := 0 to High(SkillsToGet) do
begin
for z := 0 to NumOfPlayers-1 do
begin
WriteLn(Players[z].Name ': ' + SkillsToGet[m] + ': ' + IntToStr(Players[z].Integers[m])); //Error Line
end;
end;
end;
Could be shortened to this:
procedure WriteLevels;
var
m, z: Integer;
begin
WriteLn('TViYH''s Army Stats Grabber');
for m := 0 to High(SkillsToGet) do
for z := 0 to NumOfPlayers-1 do
WriteLn(Players[z].Name ': ' + SkillsToGet[m] + ': ' + IntToStr(Players[z].Integers[m]));
end;

Naum

2008-11-09 06:23:38

procedure GetAllLevels;

In SRL :)