Hi @DragonKnightOfBreeze,
there is one issue with the Victoria 3 CWT config and the parser that leads to relatively frequent errors/warnings.
A variable in Victoria 3 can be both a number or a scope.
This means in triggers where you can do mathematical checks as well as scope based triggers it can not resolve to one of them.
Variable Definition
### Reference a previous set variable via its name eg: var:mortal_enemy
var = {
desc = "Reference a previous set variable via its name eg: var:mortal_enemy"
output_scope = any
type = both
from_data = yes
prefix = var:
data_source = value[variable]
}
Scope Links
alias[trigger:scope_field] = { alias_name[trigger] = alias_match_left[trigger] }
alias[trigger:value_field] == { alias_name[arithmetic_operation] = alias_match_left[arithmetic_operation] }
Error Example


Solutions?
I am not sure whether these are practical. I have looked into the code but could not find where these checks could be added.
Infer Type per Comparision
One way to improve this a little bit is to infer the type based on the comparision. For example <= or >= and such operators that only match the == definition in the scope links could be resolved to an arithmetic_operation, since they can not apply to the scope to trigger link.
Infer Type by first Command
In the example above the trigger_if command is only defined for trigger not for arithmetic_operation so it would resolve to the scope to trigger link. I would keep it to the first command that is able to separate them. This should hopefully not be too performance hungry.
Save Type on Creation
When creating a variable it could save the associated scope/type.
c:SOME_COUNTRY_SCOPE
# This saves in the internal index that the variable test
# on this specific country (scope) is of type value
set_variable {
name = test
value = 1
}
var:test = {
# The parser know that it is in a value not in a scope
}
}
c:SOME_OTHER_COUNTRY_SCOPE
# This saves in the internal index that the variable test
# on this specific country (scope) is of type scope
set_variable {
name = test
value = s:SOME_STATE_SCOPE
}
var:test = {
# The parser know that it is in a scope and not in a value
}
}
Regards,
Chris
Hi @DragonKnightOfBreeze,
there is one issue with the Victoria 3 CWT config and the parser that leads to relatively frequent errors/warnings.
A variable in Victoria 3 can be both a number or a scope.
This means in triggers where you can do mathematical checks as well as scope based triggers it can not resolve to one of them.
Variable Definition
Scope Links
Error Example
Solutions?
I am not sure whether these are practical. I have looked into the code but could not find where these checks could be added.
Infer Type per Comparision
One way to improve this a little bit is to infer the type based on the comparision. For example
<=or>=and such operators that only match the==definition in the scope links could be resolved to anarithmetic_operation, since they can not apply to the scope to trigger link.Infer Type by first Command
In the example above the
trigger_ifcommand is only defined fortriggernot forarithmetic_operationso it would resolve to the scope to trigger link. I would keep it to the first command that is able to separate them. This should hopefully not be too performance hungry.Save Type on Creation
When creating a variable it could save the associated scope/type.
Regards,
Chris