trigger · not
Definition
- Supported scope:
any - Supported target:
THIS,ROOT,PREV,FROM,OWNER,CONTROLLER,OCCUPIED,CAPITAL
Description
negates content of trigger
notanyTHIS, ROOT, PREV, FROM, OWNER, CONTROLLER, OCCUPIED, CAPITALnegates content of trigger
实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。
not 是 mod 脚本中最高频的逻辑取反工具,常用于"玩家不处于某种状态时才允许触发"的场景,例如确保某个事件只在国家尚未拥有特定旗帜、尚未完成某条件时才出现。它可以嵌套在 and/or 内构成复杂逻辑。
# 仅当该国没有全局旗帜且不处于历史焦点模式时触发
trigger = {
not = {
has_global_flag = my_mod_event_fired
}
not = {
is_historical_focus_on = yes
}
}
[and](/wiki/trigger/and) — not 常与 and 搭配,将多个条件整体取反(等价于德摩根定律),避免写多个分散的 not。[or](/wiki/trigger/or) — 与 or 搭配可构建"既非 A 也非 B"的逻辑,是复杂准入条件的基础结构。[has_global_flag](/wiki/trigger/has_global_flag) — 最典型的取反对象,用于检测"某事件尚未触发过",防止重复触发。[custom_trigger_tooltip](/wiki/trigger/custom_trigger_tooltip) — 当 not 内逻辑较复杂时,外套 custom_trigger_tooltip 可提供友好的本地化提示,避免 UI 显示混乱的双重否定文本。not 内放多个子条件时,整体语义是"这些条件全部成立才为假"(即内部隐含 and),而非"任意一个成立就为假"——新手经常误以为 not { A B } 等价于"非A 且 非B",实际上它等价于"非(A 且 B)",若要表达"非A 且 非B",必须写两个独立的 not = { A } 和 not = { B },或使用 not = { or = { A B } }。limit 块中对数值型 trigger(如 check_variable)取反时,注意边界值——例如 not = { check_variable = { var = x value > 5 } } 包含 x = 5 的情况,与直觉上的"小于 5"不同,忽略边界会导致难以排查的逻辑漏洞。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.
not is the most frequently used logical negation tool in mod scripts, commonly employed in scenarios like "trigger only when the player is NOT in a certain state," such as ensuring an event appears only when a nation has not yet acquired a specific flag or completed a certain condition. It can be nested within and/or to construct complex logic.
# Triggers only when the country lacks the global flag and is not in historical focus mode
trigger = {
not = {
has_global_flag = my_mod_event_fired
}
not = {
is_historical_focus_on = yes
}
}
[and](/wiki/trigger/and) — not frequently pairs with and to negate multiple conditions as a whole (equivalent to De Morgan's laws), avoiding scattered individual not statements.[or](/wiki/trigger/or) — Combined with or, it builds "neither A nor B" logic, which is foundational for complex gating conditions.[has_global_flag](/wiki/trigger/has_global_flag) — The archetypal negation target, used to check "a certain event has not yet fired," preventing duplicate triggers.[custom_trigger_tooltip](/wiki/trigger/custom_trigger_tooltip) — When the logic inside not becomes complex, wrapping it with custom_trigger_tooltip provides friendly localized tooltips and prevents UI display of confusing double-negative text.not, the overall semantic is "these conditions are all true results in false" (implicit and inside), NOT "false if any one is true" — Beginners often mistakenly believe not { A B } is equivalent to "not A and not B," but it actually equals "not (A and B)." To express "not A and not B," you must write two separate not = { A } and not = { B }, or use not = { or = { A B } }.check_variable) within a limit block, pay attention to boundary values — For example, not = { check_variable = { var = x value > 5 } } includes the case where x = 5, unlike the intuitive "less than 5," overlooking boundaries causes hard-to-trace logic bugs.