Fandom

武装突袭 Wiki

GetVariable

简体 | 繁體

4,827个页面创建
于此维基上
添加新页面
评论0 Share

您使用了广告屏蔽软件!


Wikia通过广告运营为用户提供免费的服务。我们对用户通过嵌入广告屏蔽软件访问网站进行了使用调整。

如果您使用了广告屏蔽软件,将无法使用我们的服务。请您移除广告屏蔽软件,以确保页面正常加载。

  Arguments of this scripting command don't have to be local to the client the command is executed on

点击图片可看到更多讯息

开始使用于

游戏:
Armed Assault
版本:
1.00

描述

描述:
Return the value of variable in the variable space of given object or location.

All available data types combinations:

基本句法

句法:
varspace getVariable name
参数:
varspace: Namespace, Object, Display, Control, Group, Location, Task or Team Member

name: String - Variable name that was defined in setVariable (Case sensitive)
返回值:
Anything or Nothing if the variable doesn't exist

替代句法

句法:
varspace getVariable [name, defaultValue]
参数:
varspace: [Namespace]], Object, Display, Control, Group or Team Member

name: String - Variable name that was defined in setVariable (Case sensitive)

defaultValue: Anything - Value to return if variable doesn't exist
返回值:
Anything or defaultValue if the variable doesn't exist

范例

范例1:
_thePublicVariable = _myTruck getVariable "myPublicVariable";

范例2:
_aLocalVariable = _myTruck getVariable ["myLocalVariable", ["Not set", _var]] select 1;

范例3:
for "_i" from 0 to 5 do {

   _car = missionNamespace getVariable ("car" + str _i);
   _car setDamage 0;

}; Sets damage of car0, car1, ..., car5 to 0.

范例4:
myMissionVar = 2015; missionNamespace getVariable "myMissionVar";//Returns 2015

范例5:
WARNING when using dynamic default value: missionNamespace getVariable ["var", 123 call fnc_abc]; /// fnc_abc is always called even when var is defined

范例6:
Get current value of a variable and if it is undefined, define it and get the defined value:private _var = missionNamespace getVariable "varName"; if (isNil "_var") then { missionNamespace setVariable ["varName", 123]; _var = 123; }; // _var here will contain current value of the variable varName

额外资讯

多人游戏:
-
也可以看看:

setVariableallVariables

注意事项

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

Notes

Bottom Section

更多维基

随机维基