Scripting in a nutshell: (of what I know so far)
% = Local Variable (ends once the function is ended)
$ = Global Variable (is used throughout the entire code)
True = 1 (
boolean)
False = 0 (
boolean)
Call a function:function()
{
//Write the code here
}
Use variables in a function:function(example)
{
%LocalVariable1 = "This is the string data being entered into %LocalVariable1!";
$GlobalVariable1 = "This is the string data being entered into $GlobalVariable1!";
echo("This is the string data being entered into the echo function!");
}
function(example2)
{
%localVariable1 = 2000;
%localVariable2 = "Local String Data!";
$globalVariable1 = 20;
$globalVariable2 = "Global String Data!";
echo(%localVariable1);
echo(%localVariable2);
echo($globalVariable1);
echo($globalVariable2);
}
This will echo:2000
Local String Data!
20
Global String Data!
Visual:To visually see this work, try adding a "TEST.cs" file into your Blockland folder under "config" using this code:
(edit with Notepad)
//TEST.cs
function test()
{
%localvar1 = 500;
%localvar2 = "Local Data Collected!";
$globalvar1 = 1000;
$globalvar2 = "Global Data Collected!";
echo(%localvar1);
echo(%localvar2);
echo($globalvar1);
echo($globalvar2);
}
Then start Blockland, and type [exec("config/test.cs");] into the console. It will then say "Executing TEST.cs." Then Test(); to start the test. *Note: Your Blockland folder must be the only folder before "config" for this to work! Otherwise, type in [exec("(folder)/config/test.cs");]
This should appear:

IF, IF THEN, & IF THEN IF conditional statements:IF - executes code if the IF condition is true
IF ELSE - executes code if the IF condition is false
IF ELSE IF - may not execute the ELSE statement even if the IF condition is false!
if(example3)
{
//Code is written here.
}
ifexample4)
if()
{
//Code is written here.
}
else
{
//Code is written here.
}
function(example5)
if()
{
//Code is written here.
}
else if()
{
//Code is written here.
}
Real example:if(3>10)
echo("IF statement executed and was true!");
else if(4>10)
echo("IF statement executed and was false!!");
else
echo("IF statement executed and the ELSE IF was false!");
In this example, the IF and ELSE IF statements are false, and only the echo after the ELSE statement is executed.
*Note: Brackets are not required when a statement only has one piece of code.
Operators:== - equals (only one equal sign can cause issues)
&& - and (both must be true!)
|| - or (only one must be true!)
NOT - converts the condition to the opposite it represents (True/False)
SPC - combines two values with a space
@ - combines two values together to form a new value
NL - Concatenates one value together with a new line to form a new value.
TAB - Concatenates one value together with a tab to form a new value.
$= - Evaluates whether string1 is equal to string2
!$= Evaluates whether string1 is not equal to string2.
*Note: The basic math symbols are also used. (+, -, *, /, =, >, <)
Notes:*Use // to make notes (does not affect the script)
*Scripts must be a
.cs file. To make a
.cs file simply create a
.txt file and edit the ending to
.cs!
*Another type of conditional statement is a switch statement, but I do not yet know what these do.
*To be a good script writer, you will need to know much more than this - these are just the basics.
For a better and much more in-depth tutorial, check out KINEX's Scripting Tutorials.
This was taken directly from his tutorials. (Packed together)