Documentation
Lua Scripting (^)
I won't provide a general lua documentation. You can find that on the official lua homepage.
There are two namespaces at the moment: map and player. You access the elements in those namespaces with map.element.
Map Functions (^)
Acids wall-tiles around x/y, but not x/y itself.
Example:
Creates the object objname at x/y.
Example:
Creates a robot at x/y.
Example:
Returns a new table with x/y coordinates of a random, free(=walkable) position on the map.
Example:
Checks if map-tile on x, y conforms with mask.
Values for mask:
| WALL | 1 |
| WALKABLE | 2 |
| PUSHABLE | 4 |
| EFENCE | 8 |
| SLOW | 16 |
| NOTPUSHABLE | 32 |
| SOLID | 64 |
Example:
Checks whether there is an object on x/y or not.
Example:
Checks whether there is an robot on x/y or not.
Example:
Checks if the position on x/y is free.
That's the case when:
- No Object is on x/y
- No Robot is on x/y
- The Tile has the attribute WALKABLE
Player Functions (^)
Returns a table with the following attributes:
| x | x position |
| y | y position |
Example:
Sets the Player's electronic-fence immunity to state. (And swaps images)
Example:
Adds num lives. (Standard = 1)
Example:
Sets the new position of the player to x/y
Picks obj up, where obj is lightuserdata - a C-pointer to an object class.
Objects (^)
Definition
Objects are defined in the file objects.lua.Objects are tables which are stored with an unique key in the main objects table.
Example:
| Property | Possible Values | Description |
|---|---|---|
| tile | int | Graphic tile in objects.png tilefile. -1 = invisible |
| nuse | Once, Multi, Drop | Times the Object can be used. Drop means that the object cannot be used but is dropped instead |
Example:
Callbacks
Callbacks are functions that are called when something special happens with the object (see list below).Example:
| Callback | Description |
|---|---|
| Activation( obj ) | Called when the object is used. obj stores an C-Pointer to the object. |
| PlayerOnTile( obj ) | Called when the player walks on the tile. obj stores an C-Pointer to the object. |
| Pickup( obj ) | Called when the object is picked up. obj stores an C-Pointer to the object. |
| Drop( obj ) | Called when the object is dropped. obj stores an C-Pointer to the object. |
Example: