How to make a detailed progress report!
By N1ke!
Table of content
- Progress report?
- Integers
- Strings
- Booleans
- Basics
- Advanced
Progress Report?
A Progress report does exactly as the name says, it shows the progress
of the script. It can be all from a very basic one to a very detailed and advanced one. Today I'm going to show you both versions and many ways
how to make that awesome report that everyone does. As always we start
with the basics.
Vars
To learn the basics i suggest knowing Integers, Strings and Booleans as they
are the main parts of a Progress report, I explain them.
- Integers -
Intergers stores any number and can be set this way.
SCAR Code:
program New;
{.include SRL/SRL.scar}
var
TestVar : Integer;
begin
SetupSRL;
TestVar := 15;
end.
As you can see, very simple.
- Strings -
Strings are letters, words, names or such.
The good thing about strings are that you can Write them out in the debug box with a procedure called Writeln. Let me show you.
SCAR Code:
program New;
{.include SRL/SRL.scar}
var
TestString : String;
begin
SetupSRL;
TestString := 'SRL is the best.';
Writeln(TestString);
end.
You can also write it without setting up a string, like this.
SCAR Code:
program New;
{.include SRL/SRL.scar}
var
TestString : String;
begin
SetupSRL;
Writeln('Hello world!');
end.
- Booleans -
Booleans can only result True or False, nothing inbetween. A boolean always starts as False and it can be set like this.
SCAR Code:
program New;
{.include SRL/SRL.scar}
var
Test : Boolean;
begin
SetupSRL;
Test := True;
end.
Basic
I start by teaching you how to count, see this ect
SCAR Code:
program New;
{.include SRL/SRL.scar}
var
CountItem: Integer;
begin
SetupSRL;
CountItem := CountItem + 1;
Writeln(IntToStr(CountItem));
end.
Here i added a new thing, IntToStr(). IntToStr() converts a Integer to a
string so you can type it in the debug box using Writeln().
There is also BoolToStr which converts a Boolean to String (True / false ).
Now when you can count using integers I'm going to make it a bit
harder, Watch.
SCAR Code:
program New;
{.include SRL/SRL.scar}
var
Ores, Exp : Integer;
Procedure Mine;
Begin
Blablablabla
Ores := Ores + 1;
Exp := Exp + 32;
end;
begin
SetupSRL;
Repeat
Mine;
Writeln(IntToStr(Ores));
Writeln(IntToStr(Exp));
Until(False);
end.
As you can see i increases the integers by how many ores i get and how
much exp ive earned, by doing this i can later on use Writeln() to print them
out and see the progress.
Now heres one of my Progress report that i explain.
SCAR Code:
Procedure ProgressReport;
begin
Writeln('Has been running for ' + TimeRunning);
Writeln('Made ' + IntToStr(PlayerExp) + ' Exp');
Writeln('Banked ' + IntToStr(Ores) + ' Ores');
end;
When doing this you need to know how to + two strings. You first end the
first string by closing it with a ' then you put a + and then the thing you
want to plus. Keep in mind that you need IntToStr if its a integer and
BoolToStr if it's a Boolean.
Now I've teached you the basics, From here be creative
and don't be scared to try anything new!.
Advanced
At this part i suggest having some experience in (For to do) loops and
have experience in basic progress reports. This is above beginner but
as Basics are in here aswell it be nicer to have it here.
I start off by showing you one of my progress reports then breaking it down.
SCAR Code:
program New;
{.include SRL/SRL.scar}
var
PlayerExp, Ores: integer;
Procedure ProgressReport;
begin
Writeln(' Testing script! ');
Writeln('');
Writeln(' Has been running for ' + TimeRunning);
Writeln('');
Writeln(' | Name | Ores | Exp | Levels |');
For i:= 0 to HowManyPlayers - 1 do
Writeln(' ' + Players[i].Name + ' | ' + IntToStr(Players[i].Integers[0]) + ' | ' + IntToStr(Players[i].Integers[1]) + ' | ' + IntToStr(Players[i].Integers[2]));
end;
Here i do the For to do loop which goes around all the players in the player
array (DeclarePlayers). Then i use the Player integers to collect how many
ores, exp and levels gain. Then by doing For i:= 0 means that i will be the
player it's on. Thats why we do Players[i], Becuase it changes each loop to
one higher number which means one more player. Can be a bit tricky to
understand at first, but try yourself.
I made a little Testing script that maybe makes you understand a bit easier.
SCAR Code:
program New;
{.include SRL/SRL.scar}
var
Number: Integer;
Procedure ForToDoExplain;
var
i: integer;
begin
Number := 5 // Change this after one run..
For i:= 0 to Number do
Writeln('Integer I is ' + IntToStr(i));
end;
begin
SetupSRL;
ForToDoExplain;
end.
Run that and change Number := after first run, that might help you
understand. After that try messing with it a bit..
NOTE* If you add more then one line after the For loop you need a begin
and a end; like this.
SCAR Code:
program New;
{.include SRL/SRL.scar}
var
Number: Integer;
Procedure ForToDoExplain;
var
i: integer;
begin
Number := 5 // Change this after one run..
For i:= 0 to Number do
begin // An Begin becuase theres more then 1 line after for loop.
Writeln('Integer I is ' + IntToStr(i));
Writeln('Test');
end; // An end becuase theres more then 1 line after for loop.
end;
begin
SetupSRL;
ForToDoExplain;
end.
Now don't keep going until you completly understand the For to do statement.
If you do you will be completly lost after this part.
I also suggest knowing the IntToStr and BoolToStr before continuing as
they be used in this example.
SCAR Code:
Procedure ProgressReport;
var
i : integer;
s : string;
begin
Writeln(' #-[]-¤ Multi Progress Report ¤-[]-#');
Writeln(' By N1ke! the genius.');
Writeln('');
Writeln(' Time running : ' + TimeRunning);
Writeln('');
For i:= 0 to HowManyPlayers - 1 do
Writeln(' [' + BoolToStr(Players[i].Active) + ']- P #' + IntToStr(i) + ' / Nick: ' + Players[i].Nick + ' / Snapes/h: ' + IntToStr(Round(Players[i].Integers[0] / (GetTimeRunning / 3600000.0))) +
' / Cash: ' + IntToStr(Players[i].Integers[1]) + ' / Banked: ' + IntToStr(Players[i].Integers[0]));
end;
The following is from my snape grass picker(Members only) and the result of the proggres report is like this.
Code:
#-[]-¤ Multi Progress Report ¤-[]-#
By N1ke! the genius.
Time running : 0 Seconds
[True]- P #0 / Nick: / Snapes/h: 0 / Cash: 0 / Banked: 0
Now i don't have much more to say, Just stay creative and if you have any
problem feel free to post them here or add my msn,
N_1_c_e@hotmail.com