From: The Un-Named
I'm not around SRL enough and there's no real tuts for it. I'd gladly look up the manual for a SRL progress report procedures but then I need to look up the code to see how to use them. :( I'll do them next version.
Well basically think of regular array and how you use for to do to loop through them; for i:= 0 to HowManyPlayers - 1 do.
So it loops through the Player numbers i.e : Players[0], Players[1], Players[2], ect until it meets the do, (which i'm sure you probably already know so I'llmove on).
for i := 0 to HowManyPlayers - 1 do
begin
if(Players[i].Active = True)then
Active := 'True'
else
Active := 'False';
If Players
.Active is true then the variable active string for this loop is true.
Here are other arguments for Players[].
type
TUser = record
Name: string; // * User Name
Pass: string; // * User Pass
Nick: string; // * Screen Name for random detection
Active: Boolean; // * Set to True if Ok, False if Lost.
Loc: string; // * User Location
Skill: string; // * User Action to Perform
Level: array[0..21] of word;
// * Levels of all skills. SetIn GetPlayerLevels.
Ore: string; // * test
WaitTime: Integer; // * Wait Time for Each User, Good for Autofighters
Fight: Boolean; // * If we want the Char to randomly fight
Worked: Integer; // * Time User has worked
Banked: Integer; // * Number of Banks User has done
Killed: Integer; // * Number of Kills User has made
Boolean1: Boolean; // * For reports, etc.
Boolean2: Boolean; // * For reports, etc.
Boolean3: Boolean; // * For reports, etc.
Integer1: Integer; // * For reports, etc.
Integer2: Integer; // * For reports, etc.
Integer3: Integer; // * For reports, etc.
Integer4: Integer; // * For reports, etc.
String1: string; // * For reports, etc.
String2: string; // * For reports, etc.
String3: string; // * For reports, etc.
Extended1: Extended; // * For reports, etc.
Extended2: Extended; // * For reports, etc.
Extended3: Extended; // * For reports, etc.
end;
For example you can use Integer1 to hold it's mining lvl. So sometime before writing in the progress report use:
Players[CurrentPlayer].Integer1:= GetSkillLevel('Mining');
CurrentPlayer is set by NextPlayer ( in your case RRandomPlayer) they always update the variable for you. :P
Then you could add that in your for loop also. I hope I'm making sense but sorry I'm partly in a rush.
Whole thing I took from a private Chopper;
procedure PlayerStats;
var
Active: string;
i : Integer;
begin
Writeln('****************************************************');
Writeln(' Name : '+ Players[CurrentPlayer].Name);
Writeln(' Number : '+ IntToStr(CurrentPlayer));
Writeln(' Worked : '+ IntToStr (Players[CurrentPlayer].Worked)+' minutes.');
Writeln(' Banked : '+ IntToStr (Players[CurrentPlayer].Banked) + ' loads.');
Writeln(' Location: '+ Players[CurrentPlayer].loc);
Writeln(' Level : '+ IntToStr(Players[CurrentPlayer].Integer1));
Writeln('****************************************************');
for i := 0 to HowManyPlayers - 1 do
begin
if(Players[i].Active = True)then
Active := 'True'
else
Active := 'False';
Writeln (IntToStr(i) + ' : '+Players[i].Name + ' = ' + Active + '. - Lvl: '+IntToStr(Players[i].Integer1)+
'. - B :'+IntToStr (Players[i].Banked)+' times.'+
' - '+IntToStr (Players[i].Worked)+' mins.'+' - Loc: '+Players[i].loc);
end;
Writeln('*****************************************************');
end;
Then in your progress report just put PlayerStats;
under it.
haha, i hope that helps. :\
:D
Here I wrote this just now, maybe this could help. It basically works just like what you want.
program New;
procedure RegularArray;
var
haha : array of String;
i, baDump : Integer;
begin
ClearDebug;
SetArrayLength(haha, 3); // aka HowManyPlayers:= 3;
haha[0]:= 'lala'; // like DeclarePlayers?
haha[1]:= 'tsins'; // ""
haha[2]:= 'hausdhan'; // ""
for i:= 0 to getarraylength(haha) - 1 do
begin
Writeln(haha[i]);
Writeln(Chr(32)); // justlike Writeln('');btw..
end;
end;
begin
Regulararray;
end.
I'm SOOO SORRY i didn't just PM you this, but I was hoping other people who needed help could see this.. >.<
Btw, your coding is shoooo pretty.<3