Eliter Script Documentation

About This Document:

This document is meant to teach you how to write scripts with Eliter Script. You can use your own favorite text editor to write your script and then just place it in the scripts sub-directory of eliter with a .job extension to try it out. Take a look at some of the other .job files in that directory to see example code. example.job is a great place to start. Good luck!

Oh and when you finish your job send it to me at sailorh@chibinet.com. If I like it, and you are willing, I will put it in the next release of eliter and it can use the internet ranking system.

Stuff to write still:

Syntax:

The syntax in Eliter Script is a lot like C except for some significant differences:

int i;
i = 0;
while(i<10){
i++;
// To something
}
int i = 12; // This doesn't work
int j;
j = 12; // This works
x.y = 12; // This works
int z;
int z.y; // This also works
object e;
int x;
x = 1; // Sets x to "1"
e => x; // Makes e a reference to object x
e = 2; // Sets x to "2" (and also e to "2")
message(x); // Displays "2"
x = "hi " & "there"; // this sets x to "hi there"

Variable Types:

Eliter Objects:

The following is a list of objects from Eliter which are accessable by the scripting language and decriptions of their members.

Job Object:

The Job object comes in as a global variable called "Job" and has several variables which specify information about the current job script. Here are it's members:

Player Object:

The player object encapuslates properties about the player's ship and status in an object that you can access and modify in the scripting language. The player object is accessed through a global variable called "Player". Actually, these are mostly useful for reading information, if you change most of these values it will either make the game act odd, or not do anything. But you can feel free to mess with whatever you want. Here is a list of members:

Entity Object:

The entity object is the basics of what makes up the game. It is every enemy you see on the screen. There are some built in entity base types that you can use or you can modify them to fit your needs. These are the defaults:

To create an entity use the following code:

object e;
e => NewEntity(LITER, "My First Entity", MAIN_LAYER_TOP)
// first parameter should be one of the constants from above.
// second parameter is an optional name string.


// third parameter is draw order explained below

Note the use of the => operator. The NewEntity function returns a reference to an Eliter Entity object, so you must use the => operator to make "e" point to that new entity. From here on you can reference "e"'s members like this:

e.sx = 100;
e.xy = 200;

The third parameter is optional, but useful if you are having problems with entities overlapping each other. In those cases the third parameter allows you to specify a drawing order, it can be one of the following:

Simple huh? What's "sx" and "sy" you ask? Well here is a list of all the entity members:

Shot Object:

Create a new shot with the NewShot function as so:

object s;
s = NewShot(SHOT, SHOTSPEED, Player.rotate, 0, -1, 0, 0);

Simple eh? The first parameter is the type of shot which should be one of the following:

The second parameter is the speed the shot travels. Default is SHOTSPEED. or SHOTSPEED*2 for SHOTBEAM type.

The third parameter is the angle that the shot is facing, this is used to rotate the sprite and to calculate momentum. This doesn't work very well with SHOTBEAM right now, because the collision box is not rotated, causing odd collisions if the beam is rotated horizontally... I am working on a solution for this.

The fourth and firth parameters are the x and y offset from the center of the player of where the shot should be created. (0, -1) is the middle front of the player, (0, 1) is the middle back, (-1,0) is the middle left ect. You can use decimals and values greater than 1 also. So for example (-0.5, -2) will make a shot a 1/2 the players width to the left and 1 whole of the players height above the center of the player sprite. It may sound confusing but it works well.

The last two parameters are wavespeed and wavesize respectively. Try playing with them to create interesting movement patterns. Otherwise set them to 0 to not wave.

Once you got a shot object, use these members to play with it:

Function Reference:

Eliter has several built in functions to assist you in making awesome scripts.

Globals/Contants

 

Notes:

images must be texture size multiples. 64, 128, 256, 512, 1024, etc... otherwise you will experience stretching and weirdness.