SRL Archive - SRL Archives

showScriptStats


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;

Seroko

2008-10-12 00:26:27

I like :o +rep (edit, when i can) and should def be in the core

sirlaughsalot

2008-10-12 00:45:47

Looks awesome, lol trying to ask my how to do this :P ill learn from this haha

SubiN

2008-10-12 03:47:44

i liek it as well

Tniffoc

2008-10-12 07:42:54

Thanks guys. I was thinking of adding where it would display the stats in the debug image too. Should I add it?

Naum

2008-10-12 07:53:14

Yeah, That would be easy:

DisplayDebugImageWindow(30, 40);
FastDraw //letters

Tniffoc

2008-10-12 17:11:06

From: NaumanAkhlaQ
Yeah, That would be easy:

DisplayDebugImageWindow(30, 40);
FastDraw //letters


Hmmm I'm gonna have to read Yakman's Canvas tutorial again before I start that part. I will get there though… (I think.)