Closed adriangaro closed 1 month ago
Relevant documentation from common/scripted_effects/99_advanced_documentation.txt
# You can also use these parameters as booleans:
# <scripted_effect> = {
# PARAM = yes/no
# }
# =>
# <scripted_effect> = {
# [[ PARAM ] #executes enclosed effects if PARAM is present and not set to no ("PARAM = anything_else" defaults to "yes")
# some_effect_or_other = yes
# ]
# [[ !PARAM ] #executes enclosed effects if PARAM = no or PARAM is not set (e.g. you call it via <scripted effect> = yes)
# some_effect_or_other = yes
# ]
# }
no
is essentially treated as not passing a parameter in the context of conditional syntax[[PARAM] .... ]
It also means if a parameter is optional, passing
no
as value should work, even if not matching the inferred type.For example i have the following script value, where a few of the parameters are optional
Passing the default
no
should work here. Yes this could be rewritten with conditional blocks, but that would make this harder to read.Essentially doing
BASE_VALUE|$BASE_VALUE|no$|
is equivalent to doing[[BASE_VALUE]BASE_VALUE|$BASE_VALUE$|]
for the game. The first one is easier to read and shorter variant for all intents and purposed.In scripted effect/trigger cases, the syntax is similarish, and shorter