Scripting
in Game Editor
Scripting
is implemented using a script language compatible with C
language and allows a high level of development and flexibility.
The scripts are created using the Script Editor action.
The Script Editor supports syntax colorizing and automatic indentation
to increase your productivity. For those familiar with other programming
languages, the Script Editor is the equivalent of the Integrated
Development Environment or the IDE.
All Actor's Actions can
be called from scripts.
The
Script Editor Title Bar:
The
Script Editor's Title Bar shows the name of the Actor whose current
script is currently being written. It also displays the Event
that is recieving the script Actions.
The "L" feature at the right in the Script Title
Bar indicates the line that is currently being edited in the script
input window.
The
Script Editor Input Area:
The
gray rectangular area is the input area. Type the scripts here.
The
Script Editor Menu Bar:
The
Script Editor Menu Bar is located at the bottom of the Script
Editor input area. The Script Editor Menu Bar offers a number
of options to help in accessing the features that are available for use
within the Script Editor. An explanation of each Menu item is
as follows:
actors:
Displays
a listing of all of the Actors that have been created within a game. Left
mouse clicking on the name of an Actor will save typing by inserting the
Actor's name into the Script Editor input window.
variables/functions:
Displays
a listing of all of the variables and functions that are available for
use within the Script Editor's input window. For ease of use,
left mouse clicking automatically inserts the function or variable into
the Script Editor's input window.
When
selecting an Action or function
from the "variable/functions" list of the Script
Editor menu bar, the respective panel pops-up to allow auto completion
of the script.
Variables:
Think
of a variable as a container that holds a value. Selecting this option,
allows you to create both single and array variables to use in your game.
Selecting
this button will open the User Variables panel that allows you
to add, edit, or remove your variables. All variable attributes, excepting
the variable name, can be edited.
Add:
-
Name: Variable name. Variable names must begin with characters and
must be followed by characters, numbers or '_'. Script Function names
and Vars names are not already assigned. They cannot be used in the
"New Variable" Name. (Example: MyNewActor OK, but CreateActor
is Not OK)
- Variable type: Integer, real (float point number) or string (max
255 characters).
- Variable visibility: Global or Actor variable. Actor variables
extends the Actor struct. Thus,
an Actor variable can be accessed in the same way as the internal Actor
variables. For example, use local Actor variables to make things like
"Player Power".
- Array: You can create global array variables with this option.
Your index will be between zero and size.
- Save group: If you want to
save or load this variable with saveVars
and loadVars functions, set the group
were this variable will be saved here
.
Global
Code:
Use
the Global Code Editor to freely add any 'C' code (arrays,
structs, and functions). The sky is the limit when you use
this Editor but you should have your feet well grounded in the
C Programming Language in order to use the Global Editor
effectively. Your knowledge of the 'C' language will serve you
well here.
Global
Code can be accessed by any script.
After
entering your code, enter a name for it and click
on the "Add" button.
Edit a code by selecting it in "Choose" list. After completing
the necessary changes, click on
the "Add" button.
Use the "Remove" button to delete a Global Code script.
Use the "File" button pop-up panel to save or load Global
Code scripts.
Note:
changing any of the internal Actor's variables (x, y, xscreen, yscreen,
...) has no effect on the Global Code.
To use the special actors creator or parent, put a in the caller Script
Editor (like a comment: //creator)
File:
The
File option gives you the ability to load a previously saved script or
to save a current script in a external file.
|