Okay, here we go. It's time to learn SCAR Includes!
Table of Contents:CODE
1. What is an include?
2. How to use an include?
3. What makes an include different from a program?
4. Why should I use includes?
5. FAQ
To ask any questions post them here.
If you want your question on the FAQ list do...
CODE
With no further ado I'll get this bad boy started!
1. What is an Include?Well, let's take an easy approach toa nswering this.
Includes are .txt or .scar made by scripters which allow other scripters to have easy access to common (and sometimes uncommon) functions and procedures, thereby shortening scripts, and lessening the effort it takes to create a script.
Includes make procedures and functions work in a script the same way as if you had copied and pasted them into your script.
In short:
“Includes” is a way to use procedures in other scripts so you don’t have to rewrite them youself.
2. How to use an Include?Follow this layout to use includes:
CODE
program IncludesExample;
{.include IncludeName.scar}
//rest of the script
One thing you must know, is that to use includes, they must be in either the same folder as the script you’re creating or the “Includes” folder in the Scar directory.
You do not need to have them there, but if you do not then you have to write out the whole destination after “.include “.
Example:
CODE
program IncludesExample2;
{.include "C:\MyFolder\SCARCodes\IncludesName.scar"}
//rest of the script
All includes must go after program and before anything else.
3. What makes an Include different from a Program?Good question, and a somewhat simple answer!
The MOST important thing is this:
Program
CODE
program aprogram;
{.include myinclude.txt}
var
i:integer;
Include
CODE
{.include someotherinclude.txt}
var
somevar:string;
In the example above you notice that includes do not have the
program line.
This is the biggest difference.
The other difference is that they don't have main loops.
I also showed one other thing there:
Yes, includes can "include" another include file just like they were a program file.
So you can make an include file to include all your include files and then just call that one include in your main code.
4. Why should I use Includes?Simple, if you code in SCAR you should know how tedious and boring it is to write the same long section of code over and over again, and even if you make a procedure for it in your script.
You
still have to write it again in your other scripts to use it in them.
It also can make your scripts shorter by large amounts. Some incldue procedures or functions make "simple" things even easier!
Knowing all of this if you aren't a coder and jsut the end-user, why would you want an include-made scripts?
Well, those scripts are more power on a per-line basis and you onyl need have but the includes on your computer to have the shortened codes and all the extra power the includes offer to coders at your fingertips.
A coder makes a 100 line code, you use it, it works decent.
An Include using coder makes a code jsut as long, you have the include, and the code works flawlessly.
Thats just an example, but it gets the point across, which would you rather have? I'd pick the second myself!
5. FAQFAQ:
CODE
Currently none! Submit some!
To post a FAQ question:
use the following format
CODE
I will post a reply AND add it to the FAQ list above.