Results 1 to 14 of 14

Thread: SRLProgressReport

  1. #1
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default SRLProgressReport

    Also take the time to check out the Player Report!


    PHP Code:
    [ =============================== ]
    Extremely Long Test Script 1.00 ]
    [        
    by Rasta Magician        ]
    [ =============================== ]
    Fishies123                    ]
    LocationFalador               ]
    ActiveFalse                   ]
    [ =============================== ]
    Extremely Long Test Script 1.00 ]
    [ =============================== ] 
    SCAR Code:
    const
      ResultDebugBox  = 0;
      ResultReportBox = 1;
      ResultString    = 2;

    Function SRLProgressReport(ResultType:integer; ScriptName, ScriptAuthor, ScriptVersion: String;
                               VarNames: TStringArray; VarValues: TVariantArray ): Variant;
    var
      TSA     : TStringArray;
      s       : string;
      i, i2   : integer;
    begin
      if length(VarNames) <> Length(VarValues) then
      begin
        SRL_Warn('SRLProgressReport', 'VarNames and VarValues must be the same length', warn_AllVersions);
        exit;
      end;
      SetLength(TSA, 3 + Length(VarNames) + 4);
     
      TSA[0] := '=';
      TSA[1] := Capitalize(ScriptName)+' '+ScriptVersion;
      TSA[2] := 'by '+ScriptAuthor;
      TSA[3] := '=';
     
      i2 := 3 + Length(VarNames);
      for i:= 4 to i2 do
      begin
        s := VarValues[i-4];
        TSA[i] := Capitalize(VarNames[i-4])+': '+ Capitalize(s);
      end;

      TSA[i2+1]   := '=';
      TSA[i2+2] := Capitalize(ScriptName)+' '+ScriptVersion;
      TSA[i2+3] := '=';
     
      i2 := 0;
      for i:= 0 to High(TSA) do
        i2 := Max(i2, Length(TSA[i]));

      TSA[0] := Replicate('=', i2);
      TSA[3] := TSA[0];
      TSA[High(TSA)-2] := TSA[0];
      TSA[High(TSA)] := TSA[0];

      TSA[2] := Replicate(' ', round((i2 - Length(TSA[2]))/2) ) + TSA[2]; //centering by ScriptAuthor
     
      for i:= 0 to High(TSA) do
        case ResultType of
          ResultDebugBox  : writeln     ('[ '+Padr(TSA[i], i2)+' ]');
          ResultReportBox : AddToReport ('[ '+Padr(TSA[i], i2)+' ]');
          ResultString    : Result := Result + '[ '+Padr(TSA[i], i2)+' ]' + chr(13);
          else SRL_Warn('SRLProgressReport', 'Invalid Result Type', warn_AllVersions);
        end;
      if not ResultType = ResultString then Result := true;
     {
      [ ========================= ]
      [ ScriptName ScriptVersion  ]
      [     by ScriptAuthor       ]
      [ ========================= ]
      [ VarName[0] : VarValues[0] ]
      [ VarName[1] : VarValues[1] ]
      [ VarName[2] : VarValues[2] ]
      [ VarName[3] : VarValues[3] ]
      [ VarName[4] : VarValues[4] ]
      [ ========================= ]
      [ ScriptName ScriptVersion  ]
      [ ========================= ]
     }

     
    end;

    if you wish to test for yourself
    SCAR Code:
    program new;
    {.include srl/srl.scar}

    const
      ResultDebugBox  = 0;
      ResultReportBox = 1;
      ResultString    = 2;

    Function SRLProgressReport(ResultType:integer; ScriptName, ScriptAuthor, ScriptVersion: String;
                               VarNames: TStringArray; VarValues: TVariantArray ): Variant;
    var
      TSA     : TStringArray;
      s       : string;
      i, i2   : integer;
    begin
      if length(VarNames) <> Length(VarValues) then
      begin
        SRL_Warn('SRLProgressReport', 'VarNames and VarValues must be the same length', warn_AllVersions);
        exit;
      end;
      SetLength(TSA, 3 + Length(VarNames) + 4);
     
      TSA[0] := '=';
      TSA[1] := Capitalize(ScriptName)+' '+ScriptVersion;
      TSA[2] := 'by '+ScriptAuthor;
      TSA[3] := '=';
     
      i2 := 3 + Length(VarNames);
      for i:= 4 to i2 do
      begin
        s := VarValues[i-4];
        TSA[i] := Capitalize(VarNames[i-4])+': '+ Capitalize(s);
      end;

      TSA[i2+1]   := '=';
      TSA[i2+2] := Capitalize(ScriptName)+' '+ScriptVersion;
      TSA[i2+3] := '=';
     
      i2 := 0;
      for i:= 0 to High(TSA) do
        i2 := Max(i2, Length(TSA[i]));

      TSA[0] := Replicate('=', i2);
      TSA[3] := TSA[0];
      TSA[High(TSA)-2] := TSA[0];
      TSA[High(TSA)] := TSA[0];

      TSA[2] := Replicate(' ', round((i2 - Length(TSA[2]))/2) ) + TSA[2]; //centering by ScriptAuthor
     
      for i:= 0 to High(TSA) do
        case ResultType of
          ResultDebugBox  : writeln     ('[ '+Padr(TSA[i], i2)+' ]');
          ResultReportBox : AddToReport ('[ '+Padr(TSA[i], i2)+' ]');
          ResultString    : Result := Result + '[ '+Padr(TSA[i], i2)+' ]' + chr(13);
          else SRL_Warn('SRLProgressReport', 'Invalid Result Type', warn_AllVersions);
        end;
      if not ResultType = ResultString then Result := true;
     {
      [ ========================= ]
      [ ScriptName ScriptVersion  ]
      [     by ScriptAuthor       ]
      [ ========================= ]
      [ VarName[0] : VarValues[0] ]
      [ VarName[1] : VarValues[1] ]
      [ VarName[2] : VarValues[2] ]
      [ VarName[3] : VarValues[3] ]
      [ VarName[4] : VarValues[4] ]
      [ ========================= ]
      [ ScriptName ScriptVersion  ]
      [ ========================= ]
     }

     
    end;

    begin
      ClearDebug;
      SRLProgressReport(ResultDebugBox, 'Extremely long test script', 'Rasta Magician', '1.00', ['Fishies', 'location', 'active'], [123, 'falador', false]);
    end.


    so what do you guys think? This idea is not originally mine, but i guess i just decided to do it and post.

    ~RM
    Last edited by Sir R. M8gic1an; 06-10-2009 at 06:40 AM.

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

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

    Default

    Sweet
    Cheers RM

    T~M

  3. #3
    Join Date
    Jul 2008
    Location
    England
    Posts
    763
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    MylesMadness already made one of these.
    lol

  4. #4
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    Quote Originally Posted by Quickmarch View Post
    MylesMadness already made one of these.
    that's what i meant by it's not originally my idea. link please?

    ~RM

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

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

  6. #6
    Join Date
    Mar 2007
    Location
    <3
    Posts
    2,683
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Da 0wner View Post
    No offence to Mylessmadness, but RM took the concept to the next level.

    Nice work RM

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

    Default

    Yeah, that one is kind of simple .

    Edit: Now make one to make multi player progress reports (h).

  8. #8
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    Quote Originally Posted by Da 0wner View Post
    Yeah, that one is kind of simple .

    Edit: Now make one to make multi player progress reports (h).
    that's what i am currently doing wait until you see my final project for this.

    ~RM

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

  9. #9
    Join Date
    Dec 2008
    Posts
    2,813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Rasta Magician View Post
    that's what i am currently doing wait until you see my final project for this.

    ~RM
    When will it be done? ^^

  10. #10
    Join Date
    Feb 2007
    Location
    Access Violation at 0x00000000
    Posts
    2,865
    Mentioned
    3 Post(s)
    Quoted
    18 Post(s)

    Default

    imo this > milesmadness' one.
    Ce ne sont que des gueux


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

    Default

    Quote Originally Posted by Floor66 View Post
    imo this > milesmadness' one.
    Alright it has been said, no need to flame MM
    lol

    T~M

  12. #12
    Join Date
    Feb 2007
    Location
    Access Violation at 0x00000000
    Posts
    2,865
    Mentioned
    3 Post(s)
    Quoted
    18 Post(s)

    Default

    That wasn't a flame xD
    Flaming is...
    omg omg myles' one really S U C K E D!@@@ omg omg hes sooooooooo bad <-- don't mean any of that.
    Ce ne sont que des gueux


  13. #13
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    Quote Originally Posted by 99_ View Post
    When will it be done? ^^
    http://www.villavu.com/forum/showthread.php?t=46363



    ~RM

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

  14. #14
    Join Date
    Apr 2007
    Location
    Perth, Australia
    Posts
    3,926
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    OMG:

    1. You're taking the fun out of scripting!
    2. You're supposed to be inactive.

    Well done though.

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
  •