Game Editor - the easy game design software.
 

  Script Reference

Home  
 
Getting Started  
Scripting  
 
FAQs  
Script Editor   Script Reference
   
 


Script Reference

Especial Actors

collide: The collision actor if Event Actor is in a collision event. (Name in actions: "Collide Actor")
parent: Event Actor's parent, if exists. (Name in actions: "Parent Actor")
creator: Event Actor's creator, if Event Actor has been created in some "Create Actor" action. (Name in actions: "Creator Actor")

Variables

x: x is the Actor's horizontal coordinate. The x position is relative to the parent. If the actor has no parent, the x coordinate will be relative to the game.

Script Editor Syntax:
In current actor:

x=x+5;
or
x += 5;
In other actor:
MyActor.x += 5;

y: y is the Actor's vertical coordinate. The y position is relative to the parent. If the actor has no parent, the y coordinate will be relative to the game.

Script Editor Syntax:
On Key Down Event
y=y+5;
or
y += 5;

xprevious: The Actor's previous x position in the last frame. This variable is read only.


yprevious: The Actor's previous y position in the last frame. This variable is read only.

xscreen: The Actor's horizontal screen position in screen coordinates.

yscreen: The Actor's vertical screen position in screen coordinates.

xvelocity: The Actor's x velocity in pixels / frame.

yvelocity: The Actor's y velocity in pixels / frame.

angle:
Move the Actor's angle (0 to 360, from the positive x axis, counterclockwise, in degrees).

directional_velocity:
The Actor's velocity in pixels / frame, in angle direction (set this Actor variable only when it is used with angle)

r:
red color (0 - 255)

g:
green color (0 - 255)

b :
blue color (0 - 255)

transp:
The Actor's transparency setting (0.0 - 1.0).

animpos: 
The actual animation frame. Animpos will change the frame of your current animation only. To change animation without reseting current frame, use the "No change" option in Change Animation action (NO_CHANGE in the script).

animindex: Use animindex(count from 0) to find the actual animation of your actor. Each animation that an actor has has a unique index assigned to it. ( This way you can tell which animation is currently running. )
If your actor has 3 animations, then:
The first animation has animindex = 0
The second animation has animindex = 1
The third animation has animindex = 2
This variable is read only.

nframes
:
The number of frames in the current animation. This variable is read only.

width:
The actual animation width. This variable is read only.

height:
The actual animation height. This variable is read only.

textNumber:
If the Actor displays text, you can set the text number here.
Script Editor Syntax:
MyActor.textNumber=5;

text:
If the Actor displays text, you set the text string using: 
Script Editor Syntax:
strcpy (MyActor.text,"Hello World");
The max length of text is 255 characters.

name: The Actor's name. This variable is read only.


