SCOPES: ​

Code: father = { save_scope_as = cool_person } scope:cool_person = { kill_painfully = yes }

SCRIPT LISTS: ​

Any: Is a trigger that returns true if any of the list meet certain conditions, can have an optional count or percent parameter to indicate X many or Y percent of the list must meet the conditions

Every: Runs effects on all members of the list if they meet certain conditions. Can have multiple alternative_limits for backup conditions if the previous set was not met.

Random: Runs effects one one member of the list if they meet certain conditions. Can also have alternative_limits as well as a weight to influence which random object to run effects on.

Ordered: Runs effect on the entry in a list based on position or range of positions. The list can be ordered by any script value such as loyalty or gold. Can have a limit and alternative_limits on it to filter members of the list.

VARIABLES: ​

Code: var:name local_var:name global_var:name

LISTS: ​

Code: every_character = { limit = { has_variable = olympic_attendee } add_to_list = olympic_competitor_list } random_in_list = { list = olympic_competitor_list die_very_painfully = yes }

SWEET SWEET DOCUMENTATION: ​

All effects, the scopes they can be used in and a brief description, if they are a script list the scope they lead to.

All triggers, the scopes they can be used in and a brief description, if they are a script list the scope they lead to.

All scope types, character, country, value etc.

All event target links, the scopes they can be used from, the scope they output to and a brief description.

All saved scopes created by the code.

All modifiers, the scope they can be applied to eg: levy_reinforcement_rate

All on actions, if they are from code or script and the expected scope they are called in

GUI & LOCALIZATION SYSTEM: ​

Types, the type of an object which corresponds to its class/struct in the code Promotes, moving from an object of one type to an object of another Functions, calling a function on an object which returns something Callbacks, calling a function on an object which does not return anything

Scripted GUI ​

Code: # common/scripted_guis cheat_gold_button = { scope = character saved_scopes = { second } is_shown = { # Can be omitted as always true always = yes } is_valid = { gold < 5000 } effect = { add_gold = 500 scope:second = { add_gold = -500 } } } # in a gui entry button = { name = "my_cheat_button" datacontext = "[GetScriptedGui('cheat_gold_button')" texture = "gfx/interface/icons/shared_icons/bankruptcy.dds" visible = "[ScriptedGui.IsShown( GuiScope.SetRoot( SomeCharacter.MakeScope ).AddScope( SomeOtherCharacter.MakeScope ).End )]" enabled = "[ScriptedGui.IsValid( GuiScope.SetRoot( SomeCharacter.MakeScope ).AddScope( SomeOtherCharacter.MakeScope ).End )]" onclick = "[ScriptedGui.Execute( GuiScope.SetRoot( SomeCharacter.MakeScope ).AddScope( SomeOtherCharacter.MakeScope ).End )]" tooltip = "[ScriptedGui.BuildTooltip( GuiScope.SetRoot( SomeCharacter.MakeScope ).AddScope( SomeOtherCharacter.MakeScope ).End )]" }

Script Values ​

Script values ​

Code: add_gold = some_value_name

Code: add_gold = scope:some_country.gold # Adds as much gold as "some_country" has

Mathematical operations ​

Code: some_value_name = { value = scope:some_country.gold add = 50 multiply = 100 }

value = ... # Sets the value to the right-hand-side (RHS)

add = ... # Adds the RHS

subtract = ... # Subtracts the RHS

multiply = ... # Multiplies with the RHS

divide = ... # Divides with the RHS

modulo = ... # Takes the remainder from dividing with the RHS

min = ... # Increases the value to the RHS if it is lower

max = ... # Decreases the value to the RHS if it is higher

floor = yes # Rounds down. 1.2 -> 1, -1.8 -> -2



ceiling = yes # Rounds up



round = yes # Rounds to the nearest integer

Inlining ​

Code: add_gold = { value = scope:some_country.gold add = 50 multiply = 100 }

Code: add_gold = { value = gold multiply = { value = prestige add = 50 } }

Conditional logic

​

Code: add_gold = { value = 100 if = { limit = { has_innovation = some_innovation } multiply = 3 } else_if = { limit = { has_innovation = some_other_innovation } multiply = 2 } }

Ranges ​

Code: add_gold = { 10 100 }

Code: add_gold = { some_value some_other_value }

Code: add_gold = { integer_range = { min = { value = gold multiply = 2 } max = { value = gold multiply = 10 } } }

Lists ​

Code: add_gold = { every_subject= { add = gold } }

Code: add_gold = { overlord = { every_subject = { add = gold } } }

​