群星
ParaWikis
Notice
: Undefined index: HTTP_ACCEPT_LANGUAGE in
/data/wwwroot/www.parawikis.com/skins/Liberty/LibertyTemplate.php
on line
185
最新百科
都市天际线2百科
英雄无敌3百科
维多利亚3百科
奇妙探险队2百科
罪恶帝国百科
英白拉多:罗马百科
热门百科
群星百科
欧陆风云4百科
十字军之王2百科
十字军之王3百科
钢铁雄心4百科
维多利亚2百科
ParaWikis
申请建站
ParaWikis
ParaCommons
最近更改
随机页面
加入QQ群
工具
链入页面
相关更改
特殊页面
页面信息
页面值
阅读
编辑
编辑源代码
查看历史
讨论
编辑“
Conditions
”(章节)
警告:
您没有登录。如果您做出任意编辑,您的IP地址将会公开可见。如果您
登录
或
创建
一个账户,您的编辑将归属于您的用户名,且将享受其他好处。
反垃圾检查。
不要
加入这个!
== Logical boolean operators == Operators allow conditions and triggers to be manipulated in order to return a simple '''true''' or '''false''' statement to be processed. They appear: * In condition blocks (<code>trigger</code> section of [[Event modding|events]], or equivalent: <code>mult_modifier</code>, <code>can_use_…</code>, <code>potential</code>, <code>allow</code>, …) * In the <code>limit</code> clause of command blocks * In scripted blocks: as [[#Scripted Triggers|scripted trigger]]s (or [[scripted effect]]s), which can be used to group conditions into re-usable '''macro'''. * At the root of events for [[Event_modding#Pre-triggers|pre-trigger]]s used to improve performances (actually only on planets) {| class="wikitable sortable" style="font-size:90%; text-align:left;width:100%" |- ! Name !! Description !! Example |- ! if…<br>else_if…<br>else… | Returns true if the conditional statement inside the block evaluates to true. |class=mw-code| if = { limit = { owner = { has_ethic = ethic_fanatic_xenophile } } … } else_if = { limit = { … } … } else = { … } |- ! AND |Returns true if all conditional statements inside the block evaluate to true.<br>This is usually the default in a trigger or new scope, so is not needed to be explicitly specified. i.e. <i>trigger = { AND = { A B } }</i> is the same as <i>trigger = { A B }</i><br>Putting the conditions most likely to be false first can slightly help performance of the scripting engine. |class=mw-code| AND = { has_ethic = ethic_fanatic_xenophile has_ethic = ethic_egalitarian } |- ! OR | Returns true if at least one conditional statement inside the block evaluates to true.<br>Putting the conditions most likely to be true first can slightly help performance of the scripting engine. |class=mw-code| OR = { has_ethic = ethic_fanatic_xenophile has_ethic = ethic_egalitarian } |- ! NOT | Returns true if the conditional statement inside the block evaluates to false, and false if it evaluates to true.<br>Note that NOT only accepts one statement. If you use more than one, it will usually work, but can cause unforeseen bugs, as well as put an error in the error.log file.<br>It's better to use NOR or NAND for blocks containing more than one statement. |class=mw-code| NOT = { has_ethic = ethic_fanatic_xenophile } |- ! NOR | Returns true if none of the conditional statements inside the block evaluate to true. Same as NOT = { OR = { <conditions> } } (all are false). |class=mw-code| NOR = { has_ethic = ethic_fanatic_xenophile has_ethic = ethic_fanatic_militarist } |- ! NAND | Returns true unless all of the conditional statements inside the block evaluate to true. Same as NOT = { AND = { <conditions> } } (at minimum one is false). |class=mw-code| NAND = { has_ethic = ethic_fanatic_xenophile has_technology = "tech_zero_point_power" } |- ! calc_true_if | Returns true if at least <code>amount</code> conditions return true. <code>amount</code> supports numerical operators. |class=mw-code| calc_true_if = { amount >= 3 leader_class = scientist is_researching_area = society gender = female has_level > 2 leader_age < 85 } |} It is important to remember [[wikipedia:De Morgan's laws|De Morgan's laws]] to use NOR and NAND correctly:<br> NAND = { A B } <=> NOT = { AND = { A B } } <=> OR = { NOT = { A } NOT = { B } }<br> NOR = { A B } <=> NOT = { OR = { A B } } <=> AND = { NOT = { A } NOT = { B } } So this means a list of NOTs in an AND can be simplified: trigger = { NOT = { A } NOT = { B } NOT = { C } } is the same as: trigger = { NOR = { A B C } } Conversely, a list of NOTs in an OR can be simplified: trigger = { OR = { NOT = { A } NOT = { B } NOT = { C } } } is the same as: trigger = { NAND = { A B C } } ---- If you need [[wikipedia:Exclusive or|XOR]] logic, you can use <code>calc_true_if</code> or something like this: trigger = { OR = { A B } NAND = { A B } } is the same as: trigger = { calc_true_if = { amount = 1 A B } } Or this for 3 input XOR logic: trigger = { OR = { AND = { OR = { A B C } NOR = { AND = { A B } AND = { A C } AND = { B C } } } AND = { A B C } } } is the same as: trigger = { OR = { AND = { A B C } calc_true_if = { amount = 1 A B C } } }
摘要:
请注意您对群星百科的所有贡献都被认为是在知识共享署名-非商业性使用-相同方式共享下发布,请查看在
群星百科:版权
的细节。如果您不希望您的文字被任意修改和再散布,请不要提交。
您同时也要向我们保证您所提交的内容是您自己所作,或得自一个不受版权保护或相似自由的来源。
未经许可,请勿提交受版权保护的作品!
为防止机器编辑,请完成下方验证
取消
编辑帮助
(在新窗口中打开)
×
登录
密码
记住登录
加入群星百科
忘记密码?
其他方式登录