clonename:
The Actor clone name (Composed of the original Actor's name followed by the clone number index). This variable is read only.
cloneindex: The Actor clone's index (always start counting from 0). If 2 clones have been created, index will be myclone.0, myclone.1, ... This variable is read only.
frame: Game frame count. This variable is global and read only.
musicvol: Music volume (0.0 - 1.0  Loudest). This variable is global.
Script Editor Syntax:
musicvol=.7;

real_fps:
Real game frame rate (frames per second). This variable is global and read only.

xmouse:
Mouse's x (horizontal) screen position (screen coordinates). This variable is global and read only.

Script Editor Syntax:

xscreen = xmouse;

ymouse:
Mouse's y (vertical) screen position (screen coordinates). This variable is global and read only.
Script Editor Syntax:
yscreen = ymouse;

---User Vars---
Variables that have been defined by the user will be shown in this area of the variables/functions selector box.
MyVariable1
MyVariable2
MyVariable3
...

Actions


ChangeAnimation: Change animation and set initial state (FORWARD, BACKWARD, STOPPED, NO_CHANGE).
Return 1 if success, 0 on error.

int ChangeAnimation(char *actorName, char *animationName, int state)
animationName: animation valid for actorName.
Actor name:
- "Event Actor": Actor that is receiving the current event.
- "Parent Actor": Event Actor's parent, if exists.
- "Creator Actor": Event Actor's creator, if Event Actor has been created in some "Create Actor" action.
- "Collide Actor": Actor that collided with the event Actor.
- Any Actor in game.

Script Editor Syntax:
ChangeAnimaton("Event Actor","Animation_1",BACKWARD);

ChangeAnimationDirection: Change animation state (FORWARD, BACKWARD, STOPPED).
Return 1 if success, 0 on error.

int ChangeAnimationDirection(char *actorName, int state)
Actor name:
- "Event Actor": Actor that is receiving the current event.
- "Parent Actor": Event Actor's parent, if exists.
- "Creator Actor": Event Actor's creator, if Event Actor has been created in some "Create Actor" action.
- "Collide Actor": Actor that collided with the event Actor.
- Any Actor in game.

Script Editor Syntax:
ChangeAnimatonDirection("Ball", FORWARD);

ChangeCursor: Change Actor cursor.

int ChangeCursor(char *actorName, char *imgName, int nFramesH, int nFramesV, int hotSpotX, int hotSpotY)

imgName: image file path relative to game directory.
nFramesH: number of horizontal frames.
nFramesV: number of vertical frames.
hotSpotX: cursor x hot spot.
hotSpotY: cursor y hot spot.
Return 1 if success, 0 on error.
Actor name:
- "Event Actor": Actor that is receiving the current event.
- "Parent Actor": Event Actor's parent, if exists.
- "Creator Actor": Event Actor's creator, if Event Actor has been created in some "Create Actor" action.
- Any Actor in game.

Script Editor Syntax:
ChangeCursor("Event Actor", "Ball.png", 1, 1, 0, 0);

ChangeParent: Change an Actor's parent.
int ChangeParent(char *actorName, char *parentName)

parentName: any Actor name (including "Event Actor", "Collide Actor", "Parent Actor", "Creator Actor" and "no parent").
Return 1 if successful, 0 on error.
Actor name:
- "Event Actor": Actor that is receiving the current event.
- "Parent Actor": Event Actor's parent, if exists.
- "Creator Actor": Event Actor's creator, if Event Actor has been created in some "Create Actor" action.
- "Collide Actor": Actor that collided with the event Actor.
- Any Actor in game.

Script Editor Syntax:
ChangeParent("MyActor", "Event Actor");

ChangePath: Change Actor path and set axis (X_AXIS, Y_AXIS, BOTH_AXIS).

int ChangePath(char *actorName, char *pathName, int axis)

pathName: any path name (including "no path" and "random path").
Return 1 if success, 0 on error.
Actor name:
- "Event Actor": Actor that is receiving the current event.
- "Parent Actor": Event Actor's parent, if exists.
- "Creator Actor": Event Actor's creator, if Event Actor has been created in some "Create Actor" action.
- "Collide Actor": Actor that collided with the event Actor.
- Any Actor in game.

Script Editor Syntax:
ChangePath("MyActor", "path1", BOTH_AXIS);

ChangeTransparency: Change Actor transparency (0.0 - opaque, to 1.0 - transparent).
Return 1 if success, 0 on error.
int ChangeTransparency(char *actorName, double transp)
Actor name:
- "Event Actor": Actor that is receiving the current event.
- "Parent Actor": Event Actor's parent, if exists.
- "Creator Actor": Event Actor's creator, if Event Actor has been created in some "Create Actor" action.
- "Collide Actor": Actor that collided with the event Actor.
- Any Actor in game.

Script Editor Syntax:
ChangeTransparency("Event Actor", 0.64);

ChangeZDepth: Change an Actor's z depth.
int ChangeZDepth(char *actorName, double zdepth)
zdepth: 0.0 to 1.0
Return 1 if success, 0 on error.
Actor name:
- "Event Actor": Actor that is receiving the current event.
- "Parent Actor": Event Actor's parent, if exists.
- "Creator Actor": Event Actor's creator, if Event Actor has been created in some "Create Actor" action.
- "Collide Actor": Actor that collided with the event Actor.
- Any Actor in game.

Script Editor Syntax:
ChangeZDepth("My Actor", 0.70);

CollisionState:
Enable or disable collision.
Return 1 if success, 0 on error.
int CollisionState(char *actorName, int state)
Actor name:
- "Event Actor": Actor that is receiving the current event.
- "Parent Actor": Event Actor's parent, if exists.
- "Creator Actor": Event Actor's creator, if Event Actor has been created in some "Create Actor" action.
- "Collide Actor": Actor that collided with the event Actor.
- Any Actor in game.
state: ENABLE or DISABLE

Script Editor Syntax:
CollisionState("Event Actor", DISABLE);

CreateActor:  Creates a new Actor via script.
Actor* CreateActor(char *creatorName, char *animationName, char *parentName, char *pathName, int xpos, int ypos, int absolutePosition)

creatorName: any legal Actor name.
animationName: the animation valid for the Actor Name or "no animation".
parentName: any Actor name (including"Event Actor", "Collide Actor", "Parent Actor", "Creator Actor" and "no parent").
pathName: any path name (including "no path" and "random path").
x,y: the new Actor's initial position.
absolutePosition: true or false.
Return Actor if success, invalid Actor (with cloneindex = -1 and name = "") on error.

Script Editor Syntax:
CreateActor("GamePaddle", "Paddle_Animation", "no parent", "no path", 0, 0, false);

CreateTimer: Create a new timer.
Return 1 if success, 0 on error.
int CreateTimer(char *actorName, char *timerName, int milliseconds)
timerName: the new timer's name. (The timerName must be defined in Create new timer panel)
milliseconds: new timer tempo.
Actor name:
- "Event Actor": The Actor that is receiving the current event.
- "Parent Actor": If one exists, this signifies the name of the Event Actor's parent.
- "Creator Actor": If the Event Actor has been created in some "Create Actor" action, this signifies the Event Actor's creator.
- "Collide Actor": The Actor that collided with the event Actor.
- Any Actor in game.

Script Editor Syntax:
CreateTimer("Event Actor", "MyTimer", 2000)

DestroyActor: Destroy an Actor in the game.
int DestroyActor(char *actorName)
Return 1 if success, 0 on error
Actor name:
- "Event Actor": The Actor that is receiving the current event.
- "Parent Actor": If it exists, this signifies the Event Actor's parent.
- "Creator Actor": If Event Actor has been created in some "Create Actor" action, this signifies name of the Event Actor's creator .
- "Collide Actor": The Actor that collided with the Event Actor.
- Any Actor in the game.

Script Editor Syntax:
DestroyActor("Ball.2"); //To destroy the Ball.2 actor
DestroyActor("Ball"); //To destroy all ball actors

DestroyTimer: Destroy the named timer. Must be called in the actor that have an active timer.
int DestroyTimer(char *timerName)
Return 1 if success, 0 on error.
timerName: timer name

Script Editor Syntax:
DestroyTimer("MyTimer");

EventDisable: Disable an Actor Event:
int EventDisable(char *actorName, unsigned long event)
Return 1 if success, 0 on error.
The following Events can be disabled using EventDisable:
EVENTMOUSEBUTTONDOWN
EVENTMOUSEBUTTONUP
EVENTMOUSEENTER
EVENTMOUSELEAVE
EVENTANIMATION
EVENTANIMATIONFINISH
EVENTPATHFINISH
EVENTMOVEFINISH
EVENTKEYDOWN
EVENTKEYUP
EVENTTIMER
EVENTCOLLISION
EVENTCOLLISIONFINISH
EVENTCREATE
EVENTDESTROYACTOR
EVENTOUTOFVISION
EVENTACTIVATIONEVENT
EVENTALL
Actor name:
- "Event Actor": Actor that is receiving the current event.
- "Parent Actor": If it exists, this signifies the Event Actor's parent.
- "Creator Actor": If the Event Actor has been created in some "Create Actor" action, this signifies the Event Actor's creator.
- "Collide Actor": The Actor that collided with the event Actor.
- Any Actor in game.

Script Editor Syntax:
EventDisable("Event Actor", EVENTMOUSEBUTTONDOWN);

EventEnable: Enable an Actor Event.
int EventEnable(char *actorName, unsigned long event)
The following Events can be enabled using EventEnable:
EVENTMOUSEBUTTONDOWN
EVENTMOUSEBUTTONUP
EVENTMOUSEENTER
EVENTMOUSELEAVE
EVENTANIMATION
EVENTANIMATIONFINISH
EVENTPATHFINISH
EVENTMOVEFINISH
EVENTKEYDOWN
EVENTKEYUP
EVENTTIMER
EVENTCOLLISION
EVENTCOLLISIONFINISH
EVENTCREATE
EVENTDESTROYACTOR
EVENTOUTOFVISION
EVENTACTIVATIONEVENT
EVENTALL
Return 1 if success, 0 on error
Actor name:
- "Event Actor": The Actor that is receiving the current event.
- "Parent Actor": If it exists, this signifies the Event Actor's parent.
- "Creator Actor": If the Event Actor has been created in some "Create Actor" action, this signifies the Event Actor's creator.
- "Collide Actor": The Actor that collided with the Event Actor.
- Any Actor in game.

Script Editor Syntax:
EventEnable("Event Actor", EVENTMOUSEBUTTONDOWN);

FollowMouse: Makes an Actor follow the mouse axis (X_AXIS, Y_AXIS, BOTH_AXIS, NONE_AXIS).
int FollowMouse(char *actorName, int axis)
Return 1 if success, 0 on error.
Actor name:
- "Event Actor": The Actor that is receiving the current event.
- "Parent Actor": If it exists, this signifies the Event Actor's parent.
- "Creator Actor": If the Event Actor has been created in some "Create Actor" action, this signifies the Event Actor's creator.
- "Collide Actor": The Actor that collided with the Event Actor.
- Any Actor in game.

Script Editor Syntax:
FollowMouse("GamePaddle", X_AXIS);
MoveTo: Move an Actor to a specified position at specified velocity (speed).
int MoveTo(char *actorName, double x, double y, double velocity, char *relativeActor, char *avoidActor)
Return 1 if success, 0 on error

Actor name:
- "Event Actor": The Actor that is receiving the current event.
- "Parent Actor": If it exists, this signifies the Event Actor's parent.
- "Creator Actor": If the Event Actor has been created in some "Create Actor" action, this signifies the Event Actor's creator.
- "Collide Actor": The Actor that collided with the Event Actor.
- Any Actor in game.

x, y: position to move relative to relativeActor.

relativeActor:

The Actor can be moved relative to the game center (absolute coordinate), relative to mouse or any Actor in the game.

Valid values:

- "Event Actor": Actor that is receiving the current event.
- "Parent Actor": Event Actor's parent, if exists.
- "Creator Actor": Event Actor's creator, if Event Actor has been created in some "Create Actor" action.
- "Collide Actor": Actor that collided with the event Actor.
- "Mouse Position": Move the actor relative to current mouse position
- "Game Center": Move the actor relative to game coordinates
- Any Actor in game

avoidActor:
- "Event Actor": The Actor that is receiving the current event.
- "Parent Actor": If it exists, this signifies the Event Actor's parent.
- "Creator Actor": If the Event Actor has been created in some "Create Actor" action, this signifies the Event Actor's creator.
- "Collide Actor": The Actor that collided with the Event Actor.
- Any Actor in game.


Example:

1) Move the Event Actor to right 10 positions (x = x + 10):

