Results 1 to 14 of 14

Thread: Understanding SCAR's Ouput Functions

  1. #1
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default Understanding SCAR's Ouput Functions

    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:
    PHP Code:
    procedure ClearDebug;
    Clears debug box.

    procedure DeleteDebugLine(LineInteger);
    Deletes a line from the debug box.

    function 
    GetDebugLineCountInteger;
    Get the number of lines in the debug box.

    function 
    GetDebugTextstring;
    Gets the text in the debugbox.

    function 
    GetDebugLine(LineInteger): string;
    Returns a certain given line of the debug box.

    procedure ClearDebugLine(LineInteger);
    Clears a certain line of the debug box.

    procedure ReplaceDebugLine(LineIntegersstring);
    Replaces a certain line of the debug box.

    function 
    GetDebugParamsTDebugParams;
    Retrieves the default make-up settings for the debugbox.

    procedure SetDebugParams(ParamsTDebugParams);
    Sets make-up settings for the next WriteLn to the debugbox.

    procedure AddToReport(sstring);
    Adds a message to the report box.

    procedure ClearReport;
    Clears all messages sent to the report box

    procedure ChangeReportWidth
    (WidthInteger);
    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.
    PHP Code:
    procedure ClearDebug;
    Clears debug box
    It basically does what it says. Run this script:
    SCAR Code:
    Begin
      WriteLn('jjjjjj');
      Writeln('kkkk');
      Wait(1000);
      ClearDebug;
    End.


    2.
    PHP Code:
    procedure DeleteDebugLine(LineInteger);
    Deletes a line from the debug box
    The first line is '0' then next line is '1' and so on.. Try this:
    SCAR Code:
    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.
    PHP Code:
    function GetDebugLineCountInteger;
    Get the number of lines in the debug box
    Run it...
    SCAR Code:
    Begin
      ClearDebug;
      WriteLn('ggg');
      If Random(2) = 0 Then WriteLn('hhh');
      WriteLn(IntToStr(GetDebugLineCount)+' lines in Debug Box');
    End.


    4.
    PHP Code:
    function GetDebugTextstring;
    Gets the text in the debugbox
    It does what it says. Run this son:
    SCAR Code:
    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.
    PHP Code:
    function GetDebugLine(LineInteger): string;
    Returns a certain given line of the debug box
    It sure does :
    SCAR Code:
    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.
    PHP Code:
    procedure ClearDebugLine(LineInteger);
    Clears a certain line of the debug box
    SCAR Code:
    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 ^


    7.
    PHP Code:
    procedure ReplaceDebugLine(LineIntegersstring);
    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!
    SCAR Code:
    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.
    PHP Code:
    function GetDebugParamsTDebugParams;
    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:
    SCAR Code:
    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.
    PHP Code:
    procedure SetDebugParams(ParamsTDebugParams);
    Sets make-up settings for the next WriteLn to the debugbox
    This is just pure fun :
    SCAR Code:
    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.
    PHP Code:
    procedure AddToReport(sstring);
    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 :

    SCAR Code:
    Begin
      AddToReport('lol!');
    End.
    ^ Magic!!! ^


    11.
    PHP Code:
    procedure ClearReport;
    Clears all messages sent to the report box 
    Does what it says .

    SCAR Code:
    Begin
      AddToReport('this will be cleared?');
      Wait(800);
      ClearReport;
      AddToReport(' it did :)');
      Wait(800);
      ClearReport;
    End.


    12.
    PHP Code:
    procedure ChangeReportWidth(WidthInteger);
    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 .

    SCAR Code:
    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
    Last edited by Naum; 07-21-2009 at 04:54 AM.

  2. #2
    Join Date
    May 2007
    Location
    UK
    Posts
    4,007
    Mentioned
    1 Post(s)
    Quoted
    12 Post(s)

    Default

    You are an absolute machine!
    Nice tut!

    T~M

  3. #3
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    nice tut

    but what about addreport, or clearreport?

    it adds text to the report box, where your progress reports should go
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  4. #4
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    PHP Code:
    procedure AddToReport(sstring);
    Adds a message to the report box.

    procedure ClearReport;
    Clears all messages sent to the report box

    procedure ChangeReportWidth
    (WidthInteger);
    Changes the width of the report box to the given Width

  5. #5
    Join Date
    Dec 2008
    Location
    In a galaxy far, far away...
    Posts
    584
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Nice Nauman ~ As if you do not have enough rep already ahah j/k



    ~NS

  6. #6
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by Da 0wner View Post
    PHP Code:
    procedure AddToReport(sstring);
    Adds a message to the report box.

    procedure ClearReport;
    Clears all messages sent to the report box

    procedure ChangeReportWidth
    (WidthInteger);
    Changes the width of the report box to the given Width
    Dude, that's in another section in the SCAR manual, but I will add it .

    Thanks for all the other comments guyz!

    Lol @ Nad
    Last edited by Naum; 07-21-2009 at 05:07 AM.

  7. #7
    Join Date
    Dec 2007
    Location
    192.168.1.73
    Posts
    2,439
    Mentioned
    6 Post(s)
    Quoted
    119 Post(s)

    Default

    Reckon you could display all the different params in the TDebugParams type?

  8. #8
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    BackColor (the background)
    Color (the text color)
    Style (the styles)
    Name (not sure what that is )

    Style is an array of fontstyles.

    i.e
    SCAR Code:
    TDP.Style := [fsBold, fsItalic]; //etc.
    Last edited by Da 0wner; 07-21-2009 at 05:29 AM.

  9. #9
    Join Date
    Dec 2007
    Location
    192.168.1.73
    Posts
    2,439
    Mentioned
    6 Post(s)
    Quoted
    119 Post(s)

    Default

    Quote Originally Posted by Da 0wner View Post
    BackColor (the background)
    Color (the text color)
    Font (the font)
    Name (not sure what that is )

    Font is an array of fontstyles.

    i.e
    SCAR Code:
    TDP.Font := [fsBold, fsItalic]; //etc.
    I thought font was its own type...

    Var
    i: TDebugParams;

    begin
    i.font.color := x;
    i.font.name := y;
    end.

  10. #10
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Style I meant .

  11. #11
    Join Date
    Feb 2009
    Location
    Hungary (GMT + 1)
    Posts
    1,774
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Name is like Times New Roman, Arial and others. Fonts here while you are posting. I have looked up them here how they look like when I was trying this. Before this tut :/. But I forgot harder what I learn myself. Still learning from tuts is much easier.

  12. #12
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Aha, that's what I was missing . Thanks.

  13. #13
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by Richard View Post
    I thought font was its own type...

    Var
    i: TDebugParams;

    begin
    i.font.color := x;
    i.font.name := y;
    end.
    Quote Originally Posted by Da 0wner View Post
    Style I meant .
    Quote Originally Posted by Sabzi View Post
    Name is like Times New Roman, Arial and others. Fonts here while you are posting. I have looked up them here how they look like when I was trying this. Before this tut :/. But I forgot harder what I learn myself. Still learning from tuts is much easier.
    Quote Originally Posted by Da 0wner View Post
    Aha, that's what I was missing . Thanks.
    Thanks . I'll add the Debug thing to the Tut, just remember in Overwrite.scar, this function is used.

  14. #14
    Join Date
    Sep 2007
    Location
    Australia, NSW
    Posts
    934
    Mentioned
    6 Post(s)
    Quoted
    145 Post(s)

    Default

    This is cool. I never knew you could delete lines in the debug! I'm going to use this

    INACTIVE
    How-to: Make S.M.A.R.T. less laggy

    Sell me your Maple Shieldbows (u)! Up to 95gp ea!

    My Scripts:
    Ivy Chopper Ultra [RS3] | Fantastic Fletcher [RS3]
    99 x78 | 99 x10 | 99 x2 | 99 x12


    Use the REPORT tags when posting progress reports to make life easier (:
    [REPORT]Put progress report in here![/REPORT]

    Super Savvy Smither V1.06Cool Classy Cooker V1.02 [EoC]

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •