# Avorion Script API Documentation

Home Functions Search
Search:

Alliance [Client] Alliance
Properties
fullLogId
index
infiniteResources
isAIFaction
isAlliance
isPlayer
maxNumShips
maxNumStations
money
name
numShips
Member Functions
addRank
addRankPrivilege
callbacksRegistered
canPay
contains
getAllRelations
getHomeSectorCoordinates
getInventory
getKnownSector
getKnownSectorCoordinates
getKnownSectors
getKnownSectorsOfFaction
getKnownSectorsWithFaction
getMemberLocation
getMemberRank
getNamesOfShipsInSector
getPlanStyle
getPlanStyleNames
getRank
getRelation
getRelations
getRelationStatus
getResources
getShipAvailability
getShipBoundingBox
getShipCanPassRifts
getShipCargo
getShipCargos
getShipDestroyed
getShipHyperspaceReach
getShipIcon
getShipNames
getShipOrderInfo
getShipPayment
getShipPaymentTime
getShipPlan
getShipPosition
getShipReconstructionValue
getShipStatus
getShipSystems
getShipTurretDesigns
getShipType
hasPrivilege
invokeFunction
knowsFaction
knowsSector
moveRank
ownsShip
rankExists
registerCallback
removeRank
removeRankPrivilege
sendCallback
setMemberRank
unregisterCallback

# Alliance [Client]

This object is only available on the client.

function Alliance()

Returns

A new instance of Alliance

property string fullLogId | [read-only]

property int index | [read-only]

property bool infiniteResources |

property bool isAIFaction | [read-only]

property bool isAlliance | [read-only]

property bool isPlayer | [read-only]

property int maxNumShips | [read-only]

property int maxNumStations | [read-only]

property int money | [read-only]

property string name | [read-only]

property unsigned int numShips | [read-only]

function var addRank(string name, string lowerName)

Returns

nothing

function var addRankPrivilege(string rank, int privilege)

Returns

nothing

function int callbacksRegistered(string callbackName, var functionName)

Check how many functions are registered to a callback from the current script VM.

Parameters

callbackName The name of the callback
functionName The name of the function for which to check. If nil, will count all functions that are registered to this callback.

Returns

The amount of functions registered to the callback

function bool, string, table<int, string> canPay()

function bool contains(int playerIndex)

function Relation... getAllRelations()

function int, int getHomeSectorCoordinates()

function Inventory getInventory()

function SectorView getKnownSector(int x, int y)

function ivec2... getKnownSectorCoordinates()

function SectorView... getKnownSectors()

function SectorView... getKnownSectorsOfFaction(int factionIndex)

function SectorView... getKnownSectorsWithFaction(int factionIndex)

function int, int getMemberLocation(int playerIndex)

function AllianceRank getMemberRank(int playerIndex)

function string... getNamesOfShipsInSector(int x, int y)

function PlanStyle getPlanStyle(string name)

function string... getPlanStyleNames()

function AllianceRank getRank(string name)

function Relation getRelation(int factionIndex)

function int getRelations(int factionIndex)

function int getRelationStatus(int factionIndex)

function Resources getResources()

function ShipAvailability getShipAvailability(string name)

function Box getShipBoundingBox(string name)

function bool getShipCanPassRifts(string name)

function CargoBay getShipCargo(string name)

function table<TradingGood, int> getShipCargos(string name)

function bool getShipDestroyed(string name)

function float getShipHyperspaceReach(string name)

function string getShipIcon(string name)

function string... getShipNames()

function string getShipOrderInfo(string name)

function float getShipPayment(string name)

function float getShipPaymentTime(string name)

function BlockPlan getShipPlan(string name)

function Coordinates getShipPosition(string name)

function double getShipReconstructionValue(string name)

function string getShipStatus(string name)

function ShipInfoUpgrade... getShipSystems(string name)

function table<int, TurretDesign> getShipTurretDesigns(string name)

function int getShipType(string name)

function bool hasPrivilege(int playerIndex, int privilege)

function var... invokeFunction(var scriptName, string functionName, var... arguments)

Invokes a function in a script of the alliance. Use this function to invoke functions from one script in another script. The first return value of the function is an integer indicating whether or not the call was successful. When it was, this integer is followed by the return values of the invoked function.

Parameters

scriptName The name of the script containing the function
functionName The name of the function that will be executed
arguments An arbitrary list of arguments that will be given to the invoked function. Only numbers, std::strings and nil are supported here.

Returns

Returns at least 1 value indicating if the call succeeded:
0 The call was successful. In this case, the return values of the script are returned in addition to the call result, following the call result.
3 The call failed because the given script was not found in the alliance.
4 The call failed because the given function was not found in the script.
5 The call failed because the script's state has errors and is invalid

function bool knowsFaction(int factionIndex)

function bool knowsSector(int x, int y)

function var moveRank(string name, string lowerName)

Returns

nothing

function bool ownsShip(string name)

function bool rankExists(string rank)

function var registerCallback(string callbackName, string functionName)

Register a callback in the alliance. The callback will be removed when the sector is changed or the receiver, if it's an entity, is destroyed. Double registration of callbacks doesn't work. When the same callback to the same callback of the same script instance is registered twice, it will still only be called once.

Parameters

callbackName The name of the callback
functionName The name of the function that will be executed in the script when the callback happens

Returns

nothing

function var removeRank(string name)

Returns

nothing

function var removeRankPrivilege(string rankName, int privilege)

Returns

nothing

function var sendCallback()

Returns

nothing

function var setMemberRank(int playerIndex, string rank)

Returns

nothing

function var unregisterCallback(string , string )

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