武装突袭 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