武装突袭 Wiki
注册
Advertisement
Introduced with Operation Flashpoint version 1.00
  

点击图片可看到更多讯息

开始使用于

游戏:
Operation Flashpoint
版本:
1.00

描述

描述:
对两个值是否相等的逻辑判断。 两个值需要为同种类型。

基本句法

句法:
a值== b值
参数:
a值: 数字, , 阵营, 字符串, 物体, 结构化文本, Config, 显示件 或者 控件; 源自 VBS2 1.24: 位置
b值: 数字, , 阵营, 字符串, 物体, 结构化文本, Config, 显示件 或者 控件; 源自 VBS2 1.24: 位置
返回值:
布尔值

范例

范例1:
if (player == leader group player) then { hint "You are the leader of your group." } else { hint "Someone else is the boss" }
范例2:
? name player == "Billy" : hint "Hello Billy, how are you?"

额外资讯

多人游戏:
-
也可以看看:
操作符isEqualTo

注意事项

此处撰写句法皆为可行用法. 可到官网[1]专页回报错误. 你可以使用讨论页面或是论坛来进行讨论.
新增注意事项 | 如何新增?

Notes





Posted on Feb 5, 2007 - 10:38
Ceeeb
OFP v1.96,  字符串 对比不区分大小写。 例子: "STRINGtext" == "stringTEXT" 返回 true
Posted on Apr 15, 2014 - 15:34
ffur2007slx2_5
(A3 1.16) 针对大小写对比, 数组对比和布尔值对比,我们可以使用 switch do。例如: switch (_var0) do { case (_var1) : {true}; default {false}; }; 对于脚本比较,我们需要探测脚本是否会优先运行,然后将两者组合成字符串【原文:For script comparison we need to detect whether scripts are running in advance, then compose both into string】: if (scriptDone _var0) then [{false},{(str _var0) == (str _var1)}];推荐使用 isEqualTo 来进行所有类型对比,该命令功能更好且跟操作符速度一样快。对于多次比较: fnc_areEqual = { private ["_b","_var1","_var2"]; _b = true; for [{_i=1},{_i < (count _this) && _b},{_i=_i+1}] do { _var1 = _this select (_i-1); _var2 = _this select _i; if (!(_var1 isEqualTo _var2)) then {_b = false;}; }; _b }; ["A","a","a"] call fnc_areEqual; // false 我们可以使用这个方法而不是使用 BIS_fnc_arrayCompare 或者 BIS_fnc_areEqual

Bottom Section

Advertisement