Thank you for offering to look at it!
This is the “resource” syntax. The base scope for it is _
to shorten its invokations in the other syntaxes like scope:_#_triggers
[code]%YAML 1.2
hidden: true
name: ck2_resources
scope: _
variables:
#basic tokens
boolean: ‘\b(yes|no)\b’
tag: '[A-Za-z][A-Za-z0-9-]*’
flag: ‘{{tag}}(@{{scope}})?’
int: ‘\b(+|-)?\d+\b’
int_: ‘({{int}}|{{tag}})’
uint: ‘\b(+)?\d+\b’
uint_: ‘({{uint}}|{{tag}})’
float: ‘\b(+|-)?(\d+(.\d+)?|.\d+)\b’
float_: ‘({{float}}|{{tag}})’
ufloat: ‘\b(+)?(\d+(.\d+)?|.\d+)\b’
ufloat_: ‘({{ufloat}}|{{tag}})’
event: ‘\b({{tag}}.\d+)\b’
date: ‘\d+.\d{1,2}.\d{1,2}’
token: ‘’
#scopes
province: ‘\d+’
title: ‘[bcdke]{{tag}}’
character_scope: 'c\d+’
event_target: ‘event_target:{{tag}}’
relative_scope: ‘(?x:
{{event_target}} |
(?i: owner
| holder
| holder_scope
| founder
| band_creator
| mercenary_employer
| left_flank_leader
| center_flank_leader
| right_flank_leader
| sea_zone
| trade_post_owner
| fort_owner
| hospital_owner
| top_liege
| regent
| realm
| primary_title
| clan_title
| blood_brother
| country
| duchy
| county
| kingdom
| empire
| employer
| host
| guardian
| new_character
| new_title
| new_artifact
| father_of_unborn
| rightful_religious_head_scope
| religion_head
| parent_religion_head
| dynasty_head
| plot_target_char
| plot_target_title
| plot_target_province
| controller
| suzerain
| capital
| capital_scope
| capital_holding
| lover
| betrothed
| spouse
| spouse_even_if_dead
| consort
| father_even_if_dead
| father
| real_father_even_if_dead
| real_father
| twin_even_if_dead
| twin
| true_father_even_if_dead
| true_father
| preferred_war_target
| reincarnation_scope
| mother
| mother_even_if_dead
| location
| ruler
| liege
| liege_before_war
| crownlaw_title
| dejure_liege_title
| defacto_liege_title
| succ_law_title
| current_heir
| player_heir
| heir_under_seniority_law
| heir_under_primogeniture_law
| heir_under_ultimogeniture_law
| most_participating_attacker
| most_participating_crusader
| most_participating_defender
| attacker
| defender
| best_crusade_claimant
| thirdparty_scope
| thirdparty_title_scope
| root
| from
| fromfrom
| fromfromfrom
| fromfromfromfrom
| originator
| prev
| prevprev
| siege
| combat
| crusade_target
| enemy
| leader
| killer
| invasion_target
| supported_claimant
| supported_claimant_title
| family_palace
| newest_acquired_title
| newest_acquired_county_or_barony
| title_to_get_rid_of
| highest_ranked_relative
| biggest_realm_size_relative
| weakest_clan_vassal
| strongest_clan_vassal
| weakest_clan
| strongest_clan
| weakest_clan_vassal_except_me
| strongest_clan_vassal_except_me
| weakest_clan_except_me
| strongest_clan_except_me
| least_prestigious_clan_vassal
| most_prestigious_clan_vassal
| least_prestigious_clan
| most_prestigious_clan
| least_prestigious_clan_vassal_except_me
| most_prestigious_clan_vassal_except_me
| least_prestigious_clan_except_me
| most_prestigious_clan_except_me
| least_populous_clan_vassal
| most_populous_clan_vassal
| least_populous_clan
| most_populous_clan
| least_populous_clan_vassal_except_me
| most_populous_clan_vassal_except_me
| least_populous_clan_except_me
| most_populous_clan_except_me
| root_from
| root_fromfrom
| root_fromfromfrom
| root_fromfromfromfrom
| educator
| society
| discovered_society
| quest_target
| artifact_owner
| original_owner
| original_artifact_owner
| secret_religious_cult
| religion_scope
| secret_religion_scope
| true_religion_scope
| culture_scope
| gfx_culture_scope
| governor_title
| governor
| offmap_power
| offmap_ruler
| offmap_prev_ruler )
)’
scope: ‘({{province}}|{{title}}|{{character_scope}}|{{relative_scope}}|{{tag}})’
contexts:
#main
main: # dummy, never used
- match: }
scope: ck2.illegal
prototype:
- include: comments
comments:
# Comments begin with a ‘#’ and finish at the end of the line
- match: ‘#’
scope: punctuation.definition.comment.ck2
push:
- meta_scope: ck2.comment.line.ck2
- match: $
pop: true
value:
- match: ‘\b({{boolean}}|"{{boolean}}")\b’
scope: ck2.value.date
pop: true
- match: ‘\b({{date}}|"{{date}}")\b’
scope: ck2.value.date
pop: true
- match: ‘\b({{scope}}|"{{scope}}")\b’
scope: ck2.value.scope
pop: true
- match: ‘\b({{event}}|"{{event}}")\b’
scope: ck2.value.event
pop: true
- match: ‘\b({{tag}}|"{{tag}}")\b’
scope: ck2.value.event
pop: true
- match: ‘\b({{flag}}|"{{flag}}")\b’
scope: ck2.value.event
pop: true
- match: ‘\b(({{float}}|{{tag}})|"({{float}}|{{tag}})")\b’
scope: ck2.value.floatv
pop: true
#triggers
triggers:
- meta_content_scope: triggers
- match: ‘}’
scope: ck2.puctuation.separator
pop: true
- match: ‘(?=[^#\s])’
push: [triggers_or_value, value]
triggers_or_value:
- match: ‘=’
scope: ck2.puctuation.separator
set:
- match: ‘{’
scope: ck2.puctuation.separator
set: triggers
- include: value
triggers:
- match: ‘=’
scope: ck2.puctuation.separator
set:
- match: ‘{’
scope: ck2.puctuation.separator
set: triggers
#effects
effects:
- meta_content_scope: effects
- match: ‘}’
scope: ck2.puctuation.separator
pop: true
- match: ‘(?=[^#\s])’
push: [effects_or_value, value]
effects_or_value:
- match: ‘=’
scope: ck2.puctuation.separator
set:
- match: ‘{’
scope: ck2.puctuation.separator
set: effects
- include: value
effects:
- match: ‘=’
scope: ck2.puctuation.separator
set:
- match: ‘{’
scope: ck2.puctuation.separator
set: effects
effects_limit:
- match: ‘=’
scope: ck2.puctuation.separator
set:
- match: ‘{’
scope: ck2.puctuation.separator
set:
- include: effects
- include: limit
- include: ill
- include: ill
#any value - moved up
#basic values
boolean:
- match: ‘\b({{boolean}}|"{{boolean}}")\b’
scope: ck2.value.boolean
- include: ill
boolean:
- match: ‘\b({{boolean}}|"{{boolean}}")\b’
scope: ck2.value.boolean
pop: true
- include: ill
boolean:
- match: ‘’
set: [boolean, eq]
#flag
flag:
- match: ‘\b({{flag}}|"{{flag}}")\b’
scope: ck2.value.flag
- include: ill
flag:
- match: ‘\b({{flag}}|"{{flag}}")\b’
scope: ck2.value.flag
pop: true
- include: ill
flag:
- match: ‘’
set: [flag, eq]
#tag
tag:
- match: ‘\b({{tag}}|"{{tag}}")\b’
scope: ck2.value.tag
- include: ill
tag:
- match: ‘\b({{tag}}|"{{tag}}")\b’
scope: ck2.value.tag
pop: true
- include: ill
tag:
- match: ‘’
set: [tag, eq]
#date
date:
- match: ‘\b({{date}}|"{{date}}")\b’
scope: ck2.value.date
- include: ill
date:
- match: ‘\b({{date}}|"{{date}}")\b’
scope: ck2.value.date
pop: true
- include: ill
date:
- match: ‘’
set: [date, eq]
#scope
scope:
- match: ‘\b({{scope}}|"{{scope}}")\b’
scope: ck2.value.scope
- include: ill
scope:
- match: ‘\b({{scope}}|"{{scope}}")\b’
scope: ck2.value.scope
pop: true
- include: ill
scope:
- match: ‘’
set: [scope, eq]
#event
event:
- match: ‘\b({{event}}|"{{event}}")\b’
scope: ck2.value.event
- include: ill
event:
- match: ‘\b({{event}}|"{{event}}")\b’
scope: ck2.value.event
pop: true
- include: ill
event:
- match: ‘’
set: [event, eq]
#float
float:
- match: ‘\b({{float}}|"{{float}}")\b’
scope: ck2.value.float
- include: ill
float:
- match: ‘\b({{float}}|"{{float}}")\b’
scope: ck2.value.float
pop: true
- include: ill
float:
- match: ‘’
set: [float, eq]
#ufloat
ufloat:
- match: ‘\b({{ufloat}}|"{{ufloat}}")\b’
scope: ck2.value.ufloat
- include: ill
ufloat_:
- match: ‘\b({{ufloat}}|"{{ufloat}}")\b’
scope: ck2.value.ufloat
pop: true
- include: ill
ufloat:
- match: ‘’
set: [ufloat, eq]
#int
int:
- match: ‘\b({{int}}|"{{int}}")\b’
scope: ck2.value.int
- include: ill
int_:
- match: ‘\b({{int}}|"{{int}}")\b’
scope: ck2.value.int
pop: true
- include: ill
int:
- match: ‘’
set: [int, eq]
#uint
uint:
- match: ‘\b({{uint}}|"{{uint}}")\b’
scope: ck2.value.uint
- include: ill
uint_:
- match: ‘\b({{uint}}|"{{uint}}")\b’
scope: ck2.value.uint
pop: true
- include: ill
uint:
- match: ‘’
set: [uint, eq]
#floatv
floatv:
- match: ‘\b(({{float}}|{{tag}})|"({{float}}|{{tag}})")\b’
scope: ck2.value.floatv
- include: ill
floatv_:
- match: ‘\b(({{float}}|{{tag}})|"({{float}}|{{tag}})")\b’
scope: ck2.value.floatv
pop: true
- include: ill
floatv:
- match: ‘’
set: [floatv, eq]
#ufloatv
ufloatv:
- match: ‘\b(({{ufloat}}|{{tag}})|"({{ufloat}}|{{tag}})")\b’
scope: ck2.value.ufloatv
- include: ill
ufloatv_:
- match: ‘\b(({{ufloat}}|{{tag}})|"({{ufloat}}|{{tag}})")\b’
scope: ck2.value.ufloatv
pop: true
- include: ill
ufloatv:
- match: ‘’
set: [ufloatv, eq]
#intv
intv:
- match: ‘\b(({{int}}|{{tag}})|"({{int}}|{{tag}})")\b’
scope: ck2.value.intv
- include: ill
intv_:
- match: ‘\b(({{int}}|{{tag}})|"({{int}}|{{tag}})")\b’
scope: ck2.value.intv
pop: true
- include: ill
intv:
- match: ‘’
set: [intv, eq]
#uintv
uintv:
- match: ‘\b(({{uint}}|{{tag}})|"({{uint}}|{{tag}})")\b’
scope: ck2.value.uintv
- include: ill
uintv_:
- match: ‘\b(({{uint}}|{{tag}})|"({{uint}}|{{tag}})")\b’
scope: ck2.value.uintv
pop: true
- include: ill
uintv:
- match: ‘’
set: [uintv, eq]
#syntactic elements
ill:
- match: ‘\S+’
scope: ck2.illegal
eq:
- match: ‘=’
scope: ck2.punctuation.separator
pop: true
- include: ill
eq_op:
- match: ‘=’
scope: ck2.punctuation.separator
set:
- match: ‘{’
scope: ck2.punctuation.separator
pop: true
- include: ill
- include: ill
op:
- match: ‘{’
scope: ck2.punctuation.separator
pop: true
- include: ill
cl: # checks for illegal
- match: ‘}’
scope: ck2.punctuation.separator
pop: true
- include: ill
#simple phrases
count:
- match: ‘\b(count)\b’
scope: ck2.parameter
push: _ufloat
amount:
- match: ‘\b(amount)\b’
scope: ck2.parameter
push: _ufloat
factor:
- match: ‘\b(factor)\b’
scope: ck2.parameter
push: _ufloat
text:
- match: ‘\b(text)\b’
scope: ck2.parameter
push: _tag
#blocks
trigger:
- match: ‘\b(trigger)\b’
scope: ck2.parameter
push: _triggers
limit:
- match: ‘\b(limit)\b’
scope: ck2.parameter
push: triggers
ai_will_do:
- match: ‘\b(ai_will_do)\b’
scope: ck2.field
push: [ai_will_do]
ai_will_do:
- match: ‘’
set: []
- include: factor
- include: modifier
- include: additive_modifier
- include: cl
mtth(time):
- match: ‘\b(days|months|year)\b’
scope: ck2.parameter
push: _uint
- include: modifier
- include: additive_modifier
- include: cl
mtth(weight_multiplier):
- match: ‘\b(days|months|factor)\b’
scope: ck2.parameter
push: _uint
- include: modifier
- include: additive_modifier
- include: cl
modifier:
- match: ‘modifier’
scope: ck2.parameter
push: _modifier
_modifier:
- include: factor
- include: triggers
- include: cl
additive_modifier:
- match: ‘modifier’
scope: ck2.parameter
push: _additive_modifier
_additive_modifier:
- match: ‘\b(value)\b’
scope: ck2.parameter
push: _float
- include: triggers
- include: cl
[/code]
Thiis is the “decisions” syntax that calls some of the contexts of the previous one:
[code]%YAML 1.2
#hidden: true
name: ck2_decisions
scope: ck2.meta_decisions_file
variables:
tag: ‘[A-Za-z][A-Za-z0-9_-]*’
contexts:
prototype:
- include: scope:#comments
main:
- match: ‘\b{{tag}}\b’
scope: ck2.category
push: [decision_type, scope:#eq_op]
- include: scope:_#ill
decision_type:
- meta_scope: ck2.meta_decision_type # this is just for debugging
- match: ‘\b{{tag}}\b’
scope: ck2.entity
push: [decision, scope:#eq_op]
- include: scope:#cl
decision:
- meta_scope: ck2.meta_decision # this is just for debugging
- match: ‘\b(hide_in_decisions_list|is_(high_prio|in_society|mercenary)|only_(independent|playable|rulers)|ai)\b’
scope: ck2.field
push: scope:#boolean
- match: ‘\bai_target_filter|filter\b’
scope: ck2.field
push: [decision_target_filter, scope:#eq]
- match: '\b(from_potential|revoke_allowed|((third_party)?(potential|allow)))\b’
scope: ck2.field
push: scope:#triggers
- match: ‘\b(effect)\b’
scope: ck2.field
push: scope:#effects
- match: ‘\b(ai_will_do)\b’
scope: ck2.field
push: scope:#ai_will_do
- include: scope:#cl
decision_target_filter:
- match: ‘\b(all|court|demesne|dynasty|dynasty_owned|home_court|liege|owned|realm|realm_owned|rivals|self|society|spouse|sub_realm|sub_realm_owned|vassals)\b’
scope: ck2.value.language
pop: true
- include: scope:#ill[/code]
And this is an example of file it would be applied to:
[code]targetted_decisions = {
convert_to_liege_religion = {
only_playable = yes
filter = self
ai_target_filter = self
potential = {
ai = no
is_playable = yes
liege = {
NOT = { character = ROOT }
NOT = { religion = ROOT }
religion_group = ROOT
}
controls_religion = no
}
allow = {
NOT = { trait = zealous }
}
effect = {
prestige = -500
piety = 250
if = {
limit = { higher_tier_than = BARON }
religion_authority = {
modifier = ruler_converted_from
}
}
liege = {
reverse_religion = ROOT
}
if = {
limit = { higher_tier_than = BARON }
hidden_tooltip = {
religion_authority = {
modifier = ruler_converted_to
}
}
}
if = {
limit = { liege = { trait = shaivist_hindu } }
add_trait = shaivist_hindu
}
if = {
limit = { liege = { trait = vaishnavist_hindu } }
add_trait = vaishnavist_hindu
}
if = {
limit = { liege = { trait = shaktist_hindu } }
add_trait = shaktist_hindu
}
if = {
limit = { liege = { trait = smartist_hindu } }
add_trait = smartist_hindu
}
if = {
limit = { liege = { trait = mahayana_buddhist } }
add_trait = mahayana_buddhist
}
if = {
limit = { liege = { trait = vajrayana_buddhist } }
add_trait = vajrayana_buddhist
}
if = {
limit = { liege = { trait = theravada_buddhist } }
add_trait = theravada_buddhist
}
if = {
limit = { liege = { trait = digambara_jain } }
add_trait = digambara_jain
}
if = {
limit = { liege = { trait = svetambara_jain } }
add_trait = svetambara_jain
}
}
revoke_allowed = {
always = no
}
ai_will_do = {
factor = 0
}
}
convert_to_liege_religion_on_liege = {
only_playable = yes
filter = liege
ai_target_filter = liege
from_potential = {
ai = no
is_playable = yes
controls_religion = no
}
potential = {
NOT = { character = FROM }
NOT = { religion = FROM }
religion_group = FROM
}
allow = {
FROM = { NOT = { trait = zealous } }
}
effect = {
FROM = {
prestige = -500
piety = 250
if = {
limit = { higher_tier_than = BARON }
religion_authority = {
modifier = ruler_converted_from
}
}
religion = ROOT
if = {
limit = { higher_tier_than = BARON }
hidden_tooltip = {
religion_authority = {
modifier = ruler_converted_to
}
}
}
if = {
limit = { ROOT = { trait = shaivist_hindu } }
add_trait = shaivist_hindu
}
if = {
limit = { ROOT = { trait = vaishnavist_hindu } }
add_trait = vaishnavist_hindu
}
if = {
limit = { ROOT = { trait = shaktist_hindu } }
add_trait = shaktist_hindu
}
if = {
limit = { ROOT = { trait = smartist_hindu } }
add_trait = smartist_hindu
}
if = {
limit = { ROOT = { trait = mahayana_buddhist } }
add_trait = mahayana_buddhist
}
if = {
limit = { ROOT = { trait = vajrayana_buddhist } }
add_trait = vajrayana_buddhist
}
if = {
limit = { ROOT = { trait = theravada_buddhist } }
add_trait = theravada_buddhist
}
if = {
limit = { ROOT = { trait = digambara_jain } }
add_trait = digambara_jain
}
if = {
limit = { ROOT = { trait = svetambara_jain } }
add_trait = svetambara_jain
}
}
}
revoke_allowed = {
always = no
}
ai_will_do = {
factor = 0
}
}
}[/code]