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.
Code:
procedure Report;
begin
end;
Then, add ClearDebug; to your procedure. This will clear everything in the debug screen.
Code:
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:
Creating The Variable
At the top of your script, you should have something like this:
Add this to it:
Code:
var
x, y, AntibanUsed: integer;
Inserting the Addition
Find you antiban procedure, this is an example procedure:
Code:
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:
Code:
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;
inc(AntibanUsed);
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.
Gathering And Outputting the Information
Remember your Report Procedure?, Go back to it and change it to this:
Code:
procedure Report;
begin
ClearDebug;
WriteLn('Antibans Performed: ' + IntToStr(AntibanUsed));
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);.
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.
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:
Code:
procedure Report;
begin
ClearDebug;
WriteLn('Antibans Performed: ' + IntToStr(AntibanUsed));
end;
To fix it, and make it lined up, you can do this:
Code:
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