Stellaris

Stellaris

~Repeating Script Templates
kuyan-judith  [developer] 11 Oct, 2024 @ 9:44pm
Instructions
(if you want to see examples of these scripts in actual use, you can find a lot of them in my mod Intel Expanded)

***

"foreach" scripts

example

inline_script = { script = foreach/agreement_term_value unit = example_inline_script_path additional_parameters = " my_parameter = my_value " }

expands into a series of inline script calls such as

inline_script = { script = example_inline_script value = joins_overlord_wars_none term = joins_overlord_wars term_type = discrete hidden = no source_mod = vanilla my_parameter = my_value }

one for each agreement term value

"foreach" scripts can be used anywhere inline scripts work

inline_script = { script = foreach/agreement_term_value/joins_overlord_wars unit = example_inline_script_path additional_parameters = " my_parameter = my_value " }

is similar to the above script except it only includes term values where the term is equal to "joins_overlord_wars"

***

"rst/foreach" scripts

example

inline_script = { script = rst/foreach/agreement_term_value repeat = " <some code> " }

lets you get similar effects to what
foreach/agreement_term_value
without needing a separate file for the inline script; it will repeat <some code> for each agreement term values, replacing parameters such as $term$ and $value$ the same way
foreach/agreement_term_value
would.

"rst/foreach" scripts can't be used inside scripted effects, scripted triggers, or script values since in those cases the game will interpret the $ signs as indicating parameters for the effects or triggers. They're also unwieldy for copying code that itsself contains quotation marks, since internal quotation marks inside the "repeat" block will require not just one but multiple escape characters.

***

List of current iterators
(all iterators also have a "$source_mod$" parameter)
(also, note that this mod is mostly generated by a python script such that adding additional iterators or parameters is usually very easy and I will happily do so on request. However the current system only allows one subset iterator per iterator)

/agreement_term_value
available parameters:
  • $value$
  • $term$
  • $term_type$
  • $hidden$
subset iterator:
  • /agreement_term_value/<agreement term>

/agreement_term
available parameters:
  • $term$
  • $term_type$
  • $hidden$

/ascension_perk
available parameters:
  • $ascension_perk$

/astral_action
available parameters:
  • $action$
  • $picture$
  • $unlock_threshold$
  • $allow_unlock$ (raw code, not scripted trigger)

