Scripting Documentation

Mission values

SetMissionInt(string key, int value)
Set the value of a mission int with ID key. Mission values can be accessed by ID and stay in memory for the duration of a mission.

AdjustMissionInt(string key, int amount)
Add amount (positive or negative) to a mission int with ID key. Mission values can be accessed by ID and stay in memory for the duration of a mission.

GetMissionInt(string key) returns int
Return the value of a mission int with ID key. Mission values can be accessed by ID and stay in memory for the duration of a mission.

SetMissionFloat(string key, float value)
Set the value of a mission float with ID key. Mission values can be accessed by ID and stay in memory for the duration of a mission.

GetMissionFloat(string key) returns float
Add $2 (positive or negative) to a mission float with ID key. Mission values can be accessed by ID and stay in memory for the duration of a mission.

AdjustMissionFloat(string key, float amount)
Return the value of a mission float with ID key. Mission values can be accessed by ID and stay in memory for the duration of a mission.

SetMissionBool(string key, bool value)
Set the value of a mission bool with ID key. Mission values can be accessed by ID and stay in memory for the duration of a mission.

GetMissionBool(string key) returns bool
Return the value of a mission bool with ID key. Mission values can be accessed by ID and stay in memory for the duration of a mission.

SetMissionString(string key, string value)
Set the value of a mission string with ID key. Mission values can be accessed by ID and stay in memory for the duration of a mission.

GetMissionString(string key) returns string
Return the value of a mission string with ID key. Mission values can be accessed by ID and stay in memory for the duration of a mission.

Player Data

GetCredits() returns int
Returns player's current number of credits. Will adjust accordingly during a network run, but will only be applied upon exiting the network.

AddCredits(int amount, bool wasLooted)
Add $amount credits to the player's account. $wasLooted determines whether the extra credits are considered looted or simply gained in some other way.
This is a visual difference in the end mission screen only. Will adjust accordingly during a network run, but total will only be applied upon exiting the network.

RemoveCredits(int amount)
Remove $amount credits from the player's account. Will adjust accordingly during a network run, but total will only be applied upon exiting the network.

Sound

PlaySFX(string fileName)
Play the sound effect with filename fileName (case-sensitive and without extension). The clip has to be a .wav file placed in the Audio folder under the campaign's root directory.

PlaySFX("Glitch5") 

Node Map

SetConnectionActive(string nodeAddressFrom, string nodeAddressTo, bool active)
Set a node connection (from nodeAddressFrom to nodeAddressTo) active or inactive based on active.

SetConnectionActive("c0", "f1", true) 

IsConnectionActive(string nodeAddressFrom, string nodeAddressTo) returns bool
Returns whether the node connection from nodeAddressFrom to nodeAddressTo is active or inactive.

if (IsConnectionActive("c0", "f1")) 
// do something 
endif 

TeleportToNode(string nodeAddress)
Teleport the player to node with address nodeAddress.

TeleportToNode("d2") 

Deactivate(string nodeAddress)
Deactivate the node with address nodeAddress. Only works for System and Data nodes.

Deactivate("s0") 

ReactivateSystemNode(string nodeAddress)
Reactivate the node with address nodeAddress. Only works for system nodes.

ReactivateSystemNode("s0") 

PanCameraToNode(string nodeAddress)
Pan the camera to the node with address nodeAddress.

PanCameraToNode("d2") 

SetCameraZoomLevel(float zoomLevel)
Set the camera zoom level to zoomLevel, min 0.5, max 2. The default zoom level is 1. 0.5 will zoom the camera out to twice the normal distance, 2 will bring the camera in close to half the normal distance.

SetCameraZoomLevel(0.7) 

AddObjective(string key, string displayName)
Adds an objective with text displayName. key is an identifier for referring to the same objective elsewhere.

AddObjective("findServer", "Find the server") 

AddObjective(string key, string displayName, string nodeAddress)
Adds an objective with text displayName. key is an identifier for referring to the same objective elsewhere. Node nodeAddress will be marked with an objective marker.

