Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents
maxLevel3

There have been large number of changes to the Script Engine and Editor.

...

  • More categories and sub menus have been added for the commands to make it easier to find the commands you need
  • Some of the commands have been move to different menus where it makes sense
  • The Search Filter can be used to filter the list of available commands so you can just type in what you are looking for
  • An 'All Commands' section has been added that shows all the commands in a single list, useful when using the search filter
  • The parameter/variable menu has tabs added and split up the various selection so you don't need to scroll a lot to find things
  • The parameter/variable menu also works with the search filter to quickly find things
  • The Search filter also works in the script listing, and the various selection menus.

The Mission Director has also been updated with a number of new features, these are documented in the schema file

Script Constants

The script constants have been expanded with a large number of new constants.
The constants have also been grouped in collapsible groups rather than a single large list.
The search filter is also available to search by text

Code Block
themeMidnight
titleScript Constants
collapsetrue
Find.ExcludeMission
Find.Debris
Allow.NoOne
Allow.Any
Allow.Friends
Allow.Self
Mood.Normal
Mood.Good
Mood.Evil
ShipWare.S
ShipWare.M
ShipWare.L
ShipLoad.Minimum
ShipLoad.Average
ShipLoad.Maximum
Comm.Dlg.Contact
Comm.Dlg.Enemy
Comm.Dlg.Captain.Contact
Comm.Dlg.Captain.Enemy
Comm.Surrender
Comm.SurrenderFreight
Comm.Sorry
Comm.WayShipyard
Comm.WayEquipment
Comm.Dlg.MakeRequest
Comm.Dlg.ListOnboard
Find.ValidType
Find.NoSound
Find.ExcludeDiplomacy
Find.Scanned
Find.NonInvincible
Button.Yes
Button.No
Button.OK
Button.Cancel
Buttons.OKOnly
Buttons.OKCancel
Buttons.YesNo
Buttons.YesNoCancel
MarineSkill.None
MarineSkill.Random
MarineSkill.Fight
MarineSkill.Hacking
MarineSkill.Engineering
MarineSkill.Mechanical
MarineSkill.All
IconType.Gui
IconType.HUD
IconType.Weapons
Notoriety.Ally
Notoriety.Hero
Notoriety.Knight
Notoriety.Friend
Notoriety.Neutral
Notoriety.Foe
Notoriety.Enemy.MainSector
Notoriety.Hunted
Notoriety.Enemy
Notoriety.ArchEnemy
Notoriety.Min
Notoriety.Max
Log.Normal
Log.Alert
Log.Important
Log.Personal
Log.Event
Log.Debug
DockFlag.Hangar
DockFlag.QuickLaunch
DockFlag.LandOnly
DockFlag.StartOnly
DockFlag.TL
DockFlag.TS
DockFlag.M1
DockFlag.M2
DockFlag.M3
DockFlag.M4
DockFlag.M5
DockFlag.M6
DockFlag.TP
DockFlag.M7
DockFlag.TM
DockFlag.M8
DockFlag.Fighter
DockFlag.Transport
DockFlag.LittleShip
DockFlag.HugeShip
DockFlag.BigShip
DockFlag.Standard
Attacked.Ignore
Attacked.Defend
Attacked.Evade
Attacked.Flee
ACTION_FLYTOOBJECT
MEvent.CmdCheck
MEvent.IsSpy
MEvent.AllowMultiple
MEvent.Influence
MEvent.Arguments
MEvent.Start
MEvent.Finished
MEvent.Select
MEvent.Switch
MEvent.Cancelled
MEvent.Context
MEvent.ContextUpd
MEvent.Returned
MEvent.Hotkey
MEvent.Search
Task.Carrier.Fight
Task.Carrier.Supply
Task.Restart
Task.StartFree
Task.StartCustom
Task.EJump
Task.DroneCarrier
Task.Explore
Task.StationMgr
Task.StationPrice
Task.SecSignal
Task.Preload
Task.Turbo
Task.MilitaryDock
Task.MissileDef
Task.StockExchage
Task.Barrage
Task.Graph
Task.Graph2
Vari.Basic
Vari.Vanguard
Vari.Sentinel
Vari.Raider
Vari.Hauler
Vari.Miner
Vari.SF
Vari.Tanker
Vari.Tug
Vari.Luxury
Vari.Slave
Vari.Military
Vari.XL
Vari.Extended
Vari.TankerXL
Vari.SFXL
Vari.SecretV
Vari.SecretS
Vari.SecretR
Vari.SecretH
Vari.Plus
MEvent.Escape
MEvent.TabChanged
MEvent.NextInput
MEvent.Update
MEvent.Closed
MEvent.TradeBar
MEvent.TradeBarCh
MEvent.Selection
MEvent.Group
Abbrev.Classes
Abbrev.Ships
Abbrev.Stations
Abbrev.Weapon
Abbrev.Equipment
Abbrev.Sectors
Abbrev.General
Sound.Success
Sound.Move
Sound.Fail
Event.Activate
Event.Deactivate
Event.SetEnv
Event.Destruct
Event.Attacked
Event.Killed
Event.SelfDestruct
Event.Targeted
Event.Decouple
Event.Captured
Event.GKilled
Event.Finished
Event.Repaired
Event.Claimed
Event.Scanned
Event.Ejected
Event.Collected
Event.SetOwner
Event.Started
Event.Boarded
Callback.TradeBar
Callback.Selection
Callback.Switch
Callback.TabChanged
Callback.All
Callback.Group
Callback.TradeBarCh
MenuWidth.Standard
MenuWidth.Big
MenuWidth.Huge
MEvent.IsDisabled
MEvent.HeadingClick
MEvent.IsHidden
MEvent.Data
MEvent.Upkeep
WareType.Equipment
WareType.Upgrade
WareType.Player
WareType.Once
WareType.Software
WareType.Passenger
WareType.CivPassenger
WareType.Marine
WareType.Ammo
WareType.EquipmentPack
WareType.EquipVolume
WareType.Dummy
WareType.Fluff
WareType.Discovery
WareType.Deployable
Loadout.Shields
Loadout.Lasers
Loadout.Missiles
Loadout.Ammunition
Loadout.Equipment
Loadout.Upgrade
Loadout.Other
Loadout.Settings
MenuColour.Normal
MenuColour.Inverse
MenuColour.Bold
MenuColour.Head
MenuColour.Alert
MenuColour.Player
MenuColour.PlayerShip
MenuColour.TabOn
MenuColour.Black
MenuColour.White
MenuColour.Red
MenuColour.Green
MenuColour.Blue
MenuColour.Grey
MenuColour.Cyan
MenuColour.Magenta
MenuColour.Mouseover
MenuColour.Disabled
MenuColour.Userwing
MenuColour.Wing
MenuColour.GoldWing
MenuColour.RedWing
MenuColour.BlueWing
MenuColour.GreenWing
MenuColour.PurpleWing
MenuColour.WhiteWing
MenuColour.SilverWing
MenuColour.OrangeWing
MenuColour.TabOff
MenuColour.Hired
MenuColour.PlayerControlled
MenuColour.Yellow
TradeBarText.Left1
TradeBarText.Left2
TradeBarText.Right1
TradeBarText.Right2
TradeBarText.InfoLeft
TradeBarText.InfoRight
TradeBarText.NotoLeft
TradeBarText.NotoRight
TradeBarText.NotoBarLeft
TradeBarText.NotoBarRight
Threat.Generic
Threat.Illegal
Threat.Aggressive
Threat.Boarding
Threat.RapidResponse
Threat.CallForHelp
Threat.Invasion
Threat.Attack
GEvent.Series
GEvent.Finished
GEvent.GetOpt
GEvent.SwitchOpt
Kill.GKilled
Kill.Parent
Kill.EnvDestroyed
Kill.SelfDestruct
Kill.Planet
Kill.Collision
Kill.Collected
AgentKill.None
AgentKill.Station
AgentKill.Caught
Client.NoMenus
Client.NoTracker
Client.NoMonitors
Client.NoChangeView
Client.NoChangeShip
Client.NoCommands
Client.NoJumpdrive
Client.NoSectorMusic
Client.NoProperty
Client.NoAccount
Client.NoAttackWarning
Client.LockNotoriety
Client.NoSave
Client.NoSwitchOverlay
Client.NoCustomMenus
Client.NoSideBar
Jump Flags
JumpFlg.Manual
JumpFlg.Quick
JumpFlg.NoDeviceCheck
JumpFlg.NoEnergyCheck
JumpFlg.NoJumpableCheck
BlacklistType.Disabled
BlacklistType.Auto
BlacklistType.Manual
Blacklist.None
Blacklist.Avoid
Blacklist.Block
Blacklist.Whitelist
Pop.Random
Pop.Unknown
Pop.DontShow
Pop.None
Pop.Tiny
Pop.Small
Pop.Average
Pop.Large
Pop.VeryLarge
Pop.Massive
Pop.Custom
Input.Custom
Input.Menus
Input.General
Input.Upgrades
Input.Objects
Input.Freight
Input.Commands
Input.Info
Input.Targeting
Input.Weapons
Input.Flight
Vari.Advanced
Vari.Prototype
Vari.Experimental
Vari.Enhanced
Vari.HeavyTransport
Vari.ArmouredTransport
Vari.HeavyMiner
Vari.Extra1
Vari.Extra2
Vari.Extra3
Vari.Extra4
Text.Decimal
Text.MPS
Text.MPS.S
Text.RPM
Text.MilliSecond
Text.Second
Text.Metre
Text.Kilometre
Text.Yes
Text.No
Text.OK
Text.Credits
Text.1000Sep
Text.TC
Text.Volume
RectC.Bracket
RectC.White
CmdMenu.Nav
CmdMenu.Combat
CmdMenu.Trade
CmdMenu.Special
CmdMenu.Custom
CmdMenu.Piracy
CmdMenu.General
CmdMenu.Fleet
CmdMenu.Carrier
CmdMenu.Drone
CmdMenu.Ship
CmdMenu.Turret
CmdMenu.Station
Units.M
Units.Steer
RaceFlg.NeedLicence
RaceFlg.CorpUseSpk
RaceFlg.Fixed
RaceFlg.FixedNoto
RaceFlg.Pirate
RaceFlg.Piloted
RaceFlg.XUniverse
RaceFlg.Default
RaceFlg.Aggressive
RaceFlg.PilotSub
RaceFlg.HasMarines
RaceFlg.NPC
RaceFlg.Main
RaceFlg.Organised
RaceFlg.HasEconomy
RaceFlg.Terran
RaceFlg.Player
RaceFlg.Known
RaceFlg.DontTalk
RaceFlg.NotoLocked
RaceFlg.DynamicNoto
Context.Trade
Context.Select
Context.Property
Context.ScriptEditor
Context.ScriptSelect
Page.Menus
Page.Input
Page.Sectors
Page.Letters
Page.Greek
Page.MiscVoice
Page.ObjDesc
Page.Encyclopedia
Page.ObjCmds
Page.ObjCmdName
Page.ObjCmdShort
Page.CmdConsole
Page.QMenus
Key.Identity
Key.Details
Key.Comm
Key.Target
Key.Freight
Key.Rename
Key.SectorMap
Key.GalaxyMap
Key.BestBuy
Key.BestSell
Key.ScriptDelete
Find.Player
Find.Hyperspeed
Find.ExcludeGates
Find.ExcludeTerranGates
Find.Unlocked
Find.Deployed
Icon.Diplomacy
Icon.Actions
Icon.Attack
Icon.Barter
Icon.BBS
Icon.WarningY
Icon.WarningR
Icon.Property

 

 List Script Constants

