You are on page 1of 7

ExoNet Scripting Tutorial

Contents:
i. Introduction
ii. A few of the basics you should know
iii. Lesson1: Variables: Declaration
iv. Lesson1: Variables: Assigning values
v. Lesson1: Variables: randomizing numbers
vi. Lesson2: Printing: Returning values
vii. Lesson2: Popping: Returning values
viii. Lesson3: Comments: Making comments.
ix. Lesson4: Free Functions: Input
x. Lesson4: Free Functions: Printing
xi. Lesson4: Free Functions: popup
xii. Lesson4: Free Functions: GoTo / GoToX
xiii. Lesson4: Free Functions: Calc
xiv. Lesson4: Comparison: Ifdo
xv. Lesson5: Classes: Importance
xvi. Lesson5: Classes: Creating classes
xvii. Lesson6: Debug Tools: Watches
xviii. Lesson6: Debug Tools: Expression Evaluator
xix. Lesson6: Debug Tools: Document Viewer
xx. Lesson6: Debug Tools: varPreview
xxi. Lesson6: Debug Tools: Tool Finder
xxii. Lesson7: Keywords: Documented words
Change Notes
The following guide applies to ExoNet 12.0 (Yeoakatarina and Xarm). This guide is not
valid for older version of the scripting language due to syntax changes and removal of
unused features. If you require documentation for earlier versions of ExoNet Scripts,
please contact us and we will get back to you if any support is available for your
required version.
Introduction
ExoNet Scripts are a great way to learn how to program because of its near human-
language capability and short-hand support. For example, the If statement (or in this
case the Ifdo statement) can be quite a hassle, and quite long, but with ExoNet
Scripting, you can carry out an If comparison using just one line. It has been
recommended by many of my beta testers because of its easiness to learn. This helps
because if you learn just one programming language, all the other ones come easily as
all that changes in programming languages is the syntax which you can easily set
yourself to remember.
One last thing! It is recommended that you avoid using common programming
concept (if you are already a programmer) as this programming and scripting
language does not support all major concepts (for simplicity). In addition to that,
ExoNet contains some new standards and programming concepts which has been
created to make learning a new language quick and easy.
A few of the basic you should know
1. ExoScript (AKA ExoNet Script) takes capitalization and whitespaces very seriously.
2. By default ExoNet IDE will syntax highlight every documented words IF it is spelt
correctly.
3. ExoNet contains managed and unmanaged code which is compiled into IL via
the embedded IOE. If you get the errors {IOE.Exception; Step Kill}, you must fix the
package by launching the setup file again.
4. ExoNet uses superficial keywords which can override the effects of non-
superficial keywords. (Dont worry too much about this for now, we will go
through it later)
5. ExoNet makes use of global variables only as it is unmanaged via IDE.
6. ExoNet, to recreate a variable (or initialize) simply use 'Recast' instead of 'Cast'
7. If a variable is created under the name of an already existing variable, the
dominant variable value will be set for both variables. (The new value is
dominant). This is not recommended as it can cause memory errors at runtime.
Lesson1: Variables: Declaration
We will start off by creating a variable. A variable is a storage location reserved by your
program using an associated symbolic name (also known as the identifier). This variable
name is the usual way to reference the stored value; this separation of name and
content allows the name to be used independently of the exact information it
represents. The identifier in computer source code can be bound to a value during run
time, and the value of the variable may thus change during the course of program
execution. Variables in programming may not directly correspond to the concept of
variables in mathematics. In most programming language, variable declaration
requires you to define the variable data type (A data type is a classification identifying
one of various types of data, such as real, integer or Boolean, that determines the
possible values for that type; the operations that can be done on values of that type;
the meaning of the data; and the way values of that type can be stored.) however on
ExoNet, the data type is by default what is called multiversal (in exo terms). This means
that the data type will change to suit the variable content as soon as the variable
content changes.
To create a Variable in ExoNet you simply type cast followed by the identifier. An
example is shown below:
Cast myname
The above statement simply creates a variable under the name of myname. Notice
how cast is written in a capital C. This is important as the IDE can only translate
documented words. (Dont worry we will learn more about it later).
Simple rules to remember about variable naming conventions:
1. Variable name should not contain white spaces.
2. Variable name should not contain special characters except underscores.
Throughout your application or script, you are bound to require a variable at some
stage. So to avoid errors, these rules should be followed.
Lesson1: Variable: Assigning values
After creating a variable, it is certain that you will need to assign or store a value into it.
Right? But how do you do that? The answer can be very simple or very hard depending
on whether you are storing a known value or an unknown value which is presented to
the program at runtime when the user enters a value. If you are storing a known value,
you can simply use:
myname = Steve Jobs
However if you are adding an unknown value which the user of your program will enter,
then you can use the input function we will be going through in Lesson4.
So far it has been easy right?
Remember data-types? It was briefly introduced to you in Lesson1: Variable:
Declaration chapter. Well it is back again. When you assigned Steve Jobs to the
myname variable, the variable data type changed to what is called a string. A string
is traditionally a sequence of characters, either as a literal constant or as some kind of
variable. (Dont worry too much about this for now. We will go over this again).
To assign a numerical data-type, simply type the following:
Cast myVariable
myVariable = 9
You see how the value didnt have any quotation marks? This is because quotation
marks only go around string values and not Numerical values. It is the same for object,
quotation marks are not required for data-type object. Object is rarely used as a data-
type in non OOP programming language (object oriented programming). However, it
can still be used in ExoNet to store data such as numbers, letters and string. Noting well
that special characters have to be inside quotes when being assigned to a variable.
When you are trying to add data from another variable (carrying data), you can simply
add the variable name after the value which you want to store in the variable.
myVariable = Apples are @niceWord
If the variable niceWord contains value fantastic, then the above statement will
store Apples are fantastic to the variable myVariable.
Now you will be assigning other data types to more variable, so here is your Task1.
Task1:
- Create 3 more variables called myStr, myNum, and myObj.
- Assign a string value to myStr remembering that all strings are in between
quotation marks.
- Assign a numerical value to myNum
- Assign an object to myObj
Lesson2: Printing: Returning values
Okay so you have been creating variables and storing information/data to it. Now what
do you do with that data? Well, you could do many things with it, but for now, lets
return it to the users screen by using the print function. This can be done the following
way:
print(hello world)
This simply returns the string, Hello world to the users screen. Why dont you try it?
Simply type in the example and press the run button on the IDE. In the output box on
the bottom of the IDE, you should see hello world. As you will soon realize, this doesnt
print out what is in the variable. So to do this, you must add a reference to the variable
using its identifier.
print(Hello, my name is @myname)
You see how the above statement has an @ sign in front of the variable name? This
tells the compiler that the word that comes after the string is a variable and not an
object or number. Also note how there is no space between @ and myname. Now
enter this example and click the run button again. This time you should see something
like Hello, my name is Steve Jobs.
Other programming language most-probably has a concatenation character which
allows them to merge multiple data (of multiple types) together like we did above, with
the string and variable string. However, ExoNet does not have this for reliability and
security reasons, due to the fact variable and object are configured using unmanaged
code.
When printing a concatenated sentence, the order of which the string comes within
the sentence makes no difference. For example, if you were to concat a string and a
variable number, you could put them in any order as long as the variable starts with an
@ sign. Here is an example below:
print(when I was @age I lived in @areaName)
Using the example above, if variable age contained value 9 and variable
areaName contained value California, the statement would print out when I was 9 I
lived in California.
Lesson2: Popping: Returning Values
Returning values to the user using the popup function uses the same concept as when
youre returning value through the print function. The only difference is in the way the
value is returned. During printing, the value is displayed on the output window, however
when you are showing a popup, the value/data is displayed on a message box which
pops-up when the popup function is called.
Lesson3: Comments: Making comments
When you read your code again in six months from now, you want to understand what
your code does, and why. For this, you can add comments, i.e. text which is ignored by
ExoNet Compilers when it executes and/or compiles the script.
//This is a comment and will be ignored by IOE;
Notice how the comment start with a // and ends with a ;. This tells the compiler
when to start ignoring and when to stop ignoring. Also, all comments are single lined.
This means that if you want to write more than one line or your comment finished on
another line, you must start and end each line. Example:
//This multi-lined comment which ends on another;
//line will be ignored by IOE;
When reading scripts written by other people, you will often find the concept of
commented-out code. This is code that is pretended to be a comment so that it is not
executed.
Cast appletName
//appletName = runme;
Uncommented code that is written on the same line as a commented code is also
ignored at runtime.
Lesson4: Free Functions: input
The input function is a very handy tool, especially when you want to prompt your user.

You might also like