AddObjective("beatEncryption", "Disable the network encryption", "e1") 

CompleteObjective(string key)
Complete the objective with identifier $4. See AddObjective.

CompleteObjective("beatEncryption") 

IsObjectiveCompleted(string key) returns bool
Returns whether the objective with identifier key has been completed. See AddObjective.

if (IsObjectiveCompleted("beatEncryption")) 
// congratulate! 
endif 

IncreaseTrace()
Increase the trace by 1.

IncreaseTrace() 

IncreaseTrace(int amount)
Increase the trace by amount.

IncreaseTrace(2) 

DecreaseTrace(int amount)
Decrease the trace by amount.

DecreaseTrace(2) 

GetTrace() returns int
Returns the current trace amount.

GetTrace() 

InstallICE(string nodeAddressFrom, string nodeAddressTo, string ice)
Install ICE of type ice (case insensitive) on the connection from nodeAddressFrom to nodeAddressTo.

InstallICE("c2", "f1", "firewall") 
ICE Identifiers
eulergate
binarywall
blackout
collar
firewall
fractalnet
hangman
icewall
adbot
newton
rook
scorpion
sundrop
themaw

HasICE(string nodeAddressFrom, string nodeAddressTo) returns bool
Returns whether connection from nodeAddressFrom to nodeAddressTo has ICE installed on it.

if (!HasICE("c3", "c4")) 
	InstallICE("c3", "c4", "hangman") 
endif 

HasICE(string nodeAddressFrom, string nodeAddressTo, string ice) returns bool
Returns whether connection from nodeAddressFrom to nodeAddressTo has ICE of type ice (case insensitive) installed on it. See InstallICE for a list of ICE identifiers.

if (!HasICE("c3", "c4", "hangman")) 
	InstallICE("c3", "c4", "hangman") 
endif 

IsNodeEncrypted(string address) returns bool
Returns whether node address has active encryptions. Returns false if address does not exist.

if (IsNodeEncrypted("s0")) 
	// warn player 
endif 

Input

ShowInputField(string id, string header)
Show a single-line text input field with header as header. id is an identifier for referring to the same input field elsewhere.

ShowInputField("searchTerm") 

ShowInputField(string id, string header, string message)
Show a single-line text input field with header as header and message as description text. id is an identifier for referring to the same input field elsewhere.

ShowInputField("searchTerm") 

RemoveInputField(string id)
Remove input field with identifier id. See ShowInputField.

RemoveInputField("searchTerm") 

InputFieldSubmitted(string id) returns bool
Returns false while input field with identifier id has not yet been submitted (player pressed enter). See ShowInputField.

while (!InputFieldSubmitted("searchTerm")) 
	Sleep() 
endwhile 
 
ShowPopup("No results for search term: " + GetSubmittedInput("searchTerm")) 

GetSubmittedInput(string id) returns string
Get entered text from input field with identifier id. See ShowInputField.

while (!GetSubmittedInput("searchTerm")) 
	Sleep() 
endwhile 
 
ShowPopup("No results for search term: " + GetSubmittedInput("searchTerm")) 

Utilities

ShowPopup(string message)
Show a popup with text message.

ShowPopup("You have entered a forbidden part of the network.") 

ShowPopup(string message, string header)
Show a popup with text message and header header.

ShowPopup("You have entered a forbidden part of the network.", "WARNING") 

ShowText(string message)
Show a bar with text message above the player's current node position.

ShowText("MADE A NEW ENEMY") 

ShowText(string nodeAddress, string message)
Show a bar with text message above the node with address nodeAddress.

ShowText("d1", "DOWNLOADED STATE SECRETS") 

AddCampaignNote(string note)
Adds a campaign note note. Campaign notes can be used to filter e-mail responses or influence campaign progress. They are also displayed on the summary page before loading the campaign save.

AddCampaignNote("Helped a friend") 

HasCampaignNote(string note) returns bool
Does the player already have campaign note note?

if (HasCampaignNote("Helped a friend")) 
endif 

StartCutscene()
Disables player input, freezes turn and stores last camera target in memory.

