Wiki

effect · clr_project_flag

Definition

  • Supported scope:SPECIAL_PROJECT
  • Supported target:none

Description

clear project flag

实战 · 配合 · 坑

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

实战用法

clr_project_flag 用于在特殊项目(Special Project)的生命周期管理中,清除先前通过 set_project_flag 打上的状态标记,常见于阶段切换时重置旧阶段标记、或在项目完成/中断时清理临时标志。例如,当一个原型研究阶段结束后,清除代表"正在加速研究"的标记,防止后续条件判断错误触发。

# 当项目完成某阶段后,清除临时加速标记
SPECIAL_PROJECT = {
    complete_prototype_reward_option = {
        option = {
            effect = {
                clr_project_flag = accelerated_phase_active
            }
        }
    }
}

配合关系

  • [has_project_flag](/wiki/trigger/has_project_flag):在清除标记前,通常先用此触发器确认标记存在,避免无意义的操作或逻辑混乱。
  • [set_project_flag](/wiki/effect/set_project_flag):两者互为逆操作,set 负责打标记,clr 负责撤销,常在阶段切换时成对出现。
  • [modify_project_flag](/wiki/effect/modify_project_flag):当需要更新标记的值而非简单清除时作为替代选择,理清"清除"与"修改"的语义边界有助于避免逻辑错误。
  • [add_project_progress_ratio](/wiki/effect/add_project_progress_ratio):项目进度推进后往往需要同步清除旧阶段标记,两者常出现在同一执行块中。

常见坑

  1. 在标记未被设置的情况下直接清除不会报错,但若后续逻辑依赖"清除动作本身代表状态变化",则会产生静默的逻辑漏洞——建议始终配合 [has_project_flag](/wiki/trigger/has_project_flag) 做前置检查,确保清除行为有实际意义。
  2. scope 必须是 SPECIAL_PROJECT,新手容易在 country 或 state scope 下误用此命令,导致脚本解析失败或效果静默不执行,需确认所在执行块已正确进入特殊项目 scope。

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

clr_project_flag is used in the lifecycle management of Special Projects to clear status markers previously set via set_project_flag. It is commonly employed when resetting old phase markers during phase transitions, or cleaning up temporary flags when a project completes or is interrupted. For example, after a prototype research phase concludes, clearing the marker representing "accelerated research in progress" prevents subsequent condition checks from triggering incorrectly.

# After a project completes a phase, clear the temporary acceleration flag
SPECIAL_PROJECT = {
    complete_prototype_reward_option = {
        option = {
            effect = {
                clr_project_flag = accelerated_phase_active
            }
        }
    }
}

Synergy

  • [has_project_flag](/wiki/trigger/has_project_flag): Before clearing a flag, it is standard practice to first use this trigger to confirm the flag exists, avoiding meaningless operations or logical inconsistencies.
  • [set_project_flag](/wiki/effect/set_project_flag): These two effects are inverse operations—set applies the flag while clr revokes it, and they commonly appear in pairs during phase transitions.
  • [modify_project_flag](/wiki/effect/modify_project_flag): When you need to update a flag's value rather than simply clearing it, consider this as an alternative. Clarifying the semantic boundary between "clearing" and "modifying" helps avoid logical errors.
  • [add_project_progress_ratio](/wiki/effect/add_project_progress_ratio): After advancing project progress, it is often necessary to synchronously clear old phase flags. These two effects frequently appear in the same execution block.

Common Pitfalls

  1. Clearing a flag that was never set does not produce an error, but if subsequent logic depends on "the clearing action itself representing a state change," it creates a silent logical flaw—it is recommended to always precede the clear operation with [has_project_flag](/wiki/trigger/has_project_flag) for validation, ensuring the clearing action has actual significance.
  2. The scope must be SPECIAL_PROJECT—beginners often mistakenly use this command under country or state scope, resulting in script parsing failures or silent execution failures. Always verify that the execution block has correctly entered the special project scope.