SRL Archive - Outdated Tutorials

[#34/35] SRLProgressReport & SRLPlayerReport


Sir R. M8gic1an

2009-06-12 17:27:22

This is one of the most recently added features to SRL. After looking around at progress reports which were not so presentable, and spent a lot of time perfecting my own, I thought these functions would be useful. And so, i bring to you Reports.scar.


SRLProgressReport example
[php]
[================================]
[ RM Proggie 1.00 ]
[ by Rasta Magician ]
[================================]
[ TimeRunning : 67h, 58m, 34s ]
[ Total Fish : 56788 ]
[ Active Players : 7 ]
[================================]
[ RM Proggie 1.00 ]
[================================]
[/php]

SRLPlayerReport - short example
[php]
[=======================================================================================]
[ Nick | Active | Worked | Banked | Loc | fishes | Responses | FishType ]
[=======================================================================================]
[ Rasta Magician | True | 20:10:56 | 43 | lumby | 26 | 162 | trout ]
[ Wizzup? | False | 25:25:53 | 83 | draynor | 99 | 190 | shrimps ]
[ WT-Fakawi | True | 11:37:37 | 55 | draynor | 68 | 122 | shrimps ]
[ Hobbit | False | 24:17:35 | 31 | lumby | 14 | 198 | trout ]
[ Nielsie95 | True | 21:04:37 | 24 | draynor | 2 | 192 | shrimps ]
[ ————————————————————————————- ]
[ ZephyrsFury | False | 06:12:55 | 0 | draynor | 48 | 168 | shrimps ]
[ Boreas | True | 18:52:54 | 77 | lumby | 94 | 144 | trout ]
[ Sumilion | False | 15:39:55 | 70 | draynor | 82 | 137 | shrimps ]
[ The Claw | False | 17:44:36 | 24 | lumby | 9 | 153 | trout ]
[ Tarajunky | False | 14:31:38 | 18 | draynor | 97 | 146 | shrimps ]
[ ————————————————————————————- ]
[ Ray | False | 27:11:36 | 94 | lumby | 43 | 122 | trout ]
[=======================================================================================]
[/php]

SRLPlayerReport - long example
[php]
[=========================]
[ Rasta Magician ]
[ Active : True ]
[ Worked : 20h 10m 56s ]
[ Banked : 43 ]
[ Location : lumby ]
[ fishes : 26 ]
[ Responses : 162 ]
[ FishType : trout ]
[=========================]
[ Wizzup? ]
[ Active : False ]
[ Worked : 25h 25m 53s ]
[ Banked : 83 ]
[ Location : draynor ]
[ fishes : 99 ]
[ Responses : 190 ]
[ FishType : shrimps ]
[=========================]
[/php]

Now, how to use them? -hang on to your seats, the parameters might sound complicated, but they are actually extremely simple.

First of all, you need to include Reports.scar

{.include srl/srl/misc/Reports.scar}


And now, onto the functions :)


Function SRLProgressReport(
ResultType:integer; ScriptName, ScriptAuthor, ScriptVersion: String;
VarNames: TStringArray;
VarValues: TVariantArray
): Variant;

ResultType
  • ResultDebugBox - prints proggie to Debug Box
  • ResultReportBox - prints proggie to Report Box
  • ResultString - returns a string as result (can be used for saving to file, etc)
ScriptName, ScriptAuthor, ScriptVersion: obvious enough

VarNames, VarValues:
[INDENT]VarNames stores the name of the variables you wish to use
VarValues stores the value of the variables
VarName: 'Time Running' ; VarValue: GetTimeRunning
They are both arrays, so you can use as many variables as you wish, and the VarNames have to be in the same order as the VarValues.
e.g. ['Time Running', 'Total Logs', 'Average Log Time'], [GetTimeRunning, TotalLogs, (TotalLogs/TimeRunning)]

VarValues is a TVariantArray, so you can use booleans, strings, integers and extendeds as you wish, no need to worry about making it all strings.[/INDENT]

This is how I called SRLProgressReport for the example:

SRLProgressReport(
ResultDebugBox, 'RM Proggie', 'Rasta Magician', '1.00',
['TimeRunning', 'Total Fish', 'Active Players'],
['67h, 58m, 34s', 56788, 7 ]
);


And now onto SRLPlayerReport; The parameters are very similar, although different.

To use SRLPlayerReport you will have to familiarize yourself with the Player Array, if you do not know it, please have a look at it here.


function SRLPlayerReport(
ResultType, SkillLevel: Integer; LongReport:boolean;
DefaultSettings:TBooleanArray;
VarNames: TStringArray;
PlayerBooleans, PlayerIntegers, PlayerStrings, PlayerExtendeds: TIntegerArray
): Variant;
ResultType
  • ResultDebugBox - prints proggie to Debug Box
  • ResultReportBox - prints proggie to Report Box
  • ResultString - returns a string as result (can be used for saving to file, etc)

SkillLevel: The skill you are leveling, you can check it's number in Players.scar; you can leave it as 0 if you do not intend to put it in the player report.

LongReport: True / False, you can check the above examples to know which one fits you best.

DefaultSettings: An Array of 6 booleans; this is the order:
[INDENT][Players.Worked, Players.Banked, Players.Level, Players.location, Players.Skill, Players.Random]
e.g. [True, True, False, True, False, False][/INDENT]

VarNames: Just like in SRLProgressReport, it has to follow the order of the variables. Booleans, Integers, Strings, Extendeds and it has to follow the order of each of those.

