Live Help
Membership
You are a guest!

Register Today!

Log In
Reset Password
Game Network
Community Forum

MMO GAME LIST
World of Warcraft
Age of Conan
Anarchy Online
Archlord
Cabal Online
City of Heroes
City of Villains
Dark Age of Camelot
Darkfall Online
Diablo 2
Dungeons and Dragons
Dofus
Eve Online
Everquest 2
Final Fantasy XI
Guild Wars
Hero Online
Knight Online
Lineage 2
Lord of the Rings Online
Maple Story
Ragnarok Online
Runescape 2
Second Life
SilkRoad Online
Star Wars Galaxies
Tibia
Warhammer Online

FPS GAME LIST
Call of Duty
Combat Arms
Counter Strike
Halo

Welcome Guest ( Log In | Register )

> Begging into Incldues? Look No Further!, Come on in!
post Nov 17 2009, 11:20 PM
Post #1

lilwitte



SCAR Coder
Group Icon

Group: Elite Members
Posts: 318
Joined: 22-June 09
From: Deep in my Coding Cave. But don't feel bad! After all, it's on the darkside, and we have cookies!
Member No.: 934,937






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

FAQ:
CODE
Question Here



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. FAQ

FAQ:
CODE

Currently none! Submit some!


To post a FAQ question:
use the following format
CODE

FAQ:
CODE
Question Here



I will post a reply AND add it to the FAQ list above.



--------------------
SCAR Coder

DofusBaseV1
[||||||||||]

Want to make progress bars like me?
CODE
use this base one as an example!
[[color="#00FF00"]|[/color][color="#FF0000"]|||||||||[/color]]
Go to the top of the page
 
+Quote Post



Reply to this topicStart new topic

 


> Board Footer
Time is now: 22nd March 2010 - 06:22 AM