# Avorion Script API Documentation

Home Functions Search
Search:

ScriptUI ScriptUI
Properties
entity
entityId
Member Functions
addDialogOption
createWindow
interactShowDialog
registerInteraction
registerWindow
restartInteraction
showDialog
startHailing
stopHailing
stopInteraction

# 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:
Callbacks
Callbacks Alliance [Client] Callbacks Alliance [Server] Callbacks Alliance [Server] Callbacks Entity Callbacks Galaxy Callbacks Player Callbacks Player [Client] Callbacks Sector Callbacks Server Callbacks
Predefined Functions & Example Scripts
Command Entity FactionDatabase PlanGenerator Player Sector Server UsableInventoryItem
Common Components
Boarding BspTree CargoBay CargoLoot ControlUnit CrewComponent DeletionTimer DirectFlightPhysics DockingClamps DockingParent DockingPositions Durability EnergySystem Engine FighterAI Hangar HyperspaceEngine InteractionText InventoryItemLoot Owner Physics Plan ReadOnlyBoarding ReadOnlyBspTree ReadOnlyCargoBay ReadOnlyControlUnit ReadOnlyCrew ReadOnlyDeletionTimer ReadOnlyEnergySystem ReadOnlyEngine ReadOnlyFighterAI ReadOnlyHangar ReadOnlyHyperspaceEngine ReadOnlyInteractionText ReadOnlyOwner ReadOnlyPhysics ReadOnlyPlan ReadOnlyShipAI ReadOnlyShipSystem ReadOnlyTorpedoAI [Server] [Client] [Server] [Client] ReadOnlyTorpedoAI [Server] [Client] [Server] [Client] ReadOnlyTorpedoLauncher ReadOnlyTurretBases ReadOnlyVelocity ReadOnlyWeapons ReadOnlyWormHole Shield ShipAI ShipSystem StructuralIntegrity SystemUpgradeLoot Thrusters Torpedo TorpedoAI TorpedoLauncher Turret TurretAI TurretBases Velocity Weapons WormHole
Common Objects
AllianceMember AllianceRank BlockPlan BlockPlanBlock BlockStatistics Box Captain Color ControlUnitSeat CraftDesign CraftStatsOverview Crew CrewMan CrewProfession DebugInfo dvec2 dvec3 dvec4 Entity EntityDescriptor FighterTemplate Format GameSettings Group HighResolutionTimer Inventory InventoryTurret ivec2 ivec3 ivec4 Language Mail Material Matrix ModManager NamedFormat PlanBspTree PlanetSpecifics PlanGenerationStage PlanPart PlanStyle PlayerId PluralForm Profiler QuadTree Random Rarity Ray ReadOnlyEntity Rect Relation Scenario SectorView Seed Sphere Squad SystemUpgradeTemplate Timer Tooltip TooltipLine TorpedoShaft TorpedoTemplate TradingGood TurretDesign TurretDesignPart TurretTemplate UsableInventoryItem Uuid VanillaInventoryItem vec2 vec3 vec4 Version Weapon
Client Components
EntityIcon EntityTooltip PlanMesh ReadOnlyIcon ReadOnlyPlanMesh ReadOnlyScriptUI ReadOnlyTooltip ScriptUI
Client Objects
Achievements Alliance [Client] CameraKeyFrame CaptainSelectionItem Client ClientSettings ColorSelectionItem CraftDesignSelectionItem Faction [Client] Galaxy [Client] GalaxyMap GameInput GlowFX IconSelectionItem InputWindow InventoryReferenceSelectionItem InventorySelectionItem Keyboard LaserFX Mouse Music PixelIconSelectionItem Planet Player [Client] PlayerWindow RefractionFX Sector [Client] SelectionItem ShipDatabaseEntry [Client] SoundSource StrategyState TargetIndicator TooltipRenderer TurretDesignSelectionItem
Client UI Objects
AllianceEmblem AllianceTab ArrowLine Button [Client] [Client] Button [Client] [Client] CaptainIcon CaptainProfile CheckBox ComboBox ContextMenu CraftPortrait CrewBar Frame Hud InventorySelection Label Line ListBox ListBoxEx MapArrowLine MapIcon MultiLineTextBox NumbersBar Picture PlanDisplayer ProgressBar SavedDesignsSelection ScrollFrame Selection ShipWindow Slider StatisticsBar Tab TabbedWindow TextBox TextField TooltipDisplayer Tree UIArbitraryHorizontalSplitter UIArbitraryVerticalSplitter UIContainer UIElement UIGridSplitter UIHorizontalLister UIHorizontalMultiSplitter UIHorizontalSplitter UIOrganizer UIRect UIRenderer UIVerticalLister UIVerticalMultiSplitter UIVerticalSplitter ValueComboBox Window
Server Components
EntityTransferrer FighterController Loot ReadOnlyEntityTransferrer ReadOnlyFighterController ReadOnlyLoot ReadOnlyTurretController ReadOnlyWreckageCreator TurretController WreckageCreator
Server Objects
Alliance [Server] Faction [Server] Galaxy [Server] Player [Server] ReadOnlySector Sector [Server] Server ShipDatabaseEntry [Server]
Enums
AIState AlliancePrivilege BeamShape BlockShading BlockStructure BlockType BlockType2 BoxType BuildError CaptainGenderId ChatChannel ChatMessageType ComponentType ControlAction ControlActionBit ControlStyle CoolingType CraftStatsOverviewStat CrewProfessionType CrewRank DamageSource DamageType DeletionType Difficulty EntityArrivalType EntityType FighterOrders FighterStartError FighterType FontType ImpactParticles InventoryItemType JumpError KeyboardKey ListBoxEntryType MalusReason MaterialType MoonType MouseButton PlanetType PlanTypeFilter PlayerStateType ProjectileShape RarityType RelationStatus SavedDesignType ScenarioType SectorChangeType ShipAvailability SoundType StatsBonuses TargetIndicatorVisuals TransformationFeature TurretAutoFireMode TurretSlotType WeaponAppearance WeaponCategory

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.8 a0d3f0b5b065