MoveTo("Collide Actor", 10, 0, 1000, "Event Actor", "");
(use high velocity for an instantaneous move)

2) Move the view to player position (view.x = player.x; view.y = player.y;):

MoveTo("view", 0, 0, 1, "player", "");

3) Move the player to mouse position:

MoveTo("player", 0, 0, 1, "Mouse Position", "");

4) Move the player to mouse position, avoind the lakes in a terrain:

MoveTo("player", 0, 0, 1, "Mouse Position", "lake");


PhysicalResponse: Do a physical bounce movement between Actors in a collision.

int PhysicalResponse(int moveType, int massType, double massEventActor, double massCollideActor, double eventVelocityMultiplier, double collideVelocityMultiplier)

Return 1 if success, 0 on error .
-moveType: MOVE_EVENT_ACTOR_ONLY, MOVE_COLLIDE_ACTOR_ONLY, MOVE_BOTH_ACTORS
-massType: USE_CALCULATED_MASS, USE_SPECIFIED_MASS
-massEventActor, massCollideActor:
When massType = USE_CALCULATED_MASS, use this variable to define how to calculate the mass multiplier.
When massType = USE_SPECIFIED_MASS, use this variable to define how to calculate the mass.
(Values must be > 0.0)

eventVelocityMultiplier, collideVelocityMultiplier: final velocity multiplier