PlayerBooleans, PlayerIntegers, PlayerStrings, PlayerExtendeds:
[INDENT]These reffer to the index in the player array. For example, if you wished to use Players[].Booleans[0] and Players[].Booleans[5] your booleans' array would look like this: [0, 5] ; the same applies to the other.
e.g. [1], [5, 7], [3], []
This would use Players[].Booleans[1] , Players[].Integers[5], Players[].Integers[7] and Players.Strings[3][/INDENT]

Here is how i used it for the example:

SRLPlayerReport(
ResultDebugBox, 0, False,
[True, True, False, True, False, False],
['fishes', 'Responses', 'FishType'],
[], [0, 1], [0], []
);


As usual, for those who use the OpenSVN, this feature is already available :) for the rest, it should come in rev #34, whenever that comes out :p

Hope you enjoy these functions!

SRL Dev Team

Laur€ns

2009-06-12 17:30:12

It's september already? :p

Sir R. M8gic1an

2009-06-12 17:34:32

From: Laur€ns
It's september already? :p


I had a lil time on my hands :p

~RM

cycrosism

2009-06-12 17:37:07

It's gonna make all the new people lazy when it comes to writing progress reports…

Sir R. M8gic1an

2009-06-12 17:38:23

From: cycrosism
It's gonna make all the new people lazy when it comes to writing progress reports…


Those who were already lazy will still be lazy :p but they'll be lazy and have progress reports ;)

~RM

osmm

2009-06-12 17:41:43

i dont get what is so special about this >.< I'm lost.

MasterKill

2009-06-12 17:44:06

From: Rasta Magician
Those who were already lazy will still be lazy :p but they'll be lazy and have progress reports ;)

~RM


Yes I was going to say "this is for lazy people right?" :p

looks fun though ;)

Naum

2009-06-12 19:29:32

Looks pretty good :)

Blumblebee

2009-06-12 19:53:24

i like making my own progress reports, but im sure theres tons of people who just detest it haha, so good job, looks very nice :)

Da 0wner

2009-06-12 20:43:01

From: osmm
i dont get what is so special about this >.< I'm lost.


Perfectly formatted ftw?

realrocker00

2009-06-12 20:54:10

LOOK VERY GOOD! (it is so good that you get a smiley face! :) )

Harry

2009-06-12 22:05:31

Cool story bro.

Nice work.

Shuttleu

2009-06-12 22:07:36

nice
i like it
well done RM
cookie for you
:)
~shut

ShowerThoughts

2009-06-12 22:20:28

Nice, people who can make it their self now look lazy ):

NCDS

2009-06-12 22:43:12

Nice addition RM

@Hermen Just make yours look different?

EvilChicken!

2009-06-17 04:56:59

Nice job, RM!

This is a very useful addition! :)

mormonman

2009-06-17 05:20:03

im adding this to my script rm <3…(i think its time to change my avvy)

WT-Fakawi

2009-06-20 13:00:08

Great work! Much better now…

Coh3n

2009-06-21 02:23:00

I like it. :) It's better for those who don't like writing their own and make them as simple as possible. Now they have no excuse of why it's not presentable. :)

Very nice!

Sabzi

2009-07-14 00:42:13

program test;
{.include SRL/SRL.scar}
{.include SRL/SRL/Misc/Reports.scar}

begin
ClearDebug;
WriteLn('Short: ');
SRLPlayerReport(
ResultDebugBox, 0, False,
[True, True, False, True, False, False],
['fishes', 'Responses', 'FishType'],
[], [0, 1], [0], []
);
WriteLn(#10 + 'Long: ');
SRLPlayerReport(
ResultDebugBox, 0, True,
[True, True, False, True, False, False],
['fishes', 'Responses', 'FishType'],
[], [0, 1], [0], []
);
end.

What's wrong? At me? Or not at me?

Because I got this:
Short: 
[=======================================================================]
[ Nick | Active | Worked | Banked | Loc | fishes | Responses | FishType ]
[=======================================================================]
[=======================================================================]

Long:
[==]
Successfully executed

Sir R. M8gic1an

2009-07-14 04:28:13

From: Sabzi
program test;
{.include SRL/SRL.scar}
{.include SRL/SRL/Misc/Reports.scar}

begin
ClearDebug;
WriteLn('Short: ');
SRLPlayerReport(
ResultDebugBox, 0, False,
[True, True, False, True, False, False],
['fishes', 'Responses', 'FishType'],
[], [0, 1], [0], []
);
WriteLn(#10 + 'Long: ');
SRLPlayerReport(
ResultDebugBox, 0, True,
[True, True, False, True, False, False],
['fishes', 'Responses', 'FishType'],
[], [0, 1], [0], []
);
end.

What's wrong? At me? Or not at me?

Because I got this:
Short: 
[=======================================================================]
[ Nick | Active | Worked | Banked | Loc | fishes | Responses | FishType ]
[=======================================================================]
[=======================================================================]

Long:
[==]
Successfully executed


Have you set up your players and called DeclarePlayers before trying to use the proggy functions?

~RM

mormonman

2009-07-14 04:40:53

Hey RM, these are so sexy that I came the first time I put them in my script :S

Sabzi

2009-07-14 11:11:31

It was just a test, I did not expect any name, and number. But the long one doesn't want to work in my script too. And there I call everything I should.
So my problem is that the long one is not showing anything. Or should I just use the short one? I like the long better :(

mormonman

2009-07-15 00:26:04

From: Sabzi
It was just a test, I did not expect any name, and number. But the long one doesn't want to work in my script too. And there I call everything I should.
So my problem is that the long one is not showing anything. Or should I just use the short one? I like the long better :(


for the long one to show something you have to have player details.