Datatypes

There are a number of new datatypes available. Some related to the new features, others are useful for general scripting.

New Datatypes

  • DATATYPE_AGENT - This is an agent object for use with diplomacy
  • DATATYPE_AGENTCOMMAND - This is a diplomacy task use by agents in diplomacy, similar to ship/station commands
  • DATATYPE_TABLE - See below for Table Info
  • DATATYPE_LOADOUTRET - This is a return value from the ship loadout script commands
  • DATATYPE_MERCHANT - This is for the merchant objects (Barter Menu) for use with script commands to control the barter system
  • DATATYPE_DEALER - Similar to Merchant, but used on the Black Market instead of Barter, most commands can use either merchant or dealer
  • DATATYPE_CARRIERROLE - This is the ship role for use with the carrier management, i.e. Fighter, Defender, Drone, etc
  • DATATYPE_COMMANDMENU - This is one of the sub menus in the ship command menu, i.e. Trade, Combat, General, etc. For use with script commands dealing with command menu changes
  • DATATYPE_GSUBTYPE - This is the Global Subtype class of objects, used by some ship/station information commands
  • DATATYPE_MAINTYPE - This is the main type of a variable in the script engine
  • DATATYPE_TIME - This is a time variable for using ms timing, there are various commands allowing you to manipulate time values
  • DATATYPE_XMLDATA - This stores a parsed xml data structure, for use with reading and writing xml files

 

