SRL Archive - Outdated Tutorials

Creating Progress Reports


D1zl3

2009-07-22 09:51:30

Hey, this is my tutorial on creating a progress report, so enjoy:)

What's A "Progress Report"?
A progress report, or proggy, is text that is outputted into the debug box at the bottom of scar, letting you know stats from the script running. To me, it is a great thing to add into your script.


Writing The Procedure
Firstly, create a procedure, name is anything you want of course.
procedure Report;
begin
end;

Then, add ClearDebug; to your procedure. This will clear everything in the debug screen.
procedure Report;
begin
ClearDebug;
end;


Counting a Action
Progress reports count things that your script does to let their users know, so this can be helpful in letting the user know how many times their script has performed anti ban procedures. We do this by following these steps:


[INDENT]Creating The Variable
At the top of your script, you should have something like this:
var
x, y: integer;
Add this to it:
var
x, y, AntibanUsed: integer;


Inserting the Addition
Find you antiban procedure, this is an example procedure:

procedure AntiBan;
begin
if(not(LoggedIn))then Exit;
wait(200+random(125)+random(138));
keyup(VK_DOWN);
wait(random(232));
SendArrow(0);
case random(4) of
0: PickUpMouse;
1: RandomMovement;
2: RandomRClick;
3: BoredHuman;
end;
end;
And change it to this:
procedure AntiBan;
begin
if(not(LoggedIn))then Exit;
wait(200+random(125)+random(138));
keyup(VK_DOWN);
wait(random(232));
SendArrow(0);
case random(4) of
0: PickUpMouse;
1: RandomMovement;
2: RandomRClick;
3: BoredHuman;
end;
[COLOR="Red"]inc(AntibanUsed);[/COLOR]
end;
Useful Info:
The function "inc" is short for increment, which means that even time the script comes to that inc, it will change the amount of the variable "AntibanUsed" to 1, and when the script comes by again, it will change to 2, and so on.[/INDENT]



Gathering And Outputting the Information
Remember your Report Procedure?, Go back to it and change it to this:
procedure Report;
begin
ClearDebug;
[COLOR="Red"]WriteLn('Antibans Performed: ' + IntToStr(AntibanUsed));[/COLOR]
end;
Useful Info:
The function WriteLn stands for Write Line. It will type out "AntiBans Performed (How many times it was done).
IntToStr stands for Insert Into String, which means it will insert the number saved by the function inc(AntibanUsed);.


[INDENT]Calling The Report
You must tell the script when to print out the function, right? A good time to do this is when the script has just banked a load of logs, or just did a run of runecrafting. To make the report show up in the debug box, just enter this after you close the bank screen or wherever.
Report;
[/INDENT]

Beautifying Your Proggy
If you have ever seen a progress report come out of the debug box all messy and not lined up, well this part is to show you how to fix it.

Your old report procedure had looked like this:
procedure Report;
begin
ClearDebug;
WriteLn('Antibans Performed: ' + IntToStr(AntibanUsed));
end;
To fix it, and make it lined up, you can do this:

procedure Report;
begin
ClearDebug;
WriteLn('=====================================================================');
WriteLn(Padr('|| AntiBans Performed: ' + IntToStr(AntiBanUsed), 67) + '||');
WriteLn('=====================================================================');
end;
Useful Info:
Padr stand for pad right, which is the part which lines up the progress report. There is also Padl, and Padz. The 67 near the end may not make sense, but the means how many spaces to use after it prints out the sentence, making it line up with all the = signs, giving your progress report a nice clean box look.


There, you made it! I hope you enjoy it and learned something :)

JPHamlett

2009-07-22 09:57:26

nice tut hey this may sound nooby but i never learned how to make a multy player proggy maybe u could add how to do that

D1zl3

2009-07-22 10:06:14

From: J_Pizzle
nice tut hey this may sound nooby but i never learned how to make a multy player proggy maybe u could add how to do that


your not alone on that one:P Ill add it when i learn it :)

JPHamlett

2009-07-22 10:08:21

From: D1zl3
your not alone on that one:P Ill add it when i learn it :)


lol ok ill be waiting

D1zl3

2009-07-22 10:09:15

Heres One

senrath

2009-07-22 10:25:20

Nice tut. Although some terminology is a bit off. Inc is short for Increment, not include. And Padr is short for Pad Right. There's also a Padl, which is short for Pad Left.

D1zl3

2009-07-22 10:36:49

lol great thanks alot ill change it

Naum

2009-07-22 11:47:09

From: D1zl3
lol great thanks alot ill change it


Great Tutorial, Gives me an idea :D.
Add Padz.
Rep+

D1zl3

2009-07-22 11:59:36

From: NaumanAkhlaQ
Great Tutorial, Gives me an idea :D.
Add Padz.
Rep+


added, thanks:)

ian.

2009-07-22 12:27:39

And IncEx for adding more than one two a var. (Logs/load and things like that :p)

Naum

2009-07-22 14:02:01

From: 99_ aka ian.
And IncEx for adding more than one two a var. (Logs/load and things like that :p)

And DecEx for subtraction ;)

