Results 1 to 6 of 6

Thread: [Tut]Making your OWN includes![Tut]

  1. #1
    Join Date
    May 2007
    Location
    England
    Posts
    4,140
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default [Tut]Making your OWN includes![Tut]

    How To Make Your Own Includes

    By Richard

    In this tutorial, I am going to show you how to make your very own includes...Yes, just like the SRL includes. Sound difficult? Well read on and see what you think then!

    Yesterday, I was experimenting around with SCAR, as I do. I ended up wondering whether I could shorten a command, let's say
    SCAR Code:
    TerminateScript;
    to something like
    SCAR Code:
    TS;
    ...So I gave it a shot.


    When you are making a script, you normally include
    SCAR Code:
    SetupSRL;
    But do you know what it actually is? It's made up of many different commands:
    SCAR Code:
    procedure SetupSRL;
    begin
      MouseSpeed := 15;
      CheckHPFirst := True;
      Reincarnate := False;
      TalkAfterRandoms := False;
      RoadColor := 0;
      WaterColor := 0;
      BankColor := 0;
      LampSkill := 'mining';
      SetUpSRLReport;
      LoadCosineArrays;
      SymbolAccuracy:= 0.8;
      LoadNPCArray;
      LoadSRLBitMaps;
      SolveChatRandoms := True;
      SetupSRLAutoResponder;
      UseFindMod := True;
      LogoutOnMod := True;
      UseFindTrade := True;
      Screenshots := False;
      InitializeSRLLogFile;
      Writeln ('SRL Compiled in '+  IntToStr(GetTimeRunning) + ' msec');
    end;

    To do this, however, you need to add an include. Which one to be exact? The one that you see in most scripts:
    SCAR Code:
    {.include SRL/SRL.scar}
    If you open that file, you will see that SetupSRL is in there as a procedure. Getting the hang of it now?

    To make your own, you will need to do something like the above. To start you off, let's keep it simple.

    In this example, I am going to do what I said above; simplify
    SCAR Code:
    TerminateScript;
    Open up a new SCAR window. All you'll see right now is this:



    You don't need
    SCAR Code:
    program New;
    so change it to
    SCAR Code:
    procedure TS;
    If you don't do the above, it won't work. I hope you can see where I'm getting now.

    In this procedure, add
    SCAR Code:
    TerminateScript;
    So now we have:

    THE PICTURE DOESN'T WORK ANYMORE AND I CBA TO MAKE ANOTHER ONE. SORRY!

    You can add something else, like
    SCAR Code:
    WriteLn('Woo! Richard rules!');
    above
    SCAR Code:
    TerminateScript;
    I suggest you do something like that so that you can see it works. Save it as
    Code:
    TestInclude
    in the includes folder. This is your own include!



    Now open up another SCAR window. Because we have to include includes (duh!), below
    SCAR Code:
    program New;
    of the new SCAR, we add
    SCAR Code:
    {.include TestInclude.scar}
    Now just add
    SCAR Code:
    TS;
    in between
    SCAR Code:
    begin
    and
    SCAR Code:
    end.
    Now we have our second script as:



    Press and see what happens!

    I'll give a quick run down of what just happened, and how it works.

    You named a procedure "TS" in your include script, which is how you call upon it in your other script. You saved it as "TestInclude", in your includes folder, which is how you include it in your script.

    It really is as simple as that!

    Of course, in the file where you saved TS, you could have many more procedures and functions, to make it much more useful. If you are not sure what I mean, open up a .scar in the includes folder, and see what I mean.

    Please give feedback on how you think this tutorial is, and how it could be improved. Thanks!
    Last edited by Rich; 07-07-2009 at 12:15 AM.
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

  2. #2
    Join Date
    Feb 2007
    Location
    Estonia.
    Posts
    1,938
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Well explained, good.
    ~Eerik~

  3. #3
    Join Date
    Mar 2008
    Posts
    1,492
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Good, but give final results so people can compare/contrast, and give a screenshot of where to save it

  4. #4
    Join Date
    May 2007
    Location
    England
    Posts
    4,140
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default

    Thanks for the feedback guys.

    Sirlaughsalot, I have included some pictures of final scripts, but they weren't showing, so I changed the host and now they are. I'll add a picture of the file in a minute.
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

  5. #5
    Join Date
    Sep 2008
    Posts
    27
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    thanks for this it will help me when i get into scripting

  6. #6
    Join Date
    Feb 2007
    Location
    PA, USA
    Posts
    5,240
    Mentioned
    36 Post(s)
    Quoted
    496 Post(s)

    Default

    and this:
    SCAR Code:
    program old;
    procedure TS;
    begin
      TerminateScript;
    end;
    begin
    TS;
    end;

    works ROFL!!! use that instead of including if all you wana do is make TerminateScript shorter... ROFL!!!

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Making good smither but includes dont work
    By Bacaw in forum OSR Help
    Replies: 19
    Last Post: 04-16-2008, 05:25 AM
  2. Includes?
    By I Karma I in forum OSR Help
    Replies: 3
    Last Post: 12-08-2006, 10:31 AM
  3. SRL Includes...
    By Ransom in forum OSR Help
    Replies: 7
    Last Post: 11-09-2006, 10:06 PM

Posting Permissions

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