Wiki

effect · custom_effect_tooltip

Definition

  • Supported scope:any
  • Supported target:none

Description

Append an extra tooltip to the effect. The tooltip is a [bindable localization](script_concept_documentation.md#bindable-localization).

### Examples

custom_effect_tooltip = MY_TOOLTIP # Simple loc key tooltip

custom_effect_tooltip = { localization_key = MY_TOOLTIP # Root look key IMPORTANT_QUESTION = { # ID IMPORTANT_QUESTION in MY_TOOLTIP will get value: localization_key = MEANING_OF_LIFE # Root loc key in IMPORTANT_QUESTION ANSWER = "42" # ID ANSWER in IMPORTANT_QUESTION will get value 42 } JUST_AS_IMPORTANT = OR_NOT # ID JUST_AS_IMPORTANT in MY_TOOLTIP will get value OR_NOT }

实战 · 配合 · 坑

实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。

实战用法

custom_effect_tooltip 常用于 hidden_effect 内部执行了多个实际操作,但需要向玩家展示一段自定义的、更易读的说明文本时;也常用于 meta_effect 或条件分支中,当实际改动的描述不够直观,需要补充额外上下文提示。例如在一个国策完成后静默修改变量,同时给出友好提示:

complete_national_focus = {
    hidden_effect = {
        set_variable = { var = my_mod_score value = 10 }
    }
    custom_effect_tooltip = MY_MOD_SCORE_CHANGED_TT
}

配合关系

  • [hidden_effect](/wiki/effect/hidden_effect):最典型的搭档——将真实执行的逻辑藏入 hidden_effect 隐去杂乱的自动 tooltip,再用 custom_effect_tooltip 补上一条干净的说明,做到"显示与执行分离"。
  • [effect_tooltip](/wiki/effect/effect_tooltip):两者定位互补,effect_tooltip 用于"假装执行某 effect 以显示其 tooltip",而 custom_effect_tooltip 用于展示完全自定义的本地化文本,可同时使用以组合出丰富的提示层次。
  • [meta_effect](/wiki/effect/meta_effect)meta_effect 生成的动态脚本往往难以产生可读 tooltip,搭配 custom_effect_tooltip 可为其补充人类友好的说明。
  • [if](/wiki/effect/if):在 if/else 分支中,不同条件走不同路径时,用 custom_effect_tooltip 分别给出对应的提示文本,避免玩家看到令人困惑的空白或错误描述。

常见坑

  1. 本地化键不存在时不会报错而是显示乱码:如果填写的 loc key 在 .yml 文件中没有对应条目,游戏不会崩溃,但界面会直接显示原始键名,新手容易误以为脚本写错而反复排查 effect 本身,实际问题在本地化文件缺失或语言目录不对。
  2. 误把它当成"隐藏 tooltip"的方式custom_effect_tooltip追加提示,不会替换或压制同块内其他 effect 自动生成的 tooltip;若想隐藏自动 tooltip,必须配合 hidden_effect 把实际逻辑包裹起来,单独使用 custom_effect_tooltip 并不能达到"只显示我的文字"的效果。

Hands-On Notes

Hands-on notes are AI-generated and checked against the vanilla command vocabulary — treat them as a starting point, not authoritative reference. The definition above is the game's own documentation.

Hands-On Usage

custom_effect_tooltip is commonly used when multiple actual operations are executed within hidden_effect, but you need to display custom, more readable explanation text to the player; it is also frequently used in meta_effect or conditional branches, when the description of actual changes lacks clarity and requires additional context hints. For example, silently modifying a variable after a national focus completes while providing a user-friendly tooltip:

complete_national_focus = {
    hidden_effect = {
        set_variable = { var = my_mod_score value = 10 }
    }
    custom_effect_tooltip = MY_MOD_SCORE_CHANGED_TT
}

Synergy

  • [hidden_effect](/wiki/effect/hidden_effect): The quintessential companion — conceal the actual execution logic within hidden_effect to hide messy automatic tooltips, then use custom_effect_tooltip to add a clean explanation, achieving "separation of display and execution."
  • [effect_tooltip](/wiki/effect/effect_tooltip): The two are complementary in purpose; effect_tooltip is used to "pretend to execute an effect in order to display its tooltip," while custom_effect_tooltip displays completely custom localized text. Both can be used simultaneously to compose rich layers of hints.
  • [meta_effect](/wiki/effect/meta_effect): The dynamic scripts generated by meta_effect often struggle to produce readable tooltips. Paired with custom_effect_tooltip, you can supplement human-friendly descriptions.
  • [if](/wiki/effect/if): In if/else branches where different conditions take different paths, use custom_effect_tooltip to provide corresponding hint text for each branch, preventing players from seeing confusing blanks or incorrect descriptions.

Common Pitfalls

  1. No error when localization key doesn't exist, instead displays garbled text: If the loc key you provide has no corresponding entry in the .yml file, the game will not crash, but the interface will directly display the raw key name. Beginners often mistakenly assume the script is wrong and repeatedly debug the effect itself, when the actual problem is a missing localization file or incorrect language directory.
  2. Mistaking it as a way to "hide tooltips": custom_effect_tooltip appends hints and does not replace or suppress automatically generated tooltips from other effects in the same block. To hide automatic tooltips, you must pair it with hidden_effect to wrap the actual logic; using custom_effect_tooltip alone cannot achieve the effect of "only show my text."