SRL Archive - Outdated Tutorials

Create Your Own Includes!


Lacky

2007-10-08 18:22:23

Yes! That's right! Here is where I shall teach you to create your own includes in a step-by-step guide.

Well, firstly, you must have Scar. That is all that is required (depending on what you have in your include).

Now, you know how when you first load scar how it says this:

program new;
begin
end.
Change that "program" to "procedure" and the "." on the end of "end" to a semi-colon ( ; ).

It should look something like this then:

procedure new;
begin
end;
Now, you know how to script yes? (I am assuming you do if you want to create your own include(s) ).

Well, basically, you do exactly the same.

Example:

procedure Include;
begin
writeln ('I am Testing an Include.')
end;
Now, that is your include (except you change the writeln to the script or whatever function you want to do).

Now, you want to save your Include, save it to your Scar Includes Folder, which is generally "C:\Program Files\Scar 3.12\includes".

Now, open up scar again.

Now you once again see that it says:

program new;
begin
end.
Now remember that include you just made? Do you remember the name? Say you saved it as "Test Include", now remember how you include includes such as SRL? Just give the program name anything for now if you wish, or you can leave it blank/as new.

Just put in {.include Test Include.scar} for the includes.

Now, remember how to call upon your include? Like SRL? SetupSRL; Remember? Do exactly the same thing for your include. But one thing to remember, no matter what your include it, whether it has spaces in it or not, leave it as 1 word, like "TestInclude;" OK? Got that? This is what your end result should look like:

program TestInclude;
{.include Test Include.scar}
begin
TestInclude;
end.
Now whatever you made it do in the include will do it now here.

Congratulations! You have just created and successfully ran your first own include!

Note: James, remember that script idea where we compile all scripts into one huge script? We could put it as a procedure/include then call upon it in another script. It would reduce the compiling time heaps! - Just a thought.

Thanks!

Comments/Advice/Criticism/Bugs? - Please post!

Cheers

~Lacky

cbris

2007-10-08 19:50:21

Why would you want to do this. Thats why we have SRL!:D

Jackrawl

2007-10-08 20:52:02

lol well I never thought of that, I can't find anything you did wrong - good idea!

itSchRis917

2007-10-08 22:42:06

From: cbris
Why would you want to do this. Thats why we have SRL!:D


In case you wanted to make a function that had yet to be implemented into SRL, but at the same time, was wayy too long for you to put it in your script.. so you just distribute the include and the script..

harlz

2007-10-08 22:43:50

thnks m8, i never new it was so simple ;)

Lacky

2007-10-09 04:11:26

From: cbris
Why would you want to do this. Thats why we have SRL!:D

It's what itschris said and also so that basically, you can save scripts as includes, and call upon them depending on your script(s).

EDIT: Also, some things you can do for this, you can't do in SRL.

From: JackLKrawl
lol well I never thought of that, I can't find anything you did wrong - good idea!

Thankyou. :sasmokin:

From: itschris917
In case you wanted to make a function that had yet to be implemented into SRL, but at the same time, was wayy too long for you to put it in your script.. so you just distribute the include and the script..

Correct. And also if you have a big script and you want to cut it down a little, you can use this in your script and add it to were you were going to add it. Not that I have tried, but theoretically, it hsould work, you can even call upon an include/procedure, within a procedure. So basically it's the exact same thing except in the procedure you can then add stuff.
From: harlz
thnks m8, i never new it was so simple ;)

Thanks. I didn't know I could create them myself until a couple of days ago. :p:spot:

mat_de_b

2007-10-09 15:19:48

interesting way of showing how to do it, but i suppose handy, your bawsically just getting rid of the main loop and instead only including functions/rpocedures

ShowerThoughts

2007-10-09 15:33:20

he's not right if you put the scar file in the misc of srl include then you need to do
{.include srl/srl/misc/include.scar}
or
{.include srl/misc/include.scar}// not sure

Gabe

2007-10-09 15:57:50

Thanks for putting up a tut about this! I could use this maybe…

Lacky

2007-10-09 18:14:29

From: mat_de_b
interesting way of showing how to do it, but i suppose handy, your bawsically just getting rid of the main loop and instead only including functions/rpocedures

Is that good or bad?
From: hermpie
he's not right if you put the scar file in the misc of srl include then you need to do
{.include srl/srl/misc/include.scar}
or
{.include srl/misc/include.scar}// not sure

Who is not right? And what do you mean?
But if I can translate that correctly (:p), then the first one would be correct as there is no misc folder in the first srl folder. You have to go to includes, then srl, then srl, then misc.
From: Gabe
Thanks for putting up a tut about this! I could use this maybe…

No problems! I hope you do!

Aser

2007-10-09 23:34:56

I've been wondering about includes for a while now. Thank you for explaining how to make them

Lacky

2007-10-10 04:06:07

Wondering what about them? No problems. If you have any questions, please just ask.

yamaha317

2007-10-19 15:34:52

thanks now we can make some super scripts =)

WhoCares357

2007-10-24 20:54:14

This tutorial doesn't quite make it, because you haven't showed any examples of creating a procedure in the include and then using it int he script. Some people may get confused.

And long-time-no-see, Lacky.

Lacky

2007-10-25 04:15:36

Whocares357 commenting on one of my tuts? Wowzor! I am amazed and stunned!

Yeh, long time no see. Thanks again for teaching me some stuff about scar (mainly findcolor etc.)

I was going to use the movemouserandom script which you can open from the test script thing when you first open scar.

I'll add that in now. Wait, yes I did….I said change the program new; to procedure new; and just have a writeln('') procedure, then you put the name of the procedure in the script (new; ).

Did I mis-interpret you?

WhoCares357

2007-10-25 19:29:31

I only glanced over it lol. Didn't see the change; thought it was the same program New;. Sorry about that.

Lacky

2007-10-26 23:39:23

No problems. :p

What do you think about it now that I have already changed it?

WhoCares357

2007-10-27 11:03:33

9/10 ;)

It's short and sweet. The only thing I could advise is that you don't change program to procedure. Rather just add a procedure and leave program Name; there.

Other than that, it's good.

Lacky

2007-10-27 22:23:00

You can't have program for the includes (from what I have seen). If you look at the SetupSRL; include, you will see that it is just procedure SetupSRL;.

So, I am not sure…

Could this tutorial compare/match up to one of your? :p (I don't think so…(You are ub3r L33T :p))