D1zl3

2009-07-22 14:03:00

Ill add them both in a bit thanks :D

bugger0001

2009-07-22 14:47:19

Well, I do multiplayer proggys by using the player array. You get like a hundred global integers, extendeds, strings and booleans with it for EACH player. Then simply do something like that:

procedure ForProggy(LogsGot: integer);
begin
IncEx(Players[CurrentPlayer].Integers[0], LogsGot);//You have to count the logs for it ;)
end;
The same applies for antibans/errors/randoms/pickups/failsafes and so on ;)

ian.

2009-07-22 15:00:14

From: NaumanAkhlaQ
And DecEx for subtraction ;)


And Dec for that matter. :)

marpis

2009-07-22 18:46:17

Example of multiplayer proggies:

// lets say that players[x].Integers[0] is "Ores mined" and
// players[x].Integers[1] is "Loads Banked" and
// players[x].Strings[0] is "Oretype"

procedure DeclarePlayers;
begin
HowManyPlayers := 3;
CurrentPlayer := 0;
NumberOfPlayers(HowManyPlayers);

players[0].Name := 'killer';
players[0].Pass := 'pass123';
players[0].Strings[1] := 'mithril';
players[0].Active := true;

players[1].Name := 'purepk13';
players[1].Pass := 'pass123';
players[1].Strings[1] := 'coal';
players[1].Active := true;

players[2].Name := 'thedragonman';
players[2].Pass := 'pass123';
players[2].Strings[1] := 'iron';
players[2].Active := true;
end;

procedure MineOre;
begin
FindOre;
ClickOre;
Inc(players[currentplayer].Integers[0]);
end;

procedure Bank;
begin
WalkToBank;
DepositAllOres;
Inc(players[currentplayer].Integers[1]);
end;

procedure Report;
var
i: integer;
begin
writeln('~~ Awesome example miner! - by marpis ~~');
for i := 0 to (HowManyPlayers -1) do
begin
writeln(players[i].Name);
writeln(' Oretype : '+players[i].Strings[0]);
writeln(' Ores mined: '+IntToStr(players[i].Integers[0]));
writeln(' Loads banked: '+IntToStr(players[i].Integers[1]));
writeln(''); // empty line
end;
writeln('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
writeln('Thanks for using my script! Remember to post proggy!');
end;

for example, this could output

~~ Awesome example miner! - by marpis ~~
killer
Oretype: mithril
Ores mined: 28
Loads banked: 1

purepk13
Oretype: coal
Ores mined: 56
Loads banked: 2

thedragonman
Oretype: iron
Ores mined: 100
Loads banked: 4
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Thanks for using my script! Remember to post proggy!

Da 0wner

2009-07-22 18:58:03

You could, of course, use SRL's?

marpis

2009-07-22 19:26:42

From: Da 0wner
You could, of course, use SRL's?


some ppl - including me - rather make their own proggys

D1zl3

2009-07-22 19:27:33

thanks for the multiplayer proggy marpis. May i add it in, giving you the credits?

Da 0wner

2009-07-22 19:44:03

D1zl3 try this:
program ProgressReport;
{.include SRL/SRL.scar}

procedure DeclarePlayers;
var
i, ii : integer;
begin
HowManyPlayers := 3;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

players[0].Name := 'killer';
players[0].Pass := 'pass123';
players[0].Strings[0] := 'mithril';
players[0].Active := true;

players[1].Name := 'purepk13';
players[1].Pass := 'pass123';
players[1].Strings[0] := 'coal';
players[1].Active := true;

players[2].Name := 'thedragonman';
players[2].Pass := 'pass123';
players[2].Strings[0] := 'iron';
players[2].Active := true;

for i := 0 to 2 do
for ii := 0 to 2 do
players[i].Integers[ii] := Random(300);
end;

var
h, i : integer;

begin
DeclarePlayers;
Writeln('|-------------------------------------------------------------------|');
Writeln('|Test Version 1.0 |');
Writeln('|-------------------------------------------------------------------|');
Writeln('| Name | Oretype | Ore Mined | Loads Banked | Active |');
Writeln('|-------------------------------------------------------------------|');
h := high(Players);
for i := 0 to h do
Writeln(Format('| %s| %s| %s| %s| %s|', [Padr(Players[i].Name, 15),
Padr(Players[i].Strings[0], 12),
Padr(IntToStr(Players[i].Integers[0]), 11),
Padr(IntToStr(Players[i].Integers[1]), 13),
Padr(BoolToStr(Players[i].Active), 7)]));
end.

D1zl3

2009-07-22 19:48:20

Yes i know, the looks really sexy. Is this the srl one?

Da 0wner

2009-07-22 19:49:16

Lol, nope. Just one I made.

marpis

2009-07-23 08:30:43

From: D1zl3
thanks for the multiplayer proggy marpis. May i add it in, giving you the credits?


yes ofcourse :)

ian.

2009-07-25 06:36:04

Da 0wner loved the Format function. It might be useful to add in here, if you understand it. :p

Daedolon

2010-12-04 12:54:42

This was really helpful. Thank you for posting this :)