Naum
07-19-2009, 05:31 PM
Understanding SCAR's DebugBox Functions
Table Of Contents
O - Intro.
I - DebugBox Functions/Procedures and Descriptions + Usage.
II - End Note.
O - Intro.
Hello, and welcome to my tutorial on SCAR's DebugBox functions. In this tutorial I will explain functions such as ClearDebug; and GetDebugLineCount. Knowing how to use this is vital. So you may ask: 'How does this relate to RuneScape?'. Well... Ever heard of a progress report? It shows you what you've done, and for how long in a Script, how would you edit it without printing it again?.
I - DebugBox Functions/Procedures and Descriptions.
The Debug functions of SCAR are:
procedure ClearDebug;
Clears debug box.
procedure DeleteDebugLine(Line: Integer);
Deletes a line from the debug box.
function GetDebugLineCount: Integer;
Get the number of lines in the debug box.
function GetDebugText: string;
Gets the text in the debugbox.
function GetDebugLine(Line: Integer): string;
Returns a certain given line of the debug box.
procedure ClearDebugLine(Line: Integer);
Clears a certain line of the debug box.
procedure ReplaceDebugLine(Line: Integer; s: string);
Replaces a certain line of the debug box.
function GetDebugParams: TDebugParams;
Retrieves the default make-up settings for the debugbox.
procedure SetDebugParams(Params: TDebugParams);
Sets make-up settings for the next WriteLn to the debugbox.
procedure AddToReport(s: string);
Adds a message to the report box.
procedure ClearReport;
Clears all messages sent to the report box
procedure ChangeReportWidth(Width: Integer);
Changes the width of the report box to the given Width.
I will break them down and we will analyze them step-by-step (Here's a smiley to keep you going on: :)).
1.
procedure ClearDebug;
Clears debug box.
It basically does what it says. Run this script:
Begin
WriteLn('jjjjjj');
Writeln('kkkk');
Wait(1000);
ClearDebug;
End.
2.
procedure DeleteDebugLine(Line: Integer);
Deletes a line from the debug box.
The first line is '0' then next line is '1' and so on.. Try this:
Begin
ClearDebug; //see that ;)
WriteLn('This line will be deleted');
Wait(800);
WriteLn('This Line wont');
Wait(800);
DeleteDebugLine(0);
Wait(800);
WriteLn('See ;)');
End.
3.
function GetDebugLineCount: Integer;
Get the number of lines in the debug box.
Run it...
Begin
ClearDebug;
WriteLn('ggg');
If Random(2) = 0 Then WriteLn('hhh');
WriteLn(IntToStr(GetDebugLineCount)+' lines in Debug Box');
End.
4.
function GetDebugText: string;
Gets the text in the debugbox.
It does what it says. Run this son:
Begin
ClearDebug; //;)
If Random(2) = 1 Then WriteLn('Roflmao')
Else WriteLn('lololol');
If GetDebugText = 'Roflmao' Then
WriteLn('We typed in Roflmao, that means that Random(2) was 1')
Else
WriteLn('We typed in lololol, that means that Random(2) was 0');
End.
5.
function GetDebugLine(Line: Integer): string;
Returns a certain given line of the debug box.
It sure does ;):
Begin
WriteLn('kjk');
Writeln('lkl');
WriteLn('Last Line was : '+GetDebugLine(GetDebugLineCount-1));
End.
^ Look at that, I used a function in a function ;). See how they relate to each other?
6.
procedure ClearDebugLine(Line: Integer);
Clears a certain line of the debug box.
Begin
WriteLn('this line will be deleted');
Wait(999);
WriteLn('this line will not');
Wait(999);
ClearDebugLine(GetDebugLineCount - 2);
End.
^ Function in a function again :spot: ^
7.
procedure ReplaceDebugLine(Line: Integer; s: string);
Replaces a certain line of the debug box.
This will replace a debug line, Remember what was said before of the progress report thing? This is your salvation! :eek:
Var I : ShortInt;
Begin
WriteLn('A simple countdown');
Wait(700);
For I := 60 Downto 0 Do
Begin
ReplaceDebugLine(GetDebugLineCount-1, IntToStr(I));
Wait(200);
End;
End.
See it doesn't print a mass amount? So you can replace Lines during run time.
8.
function GetDebugParams: TDebugParams;
Retrieves the default make-up settings for the debugbox.
In the 'New' Scar, you can modify the debugbox much more. This gets the default settings for the debugbox:
Var I : TDebugParams;
Begin
I := GetDebugParams;
WriteLn(I.BackColor);
Writeln(I.Color);
WriteLn('The font name in the debug box is ' + I.Name);
End.
9.
procedure SetDebugParams(Params: TDebugParams);
Sets make-up settings for the next WriteLn to the debugbox.
This is just pure fun :):
Var I : TDebugParams;
Begin
I := GetDebugParams;
WriteLn(I.BackColor);
Writeln(I.Color);
WriteLn('The font name in the debug box is ' + I.Name);
WriteLn('Before');
I.BackColor := clBlack;
I.Color := clBlue;
I.Name := 'Comic Sans MS';
SetDebugParams(I);
WriteLn('After');
End.
10.
procedure AddToReport(s: string);
Adds a message to the report box.
This handy function adds a line to the ReportBox, which is beside the DebugBox, SRL Randoms Report is printed there ;):
Begin
AddToReport('lol!');
End.
^ Magic!!! ^
11.
procedure ClearReport;
Clears all messages sent to the report box
Does what it says ;).
Begin
AddToReport('this will be cleared?');
Wait(800);
ClearReport;
AddToReport(' it did :)');
Wait(800);
ClearReport;
End.
12.
procedure ChangeReportWidth(Width: Integer);
Changes the width of the report box to the given Width.
This procedure changes the width of the ReportBox, but it also in-directly influences the DebugBox ;).
Begin
ChangeReportWidth(320);
Wait(800);
ChangeReportWidth(420);
End.
II - End Note.
Thanks to everyone who reads my tutorials and comments, it's nice to see I get feedback, thanks :)
Table Of Contents
O - Intro.
I - DebugBox Functions/Procedures and Descriptions + Usage.
II - End Note.
O - Intro.
Hello, and welcome to my tutorial on SCAR's DebugBox functions. In this tutorial I will explain functions such as ClearDebug; and GetDebugLineCount. Knowing how to use this is vital. So you may ask: 'How does this relate to RuneScape?'. Well... Ever heard of a progress report? It shows you what you've done, and for how long in a Script, how would you edit it without printing it again?.
I - DebugBox Functions/Procedures and Descriptions.
The Debug functions of SCAR are:
procedure ClearDebug;
Clears debug box.
procedure DeleteDebugLine(Line: Integer);
Deletes a line from the debug box.
function GetDebugLineCount: Integer;
Get the number of lines in the debug box.
function GetDebugText: string;
Gets the text in the debugbox.
function GetDebugLine(Line: Integer): string;
Returns a certain given line of the debug box.
procedure ClearDebugLine(Line: Integer);
Clears a certain line of the debug box.
procedure ReplaceDebugLine(Line: Integer; s: string);
Replaces a certain line of the debug box.
function GetDebugParams: TDebugParams;
Retrieves the default make-up settings for the debugbox.
procedure SetDebugParams(Params: TDebugParams);
Sets make-up settings for the next WriteLn to the debugbox.
procedure AddToReport(s: string);
Adds a message to the report box.
procedure ClearReport;
Clears all messages sent to the report box
procedure ChangeReportWidth(Width: Integer);
Changes the width of the report box to the given Width.
I will break them down and we will analyze them step-by-step (Here's a smiley to keep you going on: :)).
1.
procedure ClearDebug;
Clears debug box.
It basically does what it says. Run this script:
Begin
WriteLn('jjjjjj');
Writeln('kkkk');
Wait(1000);
ClearDebug;
End.
2.
procedure DeleteDebugLine(Line: Integer);
Deletes a line from the debug box.
The first line is '0' then next line is '1' and so on.. Try this:
Begin
ClearDebug; //see that ;)
WriteLn('This line will be deleted');
Wait(800);
WriteLn('This Line wont');
Wait(800);
DeleteDebugLine(0);
Wait(800);
WriteLn('See ;)');
End.
3.
function GetDebugLineCount: Integer;
Get the number of lines in the debug box.
Run it...
Begin
ClearDebug;
WriteLn('ggg');
If Random(2) = 0 Then WriteLn('hhh');
WriteLn(IntToStr(GetDebugLineCount)+' lines in Debug Box');
End.
4.
function GetDebugText: string;
Gets the text in the debugbox.
It does what it says. Run this son:
Begin
ClearDebug; //;)
If Random(2) = 1 Then WriteLn('Roflmao')
Else WriteLn('lololol');
If GetDebugText = 'Roflmao' Then
WriteLn('We typed in Roflmao, that means that Random(2) was 1')
Else
WriteLn('We typed in lololol, that means that Random(2) was 0');
End.
5.
function GetDebugLine(Line: Integer): string;
Returns a certain given line of the debug box.
It sure does ;):
Begin
WriteLn('kjk');
Writeln('lkl');
WriteLn('Last Line was : '+GetDebugLine(GetDebugLineCount-1));
End.
^ Look at that, I used a function in a function ;). See how they relate to each other?
6.
procedure ClearDebugLine(Line: Integer);
Clears a certain line of the debug box.
Begin
WriteLn('this line will be deleted');
Wait(999);
WriteLn('this line will not');
Wait(999);
ClearDebugLine(GetDebugLineCount - 2);
End.
^ Function in a function again :spot: ^
7.
procedure ReplaceDebugLine(Line: Integer; s: string);
Replaces a certain line of the debug box.
This will replace a debug line, Remember what was said before of the progress report thing? This is your salvation! :eek:
Var I : ShortInt;
Begin
WriteLn('A simple countdown');
Wait(700);
For I := 60 Downto 0 Do
Begin
ReplaceDebugLine(GetDebugLineCount-1, IntToStr(I));
Wait(200);
End;
End.
See it doesn't print a mass amount? So you can replace Lines during run time.
8.
function GetDebugParams: TDebugParams;
Retrieves the default make-up settings for the debugbox.
In the 'New' Scar, you can modify the debugbox much more. This gets the default settings for the debugbox:
Var I : TDebugParams;
Begin
I := GetDebugParams;
WriteLn(I.BackColor);
Writeln(I.Color);
WriteLn('The font name in the debug box is ' + I.Name);
End.
9.
procedure SetDebugParams(Params: TDebugParams);
Sets make-up settings for the next WriteLn to the debugbox.
This is just pure fun :):
Var I : TDebugParams;
Begin
I := GetDebugParams;
WriteLn(I.BackColor);
Writeln(I.Color);
WriteLn('The font name in the debug box is ' + I.Name);
WriteLn('Before');
I.BackColor := clBlack;
I.Color := clBlue;
I.Name := 'Comic Sans MS';
SetDebugParams(I);
WriteLn('After');
End.
10.
procedure AddToReport(s: string);
Adds a message to the report box.
This handy function adds a line to the ReportBox, which is beside the DebugBox, SRL Randoms Report is printed there ;):
Begin
AddToReport('lol!');
End.
^ Magic!!! ^
11.
procedure ClearReport;
Clears all messages sent to the report box
Does what it says ;).
Begin
AddToReport('this will be cleared?');
Wait(800);
ClearReport;
AddToReport(' it did :)');
Wait(800);
ClearReport;
End.
12.
procedure ChangeReportWidth(Width: Integer);
Changes the width of the report box to the given Width.
This procedure changes the width of the ReportBox, but it also in-directly influences the DebugBox ;).
Begin
ChangeReportWidth(320);
Wait(800);
ChangeReportWidth(420);
End.
II - End Note.
Thanks to everyone who reads my tutorials and comments, it's nice to see I get feedback, thanks :)