EndCutscene()
Enables player input, unfreezes turn and restores last camera target. See StartCutscene.

SetTurnDescription(string description)
Sets the text displayed under a turn-taker's name to description. Only has an effect if the turn indicator (horizontal bar across the screen) is already visible. (E.g. in the network turn.)

SetTurnDescription("Thinking...") 
Sleep(1f) 
SetTurnDescription("Time for action!") 
endif 

Boolean Logic

operator ! , bool value returns bool
Logical NOT. Returns opposite of value.

operator && bool valueA , bool valueB returns bool
Logical AND. Returns true if both valueA and valueB are true.

operator || bool valueA , bool valueB returns bool
Logical OR. Returns true if either valueA or valueB is true, or both.

Debugging

Log(string message)
Writes log message message to the player log file. Use with caution, can impact performance at high frequency.

Log(string message, bool displayInGame)
Writes log message message to the player log file. Use with caution, can impact performance at high frequency. If displayInGame is true, will also write to the in-game debug output.

Log(int value)
Writes log message value to the player log file. Use with caution, can impact performance at high frequency.

Log(int value, bool displayInGame)
Writes log message value to the player log file. Use with caution, can impact performance at high frequency. If displayInGame is true, will also write to the in-game debug output.

Log(float value)
Writes log message value to the player log file. Use with caution, can impact performance at high frequency.

Log(float value, bool displayInGame)
Writes log message value to the player log file. Use with caution, can impact performance at high frequency. If displayInGame is true, will also write to the in-game debug output.

Log(bool value)
Writes log message value to the player log file. Use with caution, can impact performance at high frequency.

Log(bool value, bool displayInGame)
Writes log message value to the player log file. Use with caution, can impact performance at high frequency. If displayInGame is true, will also write to the in-game debug output.

LogWarning(string message)
Writes warning message message to the player log file. Use with caution, can impact performance at high frequency.

LogWarning(string message, bool displayInGame)
Writes warning message message to the player log file. Use with caution, can impact performance at high frequency. If displayInGame is true, will also write to the in-game debug output.

LogWarning(int value)
Writes warning message value to the player log file. Use with caution, can impact performance at high frequency.

LogWarning(int value, bool displayInGame)
Writes warning message value to the player log file. Use with caution, can impact performance at high frequency. If displayInGame is true, will also write to the in-game debug output.

LogWarning(float value)
Writes warning message value to the player log file. Use with caution, can impact performance at high frequency.

LogWarning(float value, bool displayInGame)
Writes warning message value to the player log file. Use with caution, can impact performance at high frequency. If displayInGame is true, will also write to the in-game debug output.

LogWarning(bool value)
Writes warning message value to the player log file. Use with caution, can impact performance at high frequency.

LogWarning(bool value, bool displayInGame)
Writes warning message value to the player log file. Use with caution, can impact performance at high frequency. If displayInGame is true, will also write to the in-game debug output.

LogError(string message)
Writes error message message to the player log file. Use with caution, can impact performance at high frequency.

LogError(string message, bool displayInGame)
Writes error message message to the player log file. Use with caution, can impact performance at high frequency. If displayInGame is true, will also write to the in-game debug output.

LogError(int value)
Writes error message value to the player log file. Use with caution, can impact performance at high frequency.

LogError(int value, bool displayInGame)
Writes error message value to the player log file. Use with caution, can impact performance at high frequency. If displayInGame is true, will also write to the in-game debug output.

LogError(float value)
Writes error message value to the player log file. Use with caution, can impact performance at high frequency.

LogError(float value, bool displayInGame)
Writes error message value to the player log file. Use with caution, can impact performance at high frequency. If displayInGame is true, will also write to the in-game debug output.

LogError(bool value)
Writes error message value to the player log file. Use with caution, can impact performance at high frequency.

LogError(bool value, bool displayInGame)
Writes error message value to the player log file. Use with caution, can impact performance at high frequency. If displayInGame is true, will also write to the in-game debug output.

Equality

operator < float valueA , float valueB returns bool
Returns whether valueA is less than valueB.