Script Editor Syntax:
PhysicalResponse(MOVE_EVENT_ACTOR_ONLY, USE_CALCULATED_MASS, 1.000000,1.000000, 1.000000, 1.000000);

PlayMusic: Play a music file.
int PlayMusic(char *soundPath, double volume, int loop)

-soundPath: relative to game directory.
-volume: 0.0 to 1.0.
-loop: loop count (1 to 65000 or 0 to infinite loop)
Return the channel 1 if success, 0 on error.

Script Editor Syntax:
PlayMusic("data/MyMusic.wav", 1.0, 1);

PlayMusic2: Play a music file with the ability to define the music priority.
int PlayMusic2(char *soundPath, double volume, int loop, int priority)

-soundPath: relative to game directory.
-volume: 0.0 to 1.0.
-loop: loop count (1 to 65000 or 0 to infinite loop)
-priority: HIGH_PRIORITY_MUSIC, MEDIUM_PRIORITY_MUSIC or LOW_PRIORITY_MUSIC
Return the channel 1 if success, 0 on error.

Script Editor Syntax:
PlayMusic2("C:\\WINDOWS\\Media\\MyMusic2.wav", 1.000000, 1, HIGH_PRIORITY_MUSIC);

PlaySound:
Play a sound file.
int PlaySound(char *soundPath, double volume, int loop)

