...
Note |
---|
Messages printed with <debug_text> are usually only visible when the “scripts” debug filter is enabled. Launch the game with parameters like this:
Script errors and <debug_text> messages with |
Each child action in a <do_any> node can have a weight attribute, which can be used to control the random selection of an action node. The default weight of a child node is 1.
...
You can concatenate string literals using the + operator, but there is also a printf-like formatting syntax, which is easier to use than concatenating lots of small pieces:
...
Data type (= value name) | Examples | Description |
---|---|---|
class | class.ship class.ship_xl class.space class.weapon | Component classes |
purpose | purpose.combat purpose.transportation | Purposes |
killmethod | killmethod.hitbybullet killmethod.hitbymissile | Ways to die (already used before destruction) |
datatype | datatype.float datatype.component datatype.class datatype.datatype | Script value datatypes (see typeof operator above) |
profile | profile.flat profile.increasing profile.bell | Probability distribution profile (see random ranges below) |
cuestate | cuestate.waiting cuestate.active cuestate.complete | Cue states (see above) |
level | level.easy level.medium level.veryhard | Mission difficulty levels (comparable with each other using lt, gt, etc.) |
attention | attention.insector attention.visible attention.adjacentzone | Attention levels (comparable with each other using lt, gt, etc.) |
ware | ware.ore ware.silicon | Wares |
race | race.argon race.boron | Races |
faction | faction.player faction.argongovernment | Factions |
Note |
---|
With the typeof operator you can get the datatype of any expression and compare it with what you expect, for example:
However, you should not compare the type to datatype.string because there are strings that have different data types. To check for a string you should use the datatype's property "isstring" instead. For example, to check if the variable $value is a string, use the following term:
|
Info |
---|
There is also the datatype “tag” with the lookup name “tag” - however, this is not an enumeration type. Looking up a value by name never fails, you actually create a tag value for a given name if it does not exist. For example, if you have a typo, like “tag.mision” instead of “tag.mission”, there won’t be an error because any name is valid for a tag, and the tag “mision” is created on its first use. |
Player properties
You can access many player-related game properties via the keyword “player”:
player.name: The player’s name
player.age: The passed in-game time since game start
player.money: The money in the player’s account
player.ship: The ship the player is currently on (not necessarily the player's ship), or null if the player is on a station
- player.primaryship: The ship that the player controls player's own ship (but the player is not necessarily on board)
- player.entity: The actual player object
player.zone, player.sector, player.cluster, player.galaxy: Location of the player entity
player.copilot: The co-pilot NPC
Components, like The game consists of objects of different classes (zones, ships, spacesstations, or NPCs, have their own properties. The available properties depend on the particular component type, even if there is only one script datatype for components. So ships may have the property “speed”, but stations don’tNPCs). They have the common datatype "component", however, they have different properties, e.g. NPCs have the property "race", but ships don't.
Safe properties
Most properties cause errors if you use them on non-existing objects, such as destroyed ships. There are a few exceptions:
...