Avorion Wiki
Register
Advertisement

The Avorion installation includes an extensive scripting API. You can find the complete exposed API in your Avorion installation directory, in Documentation/index.html. Open it with your browser.

Depending on whether the script runs on the client or server application of the game, different Objects and Functions of the API will be available. For example, you won't find major game-changing functions on the client since those must be synchronized with the server. You also won't find any UI or rendering-related functions on the server, since the server doesn't do visualization.

Note: Since the game and thus the API is ever changing and evolving and depends on the version of Avorion, we won't list the API in the wiki here. Check out your Avorion installation folder if you want to access the API.

Example Scripts & Predefined Functions[ | ]

In the predefined functions section of the API, you can find all functions that are called by Avorion in the scripts it loads, including loads of documentation on how they're called, when, and so on. You can also find large generated file templates with all possible functions defined for these kinds of scripts.

Callbacks[ | ]

In the callbacks section you can find an overview of all callbacks of all objects that you can register to in the game.

Objects[ | ]

The API contains a lot of different objects, that represent objects in the game. Some objects are used as references only and creating that object in a script will only create a new reference to an existing object in the game (example: Entity).

Some objects are only available on the client (ie. Music, Mouse, Keyboard), while some others are only available on the server (ie. Galaxy).

Since objects can vary tremendously in their functionality, please consult the documentation of the object you want to work with for more information.

Enums[ | ]

Enums contain various, predefined values. One example for an enum would be the RarityType, which at the time of this writing would look like this, if declared in lua:

RarityType =
{
    Petty = -1,
    Common = 0,
    Uncommon = 1,
    Rare = 2,
    Exceptional = 3,
    Exotic = 4,
    Legendary = 5,
}

Free Functions[ | ]

There are also a lot of free functions defined in the API, that are not specifically bound to an object.

See Also[ | ]

Advertisement