-soundPath: relative to game directory.
-volume: 0.0 to 1.0.
-loop: loop count (1 to 65000 or 0 to infinite loop)
Return the allocated channel if success, 0 on error

Script Editor Syntax:
PlaySound("data/tada.wav", 1.000000, 3);
PlaySound2: Play a sound file with the ability to double pan.
int PlaySound2(char *soundPath, double volume, int loop, double pan)

-soundPath: relative to game directory.
-volume: 0.0 to 1.0
-pan: -1.0 (full left) to 1.0 (full right)
-loop: loop count (1 to 65000 or 0 to infinite loop)
Return the allocated channel if success, 0 on error.

Script Editor Syntax:
P
laySound2("data/tada.wav", 1.000000, 1, 0.000000);
ToAnteriorPosition: Send an Actor to a defined position in the anterior frame.
int ToAnteriorPosition(char *actorName)
Return 1 if success, 0 on error.
Actor name:
- "Event Actor": Actor that is receiving the current event.
- "Parent Actor": Event Actor's parent, if exists.
- "Creator Actor": Event Actor's creator, if Event Actor has been created in some "Create Actor" action.
- "Collide Actor": Actor that collided with the event Actor.
- Any Actor in game

Script Editor Syntax:
ToAnteriorPosition("Event Actor");