Tables

Tables will store data based on keys, previously, you had some limited table support by using the global/local variables to store data in string keys, which used tables internally to store this. Now you have more access to the table system, and can use them locally within your scripts. Like arrays, tables are stored by reference, so passing tables between scripts, or storing them in local/global variables will store the pointer to the table, so the same table can be modified across multiple scripts.

The key can be any data type, and you can mix data types within the same table. There are a few exceptions, any datatype where the sub value could be 0 will not function correctly in a table, for example the relation/neutral, most datatype will work fine however.

The main advantage with tables, is that you don't need to set the size of the table, or resize it, it will grow/shrink as needed and is generally quicker at this than arrays. Checking if a key is in the table is also quicker than checking in an array.
However, you cant control the order things will be in a table, so if your data needs to be in a set order, i.e. a sorted list of ships, then it will need to be in an array instead.

To use tables, you first need to allocate one

Code Block
themeMidnight
$table = table alloc

then you add/set data using the normal array commands

Code Block
themeMidnight
$table["key"] = value
$value = $table["key"]

To iterate through a table list you use the get table next command
The key value is the previous key, use null to get the first key in the list.

Code Block
themeMidnight
$key = get next key: table=$table, key=[NULL]
while $key
...
$key = get next key: table=$table, key=$key
end