operator <= float valueA , float valueB returns bool
Returns whether valueA is less than or equal to valueB.

operator > float valueA , float valueB returns bool
Returns whether valueA is greater than valueB.

operator >= float valueA , float valueB returns bool
Returns whether valueA is greater than or equal to valueB.

operator < int valueA , int valueB returns bool
Returns whether valueA is less than valueB.

operator <= int valueA , int valueB returns bool
Returns whether valueA is less than or equal to valueB.

operator > int valueA , int valueB returns bool
Returns whether valueA is greater than valueB.

operator >= int valueA , int valueB returns bool
Returns whether valueA is greater than or equal to valueB.

operator == int valueA , int valueB returns bool
Returns whether valueA is equal to valueB.

operator == bool valueA , bool valueB returns bool
Returns whether valueA is equal to valueB.

operator == string valueA , string valueB returns bool
Returns whether valueA is equal to valueB.

operator != int valueA , int valueB returns bool
Returns whether valueA is not equal to valueB.

operator != bool valueA , bool valueB returns bool
Returns whether valueA is not equal to valueB.

operator != string valueA , string valueB returns bool
Returns whether valueA is not equal to valueB.

Script Execution

Sleep()
Pauses the script and makes it resume from this point in the next game frame.

while ($keepWaiting) 
	Sleep() 
endwhile 

Stop()
Stops script execution permanently.

Math

operator + float valueA , float valueB returns float

operator + int valueA , int valueB returns int

operator + float valueA , int valueB returns float

operator + int valueA , float valueB returns float

operator - float valueA , float valueB returns float

operator - int valueA , int valueB returns int

operator - float valueA , int valueB returns float

operator - int valueA , float valueB returns float

operator * float valueA , float valueB returns float

operator * int valueA , int valueB returns int

operator * float valueA , int valueB returns float

operator * int valueA , float valueB returns float

operator / float valueA , float valueB returns float

operator / int valueA , int valueB returns int

operator / int valueA , float valueB returns float

operator / float valueA , int valueB returns float

operator % float valueA , float valueB returns float

operator % int valueA , int valueB returns int

operator % int valueA , float valueB returns float

operator % float valueA , int valueB returns float

Absolute(float number) returns float

Absolute(int number) returns int

Randomness

RandomValue() returns float
Returns a random value between 0 (inclusive) and 1 (inclusive).

RandomBetween(float min, float max) returns float
Returns a random value between min (inclusive) and max (inclusive).

RandomBetween(int min, int max) returns int
Returns a random value between min (inclusive) and max (exclusive).

Text

operator + string stringA , string stringB returns string
Combine stringA and stringB into a single string.

ToString(bool value) returns string
Converts value to a string.

ToString(int value) returns string
Converts value to a string.

ToString(float value) returns string
Converts value to a string.

IsEmptyString(string value) returns bool
Returns whether value is an empty string.

ToLower(string value) returns string
Returns value with all characters in lower case.

ToUpper(string value) returns string
Returns value with all characters in upper case.

ToInt(string value, int failValue) returns int
Tries to interpret string value as an int. If value is improperly formatted to allow this, returns failValue instead. See CanConvertToInt.

ToFloat(string value, float failValue) returns float
Tries to interpret string value as a float. If value is improperly formatted to allow this, returns failValue instead. See CanConvertToFloat.

CanConvertToInt(string value) returns bool
Returns whether value is formatted in a way that allow conversion to an int.

CanConvertToFloat(string value) returns bool
Returns whether value is formatted in a way that allow conversion to a float.

Time

GetTime() returns float
Returns time since start of the game in seconds.

GetLastFrameDuration() returns float
Returns the duration of the last game frame in seconds. Use this to e.g. add to a timer every frame.

set($timer, $timer + GetLastFrameDuration()) 

Script Execution

Sleep(float seconds)
Pauses the script for seconds seconds and makes it resume from this point afterwards.

StartCutscene() 
PanCameraToNode("s1") 
Sleep(2f) 
EndCutscene();