Results 1 to 9 of 9

Thread: Make your own Scar

  1. #1
    Join Date
    May 2009
    Posts
    799
    Mentioned
    2 Post(s)
    Quoted
    16 Post(s)

    Default Make your own Scar

    Alright, this is supposed to be a really short tutorial. Anyways, if you don't understand anything, feel free to ask.

    Intro
    Scar uses Pascal Script, which was invented by "RemObjects". Special functions in scar are additions to the basic syntax of Pascal Script.

    Requirements
    • Delphi 7 or highher
    • Pascal Script Installed


    Step 1
    a) Open Up Delphi
    b) Create a new Project

    Step 2
    a) Find the PsScript Component and drop it onto your form. ( Additionally add "uPSComponent" to your uses list and create a PsScript Object).

    Step 3
    a) Add two richedit fields to your form.
    b) name one Debug and one Code
    c) Add A Button

    Step 4
    a) Add this code to the onclick event of your button.
    delphi Code:
    procedure TForm1.Button1Click(Sender: TObject);
    var
      i:integer; //var for counting
      Messages: string; //Messages collected by pascal script
      compiled: boolean; // Script compiled or not ?
    begin

      // PsScript1.Script.Text is the script that you want to execute for example "var x:integer; begin end." ( Same as in scar ;) ... )
      PSScript1.Script.Text := Code.Text;

      //Compile the script and return success to "Compiled"
      Compiled := PSScript1.Compile;

      //Put all compiler Messages in "Messages"
      for i := 0 to PSScript1.CompilerMessageCount -1 do
        Messages := Messages +
                    PSScript1.CompilerMessages[i].MessageToString +
                    #13#10;

      //If compiled succesfully
      if Compiled then
        Messages := Messages + 'Succesfully compiled'#13#10;

      //Adding messages to the debug box
      Debug.Text := 'Compiled Script: '#13#10+Messages;

      //Show "Succesfully Executed" if there were no errors, otherwise, Popup a message.
      if Compiled then begin
        if PSScript1.Execute then
          debug.text := debug.text + #13#10 + 'Succesfully Executed'
        else
          ShowMessage('Error while executing script: '+
                      PSScript1.ExecErrorToString);

      end;
    end;

    Step 5
    Adding Own Functions is simple !
    a) In the OnCompile Event of your PSScript1 Object add:
    PsScript1.AddFunction(@ShowMessage,'procedure MyMessage(const Msg: string)');
    This adds the ShowMessage Function from Delphi to our "scar" ;].


    Alright, you're done. Now Add Tons of functions and features, and you got scar ... or simba.



    ~caused
    Last edited by caused; 02-25-2010 at 01:45 AM.

  2. #2
    Join Date
    Jan 2008
    Location
    NC, USA.
    Posts
    4,429
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Very cool! Great guide.
    Quote Originally Posted by irc
    [00:55:29] < Guest3097> I lol at how BenLand100 has become noidea
    [01:07:40] <@BenLand100> i'm not noidea i'm
    [01:07:44] -!- BenLand100 is now known as BenLand42-
    [01:07:46] <@BenLand42-> shit
    [01:07:49] -!- BenLand42- is now known as BenLand420
    [01:07:50] <@BenLand420> YEA

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

    Default

    omg. epic

    i'll give this a go
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

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

    Default

    Really interesting read. Thanks

    ~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 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    Awesome
    Neat tutorial dude

  6. #6
    Join Date
    May 2009
    Posts
    799
    Mentioned
    2 Post(s)
    Quoted
    16 Post(s)

    Default

    Glad you like it :]..

    It should work exactly the same on Lazarus btw ...

    ~caused

  7. #7
    Join Date
    Nov 2007
    Location
    46696E6C616E64
    Posts
    3,069
    Mentioned
    44 Post(s)
    Quoted
    302 Post(s)

    Default

    Great tutorial! Thanks for this
    There used to be something meaningful here.

  8. #8
    Join Date
    Nov 2009
    Posts
    471
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    if this works then that is nice but freddy will not be happy

  9. #9
    Join Date
    Nov 2009
    Posts
    471
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    project1.exe cant run commands, only begin and end.

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
  •