NOTE: if you need to remove an item from the table while iterating through, make sure you get the next key before removing, IE:

Code Block
themeMidnight
$key = get next key: table=$table, key=null
while $key
$next.key = get next key: table=$table, key=$key
remove $key from table $table
$key = $next.key
end

You can also get all the keys as an array, and iterate through that array instead, this can also allow you to sort the table

NOTE: some of the new script commands will use tables as arguments or return values

Parameter Definitions

There have been a number of Parameter Definitions added.
These are the selection list types for various things, used in the arguments of scripts to get input of a certain type, or for use with the get user input command.
Script commands themselves also use these to limit the parameter selection

Some are related to the new features, others allow more filtering of the existing lists

 

  • Var/Agent Command
  • Var/Agent
  • Var/Table
  • Var/Array/Table
  • Var/LoadoutRet
  • Var/Merchant
  • Var/Dealer
  • Var/Merchant/Dealer
  • Var/CarrierRole
  • Var/CommandMenu
  • Var/Galaxy SubType
  • Var/Main Type
  • Var/Available Ware
  • Var/Space Object
  • Var/Player Station Type
  • Var/Property Group
  • Var/Turret Command
  • Var/Object/Turret Command
  • Var/HSAP
  • Var/Time
  • Var/Retired Agents
  • Var/Laser
  • Var/Shield
  • Var/Missile Type
  • Var/Goods
  • Var/Equipment
  • Var/XMLData
  • Var/Ship Command
  • Var/Custom Wing

