Tniffoc
2008-10-12 00:20:05
This procedure displays the script's stats from SRL STATS.
{*******************************************************************************
procedure showScriptStats(yourScriptID: Integer; thingsToDisplay: array of string; displayDebug: Boolean);
BY: Tniffoc debugged by Mixster
DESCRIPTION: Prints the script's current stats to the debug box.
*******************************************************************************}
procedure showScriptStats(yourScriptID: Integer; thingsToDisplay: array of string);
var
scriptURL,page: string;
displayStats,newThingsToDisplay: array of string;
i: Integer;
begin
scriptURL := 'http://www.stats.srl-forums.com/index.php?action=' +
'view_script&id=' + IntToStr(yourScriptID);
setLength(displayStats, Length(thingsToDisplay));
setLength(newThingsToDisplay, Length(thingsToDisplay));
page:= GetPage(scriptURL);
if(page = '')then
srl_Warn('showScriptStats', 'Connection error when getting page.', 27);
if(Length(thingsToDisplay) = 0)then
srl_Warn('showScriptStats', 'Nothing was given to display.', 27);
if(yourScriptID < 0)then
srl_Warn('showScriptStats', 'Invalid script ID.', 27);
for i:=0 to High(thingsToDisplay) do
begin
newThingsToDisplay[i]:= thingsToDisplay[i] + ' ';
end;
for i:=0 to High(newThingsToDisplay) do
begin
displayStats[i] := Between(newThingsToDisplay[i] + ' : <strong>', '</strong>', page);
end;
for i:=0 to High(displayStats) do
begin
Writeln(thingsToDisplay[i] + ': ' + displayStats[i]);
end;
end;