(Edited)
This is designed to be a basic tutorial, showing scripters the importance of making use of constant switches (Constant Variables which control a script or multiple scripts) within a script..
This is a very trivial tutorial, and would require basic knowledge of scripting.
(NOTE: Variable would be replaced with one of the following: int / string / float)
Script A) (No Constant Switches)
void main()
{
//A Bunch of code will go here..
variable a; //May Change
variable b; //Does Not Change
//Still yet more code may go here...
}
Script
The Constant Switches go above the #include "scriptname" & void main()
(Here is an example of making use of a constant as a switch (the term switch is being used here to represent constant that controls the outcome of a script)
//Set the constant below to TRUE if you want ______ to happen..
constant variable VARIABLE_X = FALSE; //default = FALSE (don't do this)
#include "somescript"
void main()
{
//A Bunch of code will go here..
variable a; //May Change
variable b =
VARIABLE_X; //The Constant Unchanging Variable Above.. (VARIABLE_X = is the name)
//(another example of use)
if(VARIABLE_X==TRUE)
{
// Then do something here..
}
//Still yet more code may go here...
}
If you can see the importance of the Constant Switches, which is nothing more than a control for a script, then you will understand that Constant Switches will not only save yourself time later if you want to come back and change the script (& most likely will), but they also give others looking at your script greater control over your script, for one builder may like it one way, while another may like it another way, we therefore can avoid dissagreements by making controls within a script (Constant Switches) that effect how the scripts works..
I love Constant Switches, because I try to build for the community, I try to include these control switches when I can..
And they are absolutely fabulous for Template Scripts (Script you will use a lot)
Hope someone enjoyed this..
Modifié par Genisys, 06 septembre 2010 - 05:59 .