点击图片可看到更多讯息
开始使用于
- 游戏:
- 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?"
额外资讯
注意事项
Notes
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