Jump to: navigation, search

Scripting API

Scripting API

Ready for the hard-core? These pages gives background information on the API (and objects) exposed by Cubiverse that allow you to build games and worlds. Most of the links below given high level details on the objects, entities, etc. but from within those pages you can directly access the full API document (or just visit The RAW API )

As Cubiverse is event driven, you will inherit most of your Java-script objects from a base object provided by Cubiverse - for example, if you add any code to a voxel cube you will inherit from "cubiScript". This "cubiScript" gives your cube all manner of methods and properties that are required for the cube to work, if you don't do this your code will not work.

As Cubiverse is under development there's may be unsupported script calls documented here, they should have [N/A] (Not Available) beside them. This is to allow me to both correctly design the API and allow you to suggest changes or enhancements to the API before its finally created (visit the Forum to discuss things)

Please Note : Most of this section will be replaced with high-level information and links to the Cubiverse API Documentation


Most of your scripting takes place inside Java-script objects, which are inherited from some base object that Cubiverse provides.

cubiScript objects - Normal voxels (grass, snow, etc.) use cubiScript as a basis for al script actions.

World related object - [N/S] These objects provide access to world and game parameters.

Static Objects

These objects are always available to your worlds and Java-script, they are created by Cubiverse when your world is instigated (i.e. you or another player logs in)

HUD object - Add text, controls and various user interface components to guide, or interact with your players.


Entities are things that cause other actions to occur, such as spawning players, mobs or controlling time of day or weather.

Player Spawning Entity - This entity is used to decide the location of a player spawn point in the world.

Mob Spawning Entity - This entity is used to decide the location of mob spawn point in the world.


Events are triggered by something happening in the world, events are specific to the object you want to script. For example cubes have the ability to tell you someone is trying to push it around, but he world has no such event as it cannot be pushed around.

Cube related events - These are events related to cubes such as walking, touching, shooting, etc.

World related events - [N/S] These are events that occur in the world such as game start, game end, time of day, etc.

Player related events - [N/S] These events occur on the players as they move around the world such as falling, jumping, shot, being attacked, etc.

API Calls

General API Calls -[N/S] These functions can be called from anything, they provide both information (such as time of day) and helper functions.

Cube API calls - These are functions you can call that affect the current Cube and are only available for Cubes.

Environmental API Calls - [N/S] These functions affect environmental aspects of the game world such as cloud cover, world time, etc.

Player API Calls - [N/S] These calls affect one or more players, including setting gravity or fall damage amounts.

Movement Pipeline API Calls - These calls affect cube movement pipelines, changing the order of movements or erasing them.