VisibilityState:
int VisibilityState(char *actorName, int state)
state: ENABLE, DISABLE and DONT_DRAW_ONLY (Don't draw, but allow events)
Return 1 if success, 0 on error.
Actor name:
- "Event Actor": Actor that is receiving the current event.
- "Parent Actor": Event Actor's parent, if exists.
- "Creator Actor": Event Actor's creator, if Event Actor has been created in some "Create Actor" action.
- "Collide Actor": Actor that collided with the event Actor.
- Any Actor in game.

Script Editor Syntax:
VisibilityState("GameGhost", ENABLE);


Drawing Functions

Drawing Functions must be used into actions of a canvas Actor.
The (x, y) coordinates are relative to the Actor's upper left corner
.

draw_from: Draw the current image of an actor into a canvas actor (doesn't works with tile or text actors)
void draw_from(const char *actorname, int x, int y, double scale)
actorname: The name of the actor who’s current frame is to be drawn on the canvas actor.
x: The x location to draw the image.
y: The y location to draw the image.
scale: The size to draw the image (greater than 0.0)

Script Editor Syntax:
draw_from("player", 0, 1, 1.0);
setpen: Define the actual pen for the Event Actor
void setpen(int r, int g, int b, double transp, int pensize)
r: red component (0 - 255)
g: green component (0 - 255)
b: blue component (0 - 255)
transparency: (0.0 - 1.0)
pensize: size of pen

Script Editor Syntax:
setpen(0, 255, 0, 0.0, 3); //set pen color to green, no transparency, pensize 3

moveto: Move the Event Actor's pen to (x, y) coordinates.
void moveto(int x, int y)

Script Editor Syntax/Example:
screen_to_actor(&xmouse,&ymouse) //get mouse coordinates
moveto(xmouse,ymouse); //move pen to mouse coordinates
lineto: Draw a line on Event Actor to (x, y) coordinates using actual pen
void lineto(int x, int y)

Script Editor Syntax:

setpen(255,255,255,0,3);
lineto (50,50);
Example:
if (draw == 1)
{
screen_to_actor(&xmouse, &ymouse); //mouse coordinates from screen to actor coordinates
lineto(xmouse, ymouse); //draw a line to the mouse coordinates
}
putpixel: Draw a single pixel on Event Actor in (x, y) coordinates using actual pen.
void putpixel(int x, int y)

Script Editor Syntax:
putpixel(0, 0);
erase:  Erase all Actors with a specified color.
void erase(int r, int g, int b, double transp)
-r: red component (0 - 255)
-g: green component (0 - 255)
-b: blue component (0 - 255)
-transparency: (0.0 - 1.0)

Script Editor Syntax:
erase(0, 0, 0, .5);
screen_to_actor: Convert from screen coordinates to Actor coordinates (Use screen_to_actor(&xmouse, &ymouse); to convert the mouse coordinates to the current actor coordinates. For Example, this function could be used to draw at the correct spot on a canvas actor. )
void screen_to_actor(int *x, int *y)
Script Editor Syntax:
screen_to_actor(&xmouse, &ymouse); //convert the mouse coordinates to the current actor coordinates.
actor_to_screen: Convert from Actor coordinates to screen coordinates

void actor_to_screen(int *x, int *y)

Script Editor Syntax:
actor_to_screen(&xmouse, &ymouse); //convert from Actor(in this case the mouse)coordinates to screen coordinates.
savecanvas: Save the canvas Actor state in memory.
void savecanvas()

Script Editor Syntax:
savecanvas();

restorecanvas: Restores the canvas Actor from the memory.
void restorecanvas()

Script Editor Syntax:
restorecanvas();

Sound functions

Sound functions use the channel returned by PlayMusic, PlayMusic2, PlaySound, PlaySound2.

setPan: Set the pan of sounds (Doesn't work with music).
channel: use 0 to affect all sound channels
pan: -1.0 (full left) to 1.0 (full right)
void setPan(int channel, double pan)

Script Editor Syntax:
setPan(channel, -1);

setVolume: Set the sound or the music volume
channel: use 0 to affect all sound channels
volume: 0.0 to 1.0
void setVolume(int channel, double volume)

Script Editor Syntax:
setVolume(channel, .5);
stopSound: Stop the sound or music played on the specified channel.
channel: use 0 to stop all sounds
void stopSound(int channel)

Script Editor Syntax:
stopSound(channel);
 

Save functions

Use saveVars and loadVars to save and load any variables in a game, like highscores, current lives, etc. To use these functions, you must use the "Save group" field in the "Add New Variable" panel (Variable button in the Script Editor).

saveVars: Save all variables in the group to the specified file.
The file will be saved in the game directory.
void saveVars(char *file, char *group)
Use saveVars to save any variables in a game; highscores, current lives, etc.
You must use the "Save group" field in the "Add New Variable"panel (Variable button in the Script Editor).
Script Editor Syntax:
saveVars("game.sav", "High Score");
loadVars: Load all the variables in the group from a specified file.
void loadVars(char *file, char *group)

Script Editor Syntax:
loadVars("game.sav", "High Score");

Example:
1. Create a "score" variable and put it in the "High Score" group.
2. Create two more variables: "lives" and "energy". Put these variables in the "Actor State" group.

When the player dies, use saveVars("game.sav", "High Score"); to save the current player's high score without saving the player's state.
When the user exits the game, use saveVars("game.sav", "Actor State"); to save the current player's state (lives and energy).
Note: different variable groups can be saved in the same file (game.sav).
Finally, use loadVars("game.sav", "High Score"); and loadVars("game.sav", "Actor State"); in the proper script editor area of the game!

Game Control

LoadGame: Loads a new game.
int LoadGame(char *gamePath)

gamePath: game file path relative to actual game directory.
Return 1 if success, 0 on error.

Script Editor Syntax:
LoadGame("Level1.ged");

In the Script Editor, Level1.ged will be loaded.
In your executable game, Level1.exe or Level1.dat will be loaded.
ExitGame: End game and return to system.
int ExitGame()
Return 1 if success, 0 on error.

Script Editor Syntax:
ExitGame();
SuspendGame: Pause the game and stop receiving any events.
void SuspendGame()
Script Editor Syntax:
SuspendGame();

Shows the task bar on the Pocket PC.
Continue the game only if the game gets the focus (when the user clicks on game title bar window or uses Alt+Tab or if user click on [Continue] option on Pocket PC, Handheld PC and Smartphone).
PauseGameOff: Continue a game that has been paused by PauseGameOn() function. See Example below under PauseGameOn.
void PauseGameOff()
Script Editor Syntax/ Example Code:
1) When the user wants to pause a game, Create your "pauseActor": "Paused - Click To Resume".
2) On the Create Actor Event of "pauseActor" add a Script Editor Action with the following code:
PauseGameOn();
3) On Mouse Button Down event, add a Script Editor action with the following code:
PauseGameOff();
DestroyActor("Event Actor");


PauseGameOn:
Pause the game but continue receiving keyboard and mouse events. This is done so, you can call PauseGameOff() in a keyboard or mouse event.
void PauseGameOn()

Script Editor Syntax:
PauseGameOn();

Keyboard Functions

getKeyText: Returns the key description
char *getKeyText(int key)

Script Editor Syntax:
int keyCode = getLastKey(); //get the last key pressed.
strcpy(myactor.text, getKeyText(keyCode)); //get the key text (getKeyText) and copy it (strcpy) to myactor.

getLastKey:
Returns the last pressed key.
int getLastKey()

Script Editor Syntax:
int selectedKey = getLastKey(); //"selectedKey" is the variable used to store the last key pressed using the getLastKey() function. Any variable name could be used.
Note: The getLastKet() function will return the last pressed key after redirection.
So, if the user press the 'T' key and you are remaped the 'T' to 'right' key previously, the getLastKey() will return the 'right' key.

To avoid this behavior, in this example, you need remove the redirection by using:
remapKey(KEY_t, KEY_t);
remapKey: Redirect fromKey to toKey (User configured keys). Use this function to redirect any keys.
void remapKey(int fromKey, int toKey)

All redirections are removed using LoadGame()

Script Editor Syntax:

For Example:
A game actor shoots with KEY_RCTRL.
If you want your user to be able to change this control key in the game configuration screen,
you use a KeyDown event, and put the following into the script editor:
remapKey(getLastKey(), KEY_RCTRL); //KEY_RCTRL is the the key to remap.

Now, the key pressed by user, will be redirected to KEY_CTRL. The remapKey() function allows you to keep your original default game key.
GetKeyState: Returns an array with the keyboard state.
char *GetKeyState()

Script Editor Syntax:

char *key = GetKeyState(); // "key" is the variable used to store GetKeyState() function. Any variable name could be used.

Example:
When the left or right key is pressed in the "Draw Actor" Event, the following code will move an Actor to the left or to the right.

1) Create an actor
2) Add a "Draw actor" event
3) Add Script code

Code:
char *key = GetKeyState(); //Get entire keyboard state

if(key[KEY_RIGHT] == 1) //Test if right key is pressed
{
x = x + 5; //Move actor to right
}

if(key[KEY_LEFT] == 1) //Test if left key is pressed
{
x = x - 5; //Move actor to left
}

Valid key entries:
KEY_BACKSPACE
KEY_TAB
KEY_CLEAR
KEY_RETURN
KEY_PAUSE
KEY_ESCAPE
KEY_SPACE
KEY_EXCLAIM
KEY_QUOTEDBL
KEY_HASH
KEY_DOLLAR
KEY_AMPERSAND
KEY_QUOTE
KEY_LEFTPAREN
KEY_RIGHTPAREN
KEY_ASTERISK
KEY_PLUS
KEY_COMMA
KEY_MINUS
KEY_PERIOD
KEY_SLASH
KEY_0
KEY_1
KEY_2
KEY_3
KEY_4
KEY_5
KEY_6
KEY_7
KEY_8
KEY_9
KEY_COLON
KEY_SEMICOLON
KEY_LESS
KEY_EQUALS
KEY_GREATER
KEY_QUESTION
KEY_AT
KEY_LEFTBRACKET
KEY_BACKSLASH
KEY_RIGHTBRACKET
KEY_CARET
KEY_UNDERSCORE
KEY_BACKQUOTE
KEY_a
KEY_b
KEY_c
KEY_d
KEY_e
KEY_f
KEY_g
KEY_h
KEY_i
KEY_j
KEY_k
KEY_l
KEY_m
KEY_n
KEY_o
KEY_p
KEY_q
KEY_r
KEY_s
KEY_t
KEY_u
KEY_v
KEY_w
KEY_x
KEY_y
KEY_z
KEY_PAD_0
KEY_PAD_1
KEY_PAD_2
KEY_PAD_3
KEY_PAD_4
KEY_PAD_5
KEY_PAD_6
KEY_PAD_7
KEY_PAD_8
KEY_PAD_9
KEY_PAD_PERIOD
KEY_PAD_DIVIDE
KEY_PAD_MULTIPLY
KEY_PAD_MINUS
KEY_PAD_PLUS
KEY_PAD_ENTER
KEY_PAD_EQUALS
KEY_UP
KEY_DOWN
KEY_RIGHT
KEY_LEFT
KEY_INSERT
KEY_HOME
KEY_END
KEY_PAGEUP
KEY_PAGEDOWN
KEY_F1
KEY_F2
KEY_F3
KEY_F4
KEY_F5
KEY_F6
KEY_F7
KEY_F8
KEY_F9
KEY_F10
KEY_F11
KEY_F12
KEY_F13
KEY_F14
KEY_F15
KEY_NUMLOCK
KEY_CAPSLOCK
KEY_SCROLLOCK
KEY_RSHIFT
KEY_LSHIFT
KEY_RCTRL
KEY_LCTRL
KEY_RALT
KEY_LALT
KEY_RMETA
KEY_LMETA
KEY_LWINDOWS
KEY_RWINDOWS
KEY_ALT_GR
KEY_HELP
KEY_PRINT
KEY_SYSREQ
KEY_BREAK
KEY_MENU
KEY_MAC_POWER
KEY_EURO
KEY_POCKET_UP
KEY_POCKET_DOWN
KEY_POCKET_LEFT
KEY_POCKET_RIGHT
KEY_POCKET_A
KEY_POCKET_B
KEY_POCKET_C
KEY_POCKET_START
KEY_POCKET_AUX1
KEY_POCKET_AUX2
KEY_POCKET_AUX3
KEY_POCKET_AUX4
KEY_POCKET_AUX5
KEY_POCKET_AUX6
KEY_POCKET_AUX7
KEY_POCKET_AUX8
KEY_GP2X_BUTTON_UP
KEY_GP2X_BUTTON_DOWN
KEY_GP2X_BUTTON_LEFT
KEY_GP2X_BUTTON_RIGHT
KEY_GP2X_BUTTON_UPLEFT
KEY_GP2X_BUTTON_UPRIGHT
KEY_GP2X_BUTTON_DOWNLEFT
KEY_GP2X_BUTTON_DOWNRIGHT
KEY_GP2X_BUTTON_CLICK
KEY_GP2X_BUTTON_A
KEY_GP2X_BUTTON_B
KEY_GP2X_BUTTON_X
KEY_GP2X_BUTTON_Y
KEY_GP2X_BUTTON_L
KEY_GP2X_BUTTON_R
KEY_GP2X_BUTTON_START
KEY_GP2X_BUTTON_SELECT
KEY_GP2X_BUTTON_VOLUP
KEY_GP2X_BUTTON_VOLDOWN

Helper functions

ActorCount: Returns the number of Actors with the Actor Name.
Actor name:
- Any Actor in game.

Script Editor Syntax:
( ActorCount("metalBlock1") == 1)\\total number of actors currently active ==1.
Load the breakout demo and go to the DestroyActor event of metalBlock1 actor to see this function in action.
CollisionFree: Check if position (x, y) is collision free for ActorName. Return 1 if not collide, 0 otherwise.
int CollisionFree(char *actorName, int x, int y)
Actor name:
- "Event Actor": Actor that is receiving the current event.
- "Parent Actor": Event Actor's parent, if exists.
- "Creator Actor": Event Actor's creator, if Event Actor has been created in some "Create Actor" action.
- "Collide Actor": Actor that collided with the event Actor.
- Any Actor in game.

Script Editor Syntax:
if (CollisionFree("Event Actor", x, y+5)) y=y+5; //On KeyDown Event script for KEY_DOWN, check if there is no collision before moving an actor down by 5 pixels.
SendActivationEvent: Send an Activation Event to an Actor's clone.
int SendActivationEvent(char *cloneName)
Return 1 if success, 0 on error.
cloneName: nameactor.cloneindex (Ex.: ship.1, ship.2, ...)

SendActivationEvent("ship.1"); //send ActivationEvent to the ship clone with the index number 1.
radtodeg:  Convert an angle from radians to degrees.
double radtodeg(double a)
degtorad: Convert an angle from degrees to radians.
double degtorad(double a)
Script Editor Syntax:
myactor.textNumber= degtorad(angle);

direction:
Rreturns the direction between points (x1, y1) and (x2, y2) (in degrees, 0 to 360, from positive x axis, counterclockwise, in degrees).
double direction(double x1, double y1, double x2, double y2)
Script Editor Syntax:
textNumber=
direction(x, y, player.x, player.y);


distance:
Returns the distance between points (x1, y1) and (x2, y2).
double distance(double x1, double y1, double x2, double y2)