Diplomacy Tasks

With the new diplomacy system, you can add your own tasks, this works similar to the command console custom commands where you first register a new command, then set the global map, to map that command with a script. To get input for the script, you can also assign a menu script, this will run the menu using the new input system then send the final arguments onto the diplomacy script. Diplomacy command scripts have the first argument as the Diplomat object that's running the command.

To add a new command, you use:

Code Block
themeMidnight
<RetVar> set agent custom command: script=<scriptname>, pageid=<number>, textid=<number>
<RetVar> set agent custom command: script=<scriptname>, pageid=<number>, textid=<number>, menuscript=<scriptname>, cmdcheck=<boolean>

The return value is the id of the command that's added, with the text and page id of the command. The menu script is the event script to create a menu for input.

The cmdcheck boolean will send the "cmdcheck" event to the menu script, which allows you to determine if the command should be available or not.
You will need to add 3 text entries for the agent command, the Command name, the Command Short Description, and the Command Long Description. These are the text id, text id + 1 and text id + 2.

The diplomacy menu event scripts have a few additional states that control how the command is displayed in the diplomacy menu

The cmdcheck event is sent when the menu is displayed, this works the same as the command console cmdcheck scripts you can use, returning one of the CmdConCheck constants. This event is only sent if the cmdcheck boolean value was set when creating the command, otherwise it will be set to CmdConCheck.Available.

The event "influence" displays the amount of influence need for the command. You can return a value, or you can use one of the script commands for creating the return value, these allow you to specify a range or a minimum amount.
The event "isspy" determines if its a espionage mission, these are displayed in a separate section in the diplomacy menu. Simply return TRUE.
The event "allowmultiple" determines if the command can stack multiple tasks, the return should be a string. This string is displayed as a description in the command menu.

There are also some script commands available to display the status of the current agent.

Code Block
themeMidnight
<Agent> set agent task progress: <number>
This displays the current task progress, the number is the percentage of the bar to display

 

Code Block
themeMidnight
<Agent> set agent task status: <string>
This displays a status string for the agent (what the agent is currently doing)

 

Code Block
themeMidnight
<Agent> set agent start time: <boolean>
This displays a timer instead of the progress bar (use this for commands that run permanently)

Advanced Hotkeys

The hotkey system has been updated to allow customisation, 4 new script commands have been added:

Code Block
themeMidnight
<RetVar> register hotkey event script: script=<script>, type=<number/constant>, page id=<number>, text id=<number>
<RetVar> register hotkey: script=<script>, type=<number/constant>, page id=<number>, text id=<number>, menu=<boolean>
<RetVar> register hotkey event script: scriptname=<script/string>, type=<number/constant>, page id=<number>, text id=<number>
<RetVar> register hotkey: scriptname=<script/string>, type=<number/constant>, page id=<number>, text id=<number>, menu=<boolean>

The <type> argument is used to specify the type of hotkey it is, this determines where it will appear in the controls menu.
The <menu> boolean determines if its a menu hotkey. Menu hotkeys can be used in custom menus, but wont work while in space, setting it to FALSE will be a normal space hotkey
The event hotkeys work slightly differently, where they will send a number of events to the script, instead of just being run when the hotkey is pressed. For the event script, the first argument is the hotkey ID, and the second is a string which is the event.

The events can be:

"pressed" - This is sent when the hotkey is first pressed (doesn't repeat if you hold down the key)
"released" - This is sent when you release the hotkey
"short" - This is sent after "released" and indicates it was pressed for a short time
"long" - This is send after "released" and indicates it was pressed for a longer time
"double" - This is sent instead of a second "pressed" event when a hotkey is pressed twice in a short period of time

Script Commands

A large amount of new script commands has also been added, including some changes to existing ones

List of New Script Commands