/authority
available parameters:
  • $authority$
  • $playable_trigger$ (scripted trigger containing the contents of the authority's "playable" block
  • $potential$ (raw trigger code (not a scripted trigger) which will evaluate the same as the authority's "potential" trigger)
  • $possible_trigger$ (scripted trigger which will evaluate the same as the authority's "possible" trigger)

/civic
available parameters:
  • $civic$
  • $icon$
  • $playable_trigger$ (scripted trigger containing the contents of the civic's "playable" block
  • $potential_trigger$ (raw trigger code (not a scripted trigger) which will evaluate the same as the civic's "potential" trigger)
  • $potential_type$ (currently broken)
  • $possible_trigger$ (scripted trigger which will evaluate the same as the civic's "possible" trigger)
  • $trait$ (equal to "no" if this civic has no trait)
  • $trait_cost$
  • $trait_cost_sign$ (see "/trait")
  • $trait_initial$ (see "/trait")
  • $trait_randomized$ (see "/trait")
  • $trait_no_opposites_trigger$ (see "/trait")
  • $has_secondary_species$ ("yes" if the civic has a secondary species "no" otherwise)
  • $secondary_species$
  • $secondary_species_trait$
  • $starting_colony$ ("no" if default)
  • $starting_pc_initial$ (see "/habitable_planet_class"
  • $pickable_at_start$
  • $habitability_preference$ ("no" if default)
  • $ideal_pc_initial$ (see "/habitable_planet_class")
  • $random_weight$

/colony_deposit_type
available parameters:
  • $deposit_type$
  • $category$
  • $blocker$
subset iterator:
  • /colony_deposit_type/<category>

/council_agenda
available parameters:
  • $agenda$
  • $finish_modifier$

/councilor
available parameters:
  • $councilor$
  • $councilor_icon$

/demand
available parameters:
  • $title$
  • $unfulfilled_title$
  • $desc$
  • $fulfilled_effect$
  • $unfulfilled_effect$
  • $demand_made_trigger$ (scripted trigger containing the contents of the demand's "potential" block, with "root" replaced with $faction|root$)
  • $demand_fulfilled_trigger$ (scripted trigger containing the contents of the demand's "valid" block, with "root" replaced with $faction|root$)
  • $faction_type$
subset iterator:
  • /demand/<faction_type>

/deposit_category
available parameters:
  • $deposit_category$
  • $blocker$
  • $important$

/edict
available parameters:
  • $edict$
  • $icon$

/federation_law_category
available parameters:
  • $law_category$

/federation_law
available parameters:
  • $law$
  • $law_category$
subset iterator:
  • federation_law/<law_category>

/federation_type
available parameters:
  • $federation_type$
  • $icon$

/habitable_planet_class
available parameters:
  • $planet_class$
  • $initial$

/leader_trait
available parameters:
  • $trait$
  • $base_trait$ (tier-1 version of this trait)
  • $tier$ ("no" for untiered traits)

/number
(scripts accept a parameter "max" and iterate from 0 to "max" inclusive. max cannot be greater than 999)
available parameters:
  • $number$

/orbital_deposit_type
available parameters:
  • $deposit_type$

/origin
available parameters:
  • $origin$
  • $icon$
  • $playable_trigger$ (scripted trigger containing the contents of the civic's "playable" block
  • $potential_trigger$ (raw trigger code (not a scripted trigger) which will evaluate the same as the civic's "potential" trigger)
  • $possible_trigger$ (scripted trigger which will evaluate the same as the civic's "possible" trigger)
  • $trait$ (equal to "no" if this civic has no trait)
  • $trait_cost$
  • $trait_cost_sign$ (see "/trait")
  • $trait_initial$ (see "/trait")
  • $trait_randomized$ (see "/trait")
  • $trait_no_opposites_trigger$ (see "/trait")
  • $has_secondary_species$ ("yes" if the civic has a secondary species "no" otherwise)
  • $secondary_species$
  • $secondary_species_trait$
  • $starting_colony$ ("no" if default)
  • $starting_pc_initial$ (see "/habitable_planet_class"
  • $habitability_preference$ ("no" if default)
  • $ideal_pc_initial$ (see "/habitable_planet_class")
  • $random_weight$
  • $custom_initializers$ ("yes" or "no")
  • $max_once_global$
  • $advanced_start$
  • $modifier$ (static modifier with the same effects as this origin's modifier block)
  • $preferred_planet_class_neighbor$
  • $non_colonizable_planet_class_neghbor$
  • $apply_flags_effect$ (raw effect code (not scripted effect) which adds all this origin's flags to a country)
  • $remove_flags_effect$ (raw effect code (not scripted effect) which removes all this origin's flags from a country)

/policy_category
available parameters:
  • $policy_category$

/policy
available parameters:
  • $policy$
  • $policy_flag$
  • $policy_category$
subset iterator:
  • federation_law/<law_category>

/pop_faction_type
available parameters:
  • $faction_type$
  • $guiding_ethic$
  • $guiding_ethic_short$ (e.g. "xenophile" or "authoritarian")

/pop_job
available parameters:
  • $job$
  • $job_id$ (arbitrary number different from all other id numbers in this mod, also available as the script variable @rst_job_id_<job>. Specific numbers will change as this mod is updated)
  • $pop_category$
  • $pop_category_id$ (arbitrary number different from all other id numbers in this mod, also available as the script variable @rst_pop_category_id_<pop_category>. Specific numbers will change as this mod is updated)
  • $icon$
  • $economic_category$
subset iterator:
  • /pop_job/<pop_category>

/portrait
(actually once per portrait per portrait set)
available parameters:
  • $portrait$
  • $playable_trigger$ (scripted trigger containing the contents of the portrait's "playable" block
  • $randomized_trigger$ (scripted trigger containing the contents of the portrait's "randomized" block
  • $portrait_set$
  • $species_class$
  • $species_class_archetype$
  • $species_class_randomized$ (scripted trigger containing the contents of the species class's "randomized" block
  • $species_class_playable_trigger$ (raw trigger code (not a scripted trigger) which will evaluate the same as the species class's "playable" trigger)
  • $species_class_possible_trigger$ (raw trigger code (not a scripted trigger) which will evaluate the same as the species class's "playable" trigger)
subset iterator:
  • /portrait/<portrait_set>

/portrait_set
(actually once per portrait per portrait set)
available parameters:
    $portrait_set$
  • $species_class$
  • $species_class_archetype$
  • $species_class_randomized$ (scripted trigger containing the contents of the species class's "randomized" block
  • $species_class_playable_trigger$ (raw trigger code (not a scripted trigger) which will evaluate the same as the species class's "playable" trigger)
  • $species_class_possible_trigger$ (raw trigger code (not a scripted trigger) which will evaluate the same as the species class's "playable" trigger)
subset iterator:
  • /portrait_set/<species_class>

/relic
available parameters:
  • $relic$
  • $sprite$
  • $texturefile$

/right/citizenship, /right/colonization, /right/living_standard, /right/migration, /right/military_service, /right/population, /right/purge, and /right/slavery
(Eight iterators with the same parameters. I plan to make these into subset iterators of a single "/right" iterator but haven't yet)
available parameters:
  • $right_category$
  • $right_icon$
  • $right$

/ship_size
available parameters:
  • $ship_size$
  • $ship_class$
  • $icon$
  • $icon_frame$
  • $defense_platforms$
  • $modules$
  • $buildings$

/species_archetype
available parameters:
  • $archetype$

/species_class
available parameters:
  • $species_class$
  • $archetype$
  • $randomized$
  • $graphical_culture$
  • $playable_trigger$ (raw trigger code, not scripted trigger)
  • $possible_trigger$ (raw trigger code (not scripted trigger) which will evaluate true if and only if the species class's "possible" block does

/species_name
available parameters:
  • $species_name$
  • $plural$
  • $home_planet$
  • $home_systeml$
  • $name_list$
  • $species_class$
subset iterator:
  • /species_name/<species_class>

/species_trait
available parameters:
  • $trait$
  • $icon$
  • $cost$
  • $cost_sign$ (1, 0, or -1)
  • $initial$
  • $randomized$
  • $no_opposites_trigger$ (raw trigger code which will evaluate true only for species with none of this trait's opposite traits)
  • $allowed_archetypes_trigger$ (raw trigger code which checks if a species has one of this trait's allowed archetypes)
  • $species_class_trigger$ (raw trigger code which checks if a species has one of this trait's allowed species classes)
  • $allowed_planet_classes_planet_trigger$ (raw trigger code which checks if a planet matches this trait's allowed planet classes)
  • $allowed_planet_classes_preference_trigger$ (raw trigger code which checks if a species' habitability matches this trait's allowed planet classes)
  • $allowed_origins_trigger$ (raw trigger code which checks if a country matches this trait's allowed origins)
  • $allowed_ethics_trigger$ (raw trigger code which checks if a country (or pop, if you like) matches this trait's allowed ethics)
  • $no_forbidden_ethics_trigger$ (raw trigger code which evaluates true if a country (or pop, if you like) has none of this trait's forbidden ethics)

/starbase_building
available parameters:
  • $building$
  • $icon$

/starbase_module
available parameters:
  • $module$
  • $icon$

/starbase_size
available parameters:
  • $ship_size$
  • $ship_class$
  • $icon$
  • $icon_frame$
  • $defense_platforms$
  • $modules$
  • $buildings$
  • $starbase_level$
  • $show_in_outliner$

/starbase_type
available parameters:
  • $starbase_type$

/starting_ruler_trait
available parameters:
  • $trait$
  • $for_legendary_leader$ ("yes" or "no")
  • $cost$
  • $no_opposites_trigger$ (raw trigger code which will evaluate true only for leaders with none of this trait's opposite traits)
  • $allowed_origins_trigger$ (raw trigger code which checks if a country matches this trait's allowed origins)
  • $no_forbidden_origins_trigger$ (raw trigger code which evaluates true if a country has none of this trait's forbidden origins)
  • $allowed_ethics_trigger$ (raw trigger code which checks if a country (or pop, if you like) matches this trait's allowed ethics)
  • $allowed_leader_class_trigger$ (raw trigger code which checks if a leader has one of this trait's allowed leader classes)

/strategic_resource
available parameters:
  • $resource$
  • $category$

/technology_category
available parameters:
  • $tech_cat$
  • $tech_cat_id$ (arbitrary number different from all other id numbers in this mod, also available as the script variable @rst_tech_cat_id_<tech_cat>. Specific numbers will change as this mod is updated)

/technology
available parameters:
  • $tech$
  • $area$
  • $icon$
  • $category$
  • $category_id$ (arbitrary number different from all other id numbers in this mod, also available as the script variable @rst_tech_cat_id_<tech_cat>. Specific numbers will change as this mod is updated)
  • $start_tech$
  • $starting_potential$ (raw trigger code, not a scripted trigger)
  • $cost$
  • $background$ (indicates what background this technology's graphic uses, e.g. "engineering", "physics", "rare", "dangerous")
subset iterator:
  • /technology/<area>

/trade_conversion
available parameters:
  • $trade_conversion$
  • $potential$ (raw trigger code)
  • $energy$
  • $weight$

/tradition_category
available parameters:
  • $tradition_category$
  • $start_tradition$
  • $finish_tradition$
  • $weight$

/tradition
(counts different tradition swaps separately)
available parameters:
  • $tradition$
  • $name$
  • $icon$
  • $is_swap$
  • $inherits_effects$
  • $base_tradition$
  • $adopt$ ("yes" for category adopt traditions, "no" otherwise)
  • $finish$ ("yes" for category finishers, "no" otherwise)
  • $swap_trigger$ (Scripted trigger which evaluates true when this version of the tradition is swapped in and not swapped out)
  • $tradition_category$
subset iterator:
  • /tradition/<tradition_category>
Last edited by kuyan-judith; 11 Oct, 2024 @ 9:52pm