Avorion Script API Documentation

ScriptUI

This object is only available on the client.

function ScriptUI(var id)

Parameters

id The id of the entity this component belongs to, or the entity itself, must be an id of an existing entity or nil for the entity in the current script context

Returns

A new instance of ScriptUI

property Entity entity[read-only]
property uuid entityId[read-only]

function int addDialogOption(string text, string function, var priority)

Adds a new dialog option to a dialog that is currently in construction. Dialogs are only in construction during the entity or player callback "onStartDialog". Invoking this function at any other point will do nothing.

Parameters

text The text that will be displayed as a chooseable option in the dialog
function The function that will be called when the dialog option is selected.

function Window createWindow(Rect rect)

function var interactShowDialog(Dialog dialog, var closeable)

Shows a dialog, and forces the player to interact with the entity. This will close and override the currently displayed dialog. A dialog table looks like this: local dialog = {text = "What's up?", textItalic = true/false, textColor = "0f0", talker = "Random Merchant", talkerItalic = true/false, talkerColor = "f00", onStart = "onStartFunctionCall", onEnd = "onEndFunctionCall", followUp = anotherDialogTable, answers = {{...}, {...}, {...}, ...}} Most of these table values are optional and will be filled in with default values if not present. The anwers table looks like this: local answers = {{answer = "Not much.", color = "ff0", italic = true/false, onSelect = "onThisAnswerWasSelectedFunction", followUp = dialogFollowingThisAnswer}, {text = "The Sky.", ...}, ...} Most of these table values are optional and will be filled in with default values if not present. You should check the scripts that come with the game for dialogs to get more info on how to structure them.

Parameters

dialog A table containing the dialog that will be displayed
closeable A value indicating if the dialog can be closed with the Escape key. Disable only with caution! Your dialog must be able to be terminated through every possible answer-way or the player can get stuck. Can be omitted, default is true.

Returns

nothing

function var registerInteraction(string caption, string function, var priority)

Returns

nothing

function var registerWindow(Window window, string caption, var priority)

Returns

nothing

function var restartInteraction()

Returns

nothing

function bool showDialog(Dialog dialog, var closeable)

Shows a dialog, provided that the player is currently in interaction state with the entity. This will close and override the currently displayed dialog. A dialog table looks like this: local dialog = {text = "What's up?", textItalic = true/false, textColor = "0f0", talker = "Random Merchant", talkerItalic = true/false, talkerColor = "f00", onStart = "onStartFunctionCall", onEnd = "onEndFunctionCall", followUp = anotherDialogTable, answers = {{...}, {...}, {...}, ...}} Most of these table values are optional and will be filled in with default values if not present. The anwers table looks like this: local answers = {{answer = "Not much.", color = "ff0", italic = true/false, onSelect = "onThisAnswerWasSelectedFunction", followUp = dialogFollowingThisAnswer}, {text = "The Sky.", ...}, ...} Most of these table values are optional and will be filled in with default values if not present. You should check the scripts that come with the game for dialogs to get more info on how to structure them.

Parameters

dialog A table containing the dialog that will be displayed
closeable A value indicating if the dialog can be closed with the Escape key. Disable only with caution! Your dialog must be able to be terminated through every possible answer-way or the player can get stuck. Can be omitted, default is true.

function var startHailing(string acceptCallback, string rejectCallback)

Have the ship start hailing the player on the client. The player can then accept the hail or reject it. If there is already a hail going on, this function will replace the current hail.

Parameters

acceptCallback The callback that will be called in case the player accepts the hail (dialogs should go in here)
rejectCallback The callback that will be called in case the player rejects the hail (you should avoid putting dialogs in here, since the player doesn't want to communicate)

Returns

nothing

function var stopHailing()

Stop the current hailing.

Returns

nothing

function var stopInteraction()

Returns

nothing

Overview
Home Functions Search
Search:

This is the official documentation for the scripting API of Avorion. This documentation is automatically generated and not necessarily complete. Depending on the context in which functions exist, some documentation such as descriptions, return values or variable names or types may be missing.

Work in Progress. Documentation of Avorion Version: 2.5.7 c8e4beec84f7