this along with the progress report took me from 5 - 12 pm... but it is done 
Also take the time to check out the Progress Report!
Horizontal / short Player Report
PHP Code:
[ ===================================================================================== ]
[ Nick | Active | Worked | Banked | Loc | fishes | Responses | FishType ]
[ ===================================================================================== ]
[ Rasta Magician | False | 17:01:12 | 39 | draynor | 80 | 132 | shrimps ]
[ RM | False | 11:40:50 | 57 | karam | 6 | 147 | lobby ]
[ RMagician | False | 01:03:22 | 99 | lumby | 49 | 128 | trout ]
[ ===================================================================================== ]
vertical / long player report
PHP Code:
[ =================== ]
[ Rasta Magician ]
[ Active: False ]
[ Worked: 17h 01m 12s ]
[ Banked: 39 ]
[ Location: draynor ]
[ fishes: 80 ]
[ Responses: 132 ]
[ FishType: shrimps ]
[ =================== ]
[ RM ]
[ Active: False ]
[ Worked: 11h 40m 50s ]
[ Banked: 57 ]
[ Location: karam ]
[ fishes: 6 ]
[ Responses: 147 ]
[ FishType: lobby ]
[ =================== ]
[ RMagician ]
[ Active: False ]
[ Worked: 01h 03m 22s ]
[ Banked: 99 ]
[ Location: lumby ]
[ fishes: 49 ]
[ Responses: 128 ]
[ FishType: trout ]
[ =================== ]
The Function!
SCAR Code:
{
SkillLevel => check Players.scar for the index of each level
e.g. for fishing = 17 ; 0 for none
Default settings: [Players.Worked, Players.Banked, Players.Level, Players.location, Players.Skill, Players.Random]
e.g. [True, True, false, true, false, false]
VarNames is a TStringArray, and the order has to be the one you'll use in the TIntegerArrays
e.g. ['bool1', 'bool2', 'int1', 'string1', 'string2', 'extended1' ]
e.g. ['safe', 'ready', 'fishes', 'EquipName', 'FishType', 'AverageTime/Fish' ]
PlayerBooleans: the index of the booleans you wish to show
e.g. show Players.Boolean[0] and Players.Booleans[3]
==> [0, 3]
Same applies for similarly name TIntegerArrays
}
function SRLPlayerReport(
ResultType, SkillLevel: Integer; LongReport:boolean;
DefaultSettings:TBooleanArray;
VarNames: TStringArray; PlayerBooleans, PlayerIntegers, PlayerStrings, PlayerExtendeds: TIntegerArray
): Variant;
var
TSA : TStringArray;
s : string;
i, i2, i3, L, PN, c : integer;
T2DVA : Array of TVariantArray;
begin
if Length(DefaultSettings) <> 6 then
begin
SRL_Warn('SRLPlayerReport', 'DefaultSettings must be exactly 6 settings!', warn_AllVersions);
SetLength(DefaultSettings, 6);
end;
L := Length(PlayerBooleans) + Length(PlayerIntegers) + Length(PlayerStrings) + Length(PlayerExtendeds);
if length(VarNames) <> L then
begin
SRL_Warn('SRLPlayerReport', 'VarNames and VarValues must be the same length', warn_AllVersions);
exit;
end;
if LongReport then
begin
L := 3;
for i:= 0 to high(DefaultSettings) do
if DefaultSettings[i] then inc(L);
L := L + Length(VarNames);
SetLength(TSA, L*HowManyPlayers+1);
i := 0;
for PN := 0 to (HowManyPlayers - 1) do
begin
TSA[i] := replicate('=', 16);
with Players[PN] do
begin
TSA[i+1] := Nick;
TSA[i+2] := 'Active: ' + BoolToStr(Active);
end;
i := i + 3;
if DefaultSettings[0] then
begin
TSA[i] := 'Worked: '+MSToTime(Players[PN].Worked, Time_Short);
inc(i);
end;
for i2 := 1 to High(DefaultSettings) do
if DefaultSettings[i2] then
begin
case i2 of
1: TSA[i] := 'Banked: '+ IntToStr(Players[PN].Banked);
2: TSA[i] := 'Level: '+ IntToStr(Players[PN].Level[SkillLevel]);
3: TSA[i] := 'Location: ' + Players[PN].Loc;
4: TSA[i] := 'Skill: ' + Players[PN].Skill;
5: TSA[i] := 'Random: '+ Players[PN].Rand;
end;
inc(i);
end;
i2 := 0;
for i3 := 0 to High(PlayerBooleans) do
begin
c := PlayerBooleans[i3];
TSA[i] := VarNames[i2]+': '+BoolToStr(Players[PN].Booleans[c]);
inc(i); inc(i2);
end;
for i3 := 0 to High(PlayerIntegers) do
begin
c := PlayerIntegers[i3];
TSA[i] := VarNames[i2]+': '+IntToStr(Players[PN].Integers[c]);
inc(i); inc(i2);
end;
for i3 := 0 to High(PlayerStrings) do
begin
c := PlayerStrings[i3];
TSA[i] := VarNames[i2]+': '+Players[PN].Strings[c];
inc(i); inc(i2);
end;
for i3 := 0 to High(PlayerExtendeds) do
begin
c := PlayerExtendeds[i3];
TSA[i] := VarNames[i2]+': '+FloatToStr(Players[PN].Extendeds[c]);
inc(i); inc(i2);
end;
end;
i2 := 0;
for i:= 0 to High(TSA) do
i2 := Max(i2, Length(TSA[i]));
if i2 > 16 then
for PN := 0 to (HowManyPlayers - 1) do
TSA[PN*L] := Replicate('=', i2);
TSA[High(TSA)] := Replicate('=', i2);
//centering the nick
for PN := 0 to (HowManyPlayers - 1) do
TSA[PN*L+1] := Replicate(' ', round((i2 - Length(Players[PN].Nick))/2)) + Players[PN].Nick;
for i:= 0 to High(TSA) do
case ResultType of
ResultDebugBox : writeln ('[ '+Padr(TSA[i], i2)+' ]');
ResultReportBox : AddToReport ('[ '+Padr(TSA[i], i2)+' ]');
ResultString : Result := Result + '[ '+Padr(TSA[i], i2)+' ]' + chr(13);
else begin SRL_Warn('SRLPlayerReport', 'Invalid Result Type!', Warn_AllVersions); exit end;
end;
if not ResultType = ResultString then Result := true;
end else begin
SetLength(T2DVA, HowManyPlayers + 2)
// T2DVA[0] will be used to store string lengths
// T2DVA[1] will be used to store variable names
// The others will be used to store Player Info as strings
SetLength(TSA, HowManyPlayers + 3);
L := 2;
for i:= 0 to high(DefaultSettings) do
if DefaultSettings[i] then inc(L);
L := L + Length(VarNames);
SetLength(T2DVA[0], L);
SetLength(T2DVA[1], L);
T2DVA[1][0] := 'Nick';
T2DVA[1][1] := 'Active';
i := 2;
for i2:= 0 to high(DefaultSettings) do
if DefaultSettings[i2] then
begin
case i2 of
0: T2DVA[1][i] := 'Worked';
1: T2DVA[1][i] := 'Banked';
2: T2DVA[1][i] := 'Level';
3: T2DVA[1][i] := 'Loc';
4: T2DVA[1][i] := 'Skill';
5: T2DVA[1][i] := 'Rand';
end;
inc(i);
end;
for i2 := 0 to High(VarNames) do
begin
T2DVA[1][i] := VarNames[i2];
inc(i);
end;
i := 0;
for PN := 0 to HowManyPlayers - 1 do
begin
SetLength(T2DVA[PN+2], L);
T2DVA[PN+2][0] := Players[PN].Nick;
T2DVA[PN+2][1] := BoolToStr(Players[PN].Active);
i := 2;
for i2 := 0 to high(DefaultSettings) do
if DefaultSettings[i2] then
begin
case i2 of
0: T2DVA[PN+2][i] := MsToTime(Players[PN].Worked, Time_Bare);
1: T2DVA[PN+2][i] := IntToStr(Players[PN].Banked);
2: T2DVA[PN+2][i] := IntToStr(Players[PN].Level[SkillLevel]);
3: T2DVA[PN+2][i] := Players[PN].Loc;
4: T2DVA[PN+2][i] := Players[PN].Skill;
5: T2DVA[PN+2][i] := Players[PN].Rand;
end;
inc(i);
end;
for i2 := 0 to High(PlayerBooleans) do
begin
c := PlayerBooleans[i2];
T2DVA[PN+2][i] := BoolToStr(Players[PN].Booleans[c]);
inc(i);
end;
for i2 := 0 to High(PlayerIntegers) do
begin
c := PlayerIntegers[i2];
T2DVA[PN+2][i] := IntToStr(Players[PN].Integers[c]);
inc(i);
end;
for i2 := 0 to High(PlayerStrings) do
begin
c := PlayerStrings[i2];
T2DVA[PN+2][i] := Players[PN].Strings[c];
inc(i);
end;
for i2 := 0 to High(PlayerExtendeds) do
begin
c := PlayerExtendeds[i2];
T2DVA[PN+2][i] := FloatToStr(Players[PN].Extendeds[c]);
inc(i);
end;
end;
L := High(T2DVA[0]);
for i:= 1 to High(T2DVA) do
for i2 := 0 to L do
T2DVA[0][i2] := Max(T2DVA[0][i2], Length(T2DVA[i][i2]));
for i:= 1 to High(T2DVA) do
for i2 := 0 to L do
begin
TSA[i] := TSA[i] + Padr(T2DVA[i][i2], T2DVA[0][i2]);
if i2 <> L then
TSA[i] := TSA[i] + ' | ';
end;
i2 := Length(TSA[1]);
TSA[0] := Replicate('=', i2);
TSA[High(TSA)] := Replicate('=', i2);
for i:= 0 to High(TSA) do
begin
case ResultType of
ResultDebugBox : writeln('[ '+ TSA[i] +' ]');
ResultReportBox : AddToReport('[ '+ TSA[i] +' ]');
ResultString : Result := Result + '[ '+ TSA[i] +' ]' + chr(13);
else begin SRL_Warn('SRLPlayerReport', 'Invalid Result Type!', Warn_AllVersions); exit; end;
end;
if i = 1 then
case ResultType of
ResultDebugBox : writeln('[ ' + Replicate('=', i2)+ ' ]');
ResultReportBox : AddToReport('[ ' + Replicate('=', i2)+ ' ]');
ResultString : Result := Result + '[ ' + Replicate('=', i2)+ ' ]' + chr(13);
end;
end;
end;
{
Long Report
[ =========================================== ]
[ PlayerNic ]
[ Active: Players.Active ]
( Worked: MsToTime(Players.Worked, TimeShort) )
( Banked: Players.Banked )
( Level: Players.Level )
( Location: Players.Loc )
( Skill: Players.skill )
( Random: Players.Rand )
~ VarName[0] := Players.Booleans[X1] ~
~ VarName[1] := Players.Booleans[X2] ~
~ VarName[N] := Players.Booleans[Xn] ~
> VarName[Y] := Players.Integers[Xy] >
< VarName[T] := Players.Strings[Xt] <
- VarName[I] := Players.Extendeds[Xi] -
[ =========================================== ]
Short Report
[ =================================== ]
[ PlayerNic | Fishes | Nets | Randoms ]
[ =================================== ]
[ Player 2 | 876 | 390 | 324 ]
[ Player 3 | 567 | 586 | 678 ]
[ =================================== ]
}
end;
if you wish to test it yourself:
SCAR Code:
program new;
{.include srl/srl.scar}
const
ResultDebugBox = 0;
ResultReportBox = 1;
ResultString = 2;
Procedure DeclarePlayers;
var i:integer;
begin
NumberOfPlayers(3);
CurrentPlayer := 0;
Players[0].Name := 'Rasta Magician';
Players[1].Name := 'RM';
Players[2].Name := 'RMagician';
for i:= 0 to High(Players) do
with Players[i] do
begin
Nick := Name;
Active := RBool;
Worked := RandomRange(900000, 99999999);
Banked := Random(100);
Booleans[0] := RBool;
Integers[0] := Random(100);
Integers[1] := RandomRange(100, 200);
case Random(3) of
0: begin Loc := 'draynor'; Strings[0] := 'shrimps'; end;
1: begin Loc := 'lumby'; Strings[0] := 'trout'; end;
2: begin Loc := 'karam'; strings[0] := 'lobby'; end;
end;
end;
end;
{
SkillLevel => check Players.scar for the index of each level
e.g. for fishing = 17 ; 0 for none
Default settings: [Players.Worked, Players.Banked, Players.Level, Players.location, Players.Skill, Players.Random]
e.g. [True, True, false, true, false, false]
VarNames is a TStringArray, and the order has to be the one you'll use in the TIntegerArrays
e.g. ['bool1', 'bool2', 'int1', 'string1', 'string2', 'extended1' ]
e.g. ['safe', 'ready', 'fishes', 'EquipName', 'FishType', 'AverageTime/Fish' ]
PlayerBooleans: the index of the booleans you wish to show
e.g. show Players.Boolean[0] and Players.Booleans[3]
==> [0, 3]
Same applies for similarly name TIntegerArrays
}
function SRLPlayerReport(
ResultType, SkillLevel: Integer; LongReport:boolean;
DefaultSettings:TBooleanArray;
VarNames: TStringArray; PlayerBooleans, PlayerIntegers, PlayerStrings, PlayerExtendeds: TIntegerArray
): Variant;
var
TSA : TStringArray;
s : string;
i, i2, i3, L, PN, c : integer;
T2DVA : Array of TVariantArray;
begin
if Length(DefaultSettings) <> 6 then
begin
SRL_Warn('SRLPlayerReport', 'DefaultSettings must be exactly 6 settings!', warn_AllVersions);
SetLength(DefaultSettings, 6);
end;
L := Length(PlayerBooleans) + Length(PlayerIntegers) + Length(PlayerStrings) + Length(PlayerExtendeds);
if length(VarNames) <> L then
begin
SRL_Warn('SRLPlayerReport', 'VarNames and VarValues must be the same length', warn_AllVersions);
exit;
end;
if LongReport then
begin
L := 3;
for i:= 0 to high(DefaultSettings) do
if DefaultSettings[i] then inc(L);
L := L + Length(VarNames);
SetLength(TSA, L*HowManyPlayers+1);
i := 0;
for PN := 0 to (HowManyPlayers - 1) do
begin
TSA[i] := replicate('=', 16);
with Players[PN] do
begin
TSA[i+1] := Nick;
TSA[i+2] := 'Active: ' + BoolToStr(Active);
end;
i := i + 3;
if DefaultSettings[0] then
begin
TSA[i] := 'Worked: '+MSToTime(Players[PN].Worked, Time_Short);
inc(i);
end;
for i2 := 1 to High(DefaultSettings) do
if DefaultSettings[i2] then
begin
case i2 of
1: TSA[i] := 'Banked: '+ IntToStr(Players[PN].Banked);
2: TSA[i] := 'Level: '+ IntToStr(Players[PN].Level[SkillLevel]);
3: TSA[i] := 'Location: ' + Players[PN].Loc;
4: TSA[i] := 'Skill: ' + Players[PN].Skill;
5: TSA[i] := 'Random: '+ Players[PN].Rand;
end;
inc(i);
end;
i2 := 0;
for i3 := 0 to High(PlayerBooleans) do
begin
c := PlayerBooleans[i3];
TSA[i] := VarNames[i2]+': '+BoolToStr(Players[PN].Booleans[c]);
inc(i); inc(i2);
end;
for i3 := 0 to High(PlayerIntegers) do
begin
c := PlayerIntegers[i3];
TSA[i] := VarNames[i2]+': '+IntToStr(Players[PN].Integers[c]);
inc(i); inc(i2);
end;
for i3 := 0 to High(PlayerStrings) do
begin
c := PlayerStrings[i3];
TSA[i] := VarNames[i2]+': '+Players[PN].Strings[c];
inc(i); inc(i2);
end;
for i3 := 0 to High(PlayerExtendeds) do
begin
c := PlayerExtendeds[i3];
TSA[i] := VarNames[i2]+': '+FloatToStr(Players[PN].Extendeds[c]);
inc(i); inc(i2);
end;
end;
i2 := 0;
for i:= 0 to High(TSA) do
i2 := Max(i2, Length(TSA[i]));
if i2 > 16 then
for PN := 0 to (HowManyPlayers - 1) do
TSA[PN*L] := Replicate('=', i2);
TSA[High(TSA)] := Replicate('=', i2);
//centering the nick
for PN := 0 to (HowManyPlayers - 1) do
TSA[PN*L+1] := Replicate(' ', round((i2 - Length(Players[PN].Nick))/2)) + Players[PN].Nick;
for i:= 0 to High(TSA) do
case ResultType of
ResultDebugBox : writeln ('[ '+Padr(TSA[i], i2)+' ]');
ResultReportBox : AddToReport ('[ '+Padr(TSA[i], i2)+' ]');
ResultString : Result := Result + '[ '+Padr(TSA[i], i2)+' ]' + chr(13);
else begin SRL_Warn('SRLPlayerReport', 'Invalid Result Type!', Warn_AllVersions); exit end;
end;
if not ResultType = ResultString then Result := true;
end else begin
SetLength(T2DVA, HowManyPlayers + 2)
// T2DVA[0] will be used to store string lengths
// T2DVA[1] will be used to store variable names
// The others will be used to store Player Info as strings
SetLength(TSA, HowManyPlayers + 3);
L := 2;
for i:= 0 to high(DefaultSettings) do
if DefaultSettings[i] then inc(L);
L := L + Length(VarNames);
SetLength(T2DVA[0], L);
SetLength(T2DVA[1], L);
T2DVA[1][0] := 'Nick';
T2DVA[1][1] := 'Active';
i := 2;
for i2:= 0 to high(DefaultSettings) do
if DefaultSettings[i2] then
begin
case i2 of
0: T2DVA[1][i] := 'Worked';
1: T2DVA[1][i] := 'Banked';
2: T2DVA[1][i] := 'Level';
3: T2DVA[1][i] := 'Loc';
4: T2DVA[1][i] := 'Skill';
5: T2DVA[1][i] := 'Rand';
end;
inc(i);
end;
for i2 := 0 to High(VarNames) do
begin
T2DVA[1][i] := VarNames[i2];
inc(i);
end;
i := 0;
for PN := 0 to HowManyPlayers - 1 do
begin
SetLength(T2DVA[PN+2], L);
T2DVA[PN+2][0] := Players[PN].Nick;
T2DVA[PN+2][1] := BoolToStr(Players[PN].Active);
i := 2;
for i2 := 0 to high(DefaultSettings) do
if DefaultSettings[i2] then
begin
case i2 of
0: T2DVA[PN+2][i] := MsToTime(Players[PN].Worked, Time_Bare);
1: T2DVA[PN+2][i] := IntToStr(Players[PN].Banked);
2: T2DVA[PN+2][i] := IntToStr(Players[PN].Level[SkillLevel]);
3: T2DVA[PN+2][i] := Players[PN].Loc;
4: T2DVA[PN+2][i] := Players[PN].Skill;
5: T2DVA[PN+2][i] := Players[PN].Rand;
end;
inc(i);
end;
for i2 := 0 to High(PlayerBooleans) do
begin
c := PlayerBooleans[i2];
T2DVA[PN+2][i] := BoolToStr(Players[PN].Booleans[c]);
inc(i);
end;
for i2 := 0 to High(PlayerIntegers) do
begin
c := PlayerIntegers[i2];
T2DVA[PN+2][i] := IntToStr(Players[PN].Integers[c]);
inc(i);
end;
for i2 := 0 to High(PlayerStrings) do
begin
c := PlayerStrings[i2];
T2DVA[PN+2][i] := Players[PN].Strings[c];
inc(i);
end;
for i2 := 0 to High(PlayerExtendeds) do
begin
c := PlayerExtendeds[i2];
T2DVA[PN+2][i] := FloatToStr(Players[PN].Extendeds[c]);
inc(i);
end;
end;
L := High(T2DVA[0]);
for i:= 1 to High(T2DVA) do
for i2 := 0 to L do
T2DVA[0][i2] := Max(T2DVA[0][i2], Length(T2DVA[i][i2]));
for i:= 1 to High(T2DVA) do
for i2 := 0 to L do
begin
TSA[i] := TSA[i] + Padr(T2DVA[i][i2], T2DVA[0][i2]);
if i2 <> L then
TSA[i] := TSA[i] + ' | ';
end;
i2 := Length(TSA[1]);
TSA[0] := Replicate('=', i2);
TSA[High(TSA)] := Replicate('=', i2);
for i:= 0 to High(TSA) do
begin
case ResultType of
ResultDebugBox : writeln('[ '+ TSA[i] +' ]');
ResultReportBox : AddToReport('[ '+ TSA[i] +' ]');
ResultString : Result := Result + '[ '+ TSA[i] +' ]' + chr(13);
else begin SRL_Warn('SRLPlayerReport', 'Invalid Result Type!', Warn_AllVersions); exit; end;
end;
if i = 1 then
case ResultType of
ResultDebugBox : writeln('[ ' + Replicate('=', i2)+ ' ]');
ResultReportBox : AddToReport('[ ' + Replicate('=', i2)+ ' ]');
ResultString : Result := Result + '[ ' + Replicate('=', i2)+ ' ]' + chr(13);
end;
end;
end;
{
Long Report
[ =========================================== ]
[ PlayerNic ]
[ Active: Players.Active ]
( Worked: MsToTime(Players.Worked, TimeShort) )
( Banked: Players.Banked )
( Level: Players.Level )
( Location: Players.Loc )
( Skill: Players.skill )
( Random: Players.Rand )
~ VarName[0] := Players.Booleans[X1] ~
~ VarName[1] := Players.Booleans[X2] ~
~ VarName[N] := Players.Booleans[Xn] ~
> VarName[Y] := Players.Integers[Xy] >
< VarName[T] := Players.Strings[Xt] <
- VarName[I] := Players.Extendeds[Xi] -
[ =========================================== ]
Short Report
[ =================================== ]
[ PlayerNic | Fishes | Nets | Randoms ]
[ =================================== ]
[ Player 2 | 876 | 390 | 324 ]
[ Player 3 | 567 | 586 | 678 ]
[ =================================== ]
}
end;
begin
ClearDebug;
ClearReport;
DeclarePlayers;
SRLPlayerReport(
ResultReportBox, 0, True,
[True, True, False, True, False, False],
['fishes', 'Responses', 'FishType'],
[], [0, 1], [0], []
);
SRLPlayerReport(
ResultDebugBox, 0, False,
[True, True, False, True, False, False],
['fishes', 'Responses', 'FishType'],
[], [0, 1], [0], []
);
end.
And finally, the instructions (as it can look complicated, although it is easy to use)
SCAR Code:
{
SkillLevel => check Players.scar for the index of each level
e.g. for fishing = 17 ; 0 for none
Default settings: [Players.Worked, Players.Banked, Players.Level, Players.location, Players.Skill, Players.Random]
e.g. [True, True, false, true, false, false]
VarNames is a TStringArray, and the order has to be the one you'll use in the TIntegerArrays
e.g. ['bool1', 'bool2', 'int1', 'string1', 'string2', 'extended1' ]
e.g. ['safe', 'ready', 'fishes', 'EquipName', 'FishType', 'AverageTime/Fish' ]
PlayerBooleans: the index of the booleans you wish to show
e.g. show Players.Boolean[0] and Players.Booleans[3]
==> [0, 3]
Same applies for similarly name TIntegerArrays
}
function SRLPlayerReport(
ResultType, SkillLevel: Integer; LongReport:boolean;
DefaultSettings:TBooleanArray;
VarNames: TStringArray; PlayerBooleans, PlayerIntegers, PlayerStrings, PlayerExtendeds: TIntegerArray
): Variant;
SRLPlayerReport(
ResultDebugBox, 0, False,
[True, True, False, True, False, False],
['fishes', 'Responses', 'FishType'],
[], [0, 1], [0], []
);
enjoy!
~RM