BIS fnc rscLayer: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Generated by BIS_fnc_exportFunctionsToWiki)
 
(Created page with "<syntaxhighlight lang="javascript">/* Author: Karel Moricky Description: Register RSC layer. Parameter(s): _this select 0: STRING - layer name. Parent function name is use...")
Line 1: Line 1:
 
<syntaxhighlight lang="javascript">/*
{{Function|= Comments
Author: Karel Moricky
____________________________________________________________________________________________
 
| arma3 |= Game name
 
|1.00|= Game version
____________________________________________________________________________________________
 
| <pre>/*


Description:
Description:
Line 20: Line 12:
*/
*/


</pre><small>''(Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]])''</small> |= Description
private ["_name","_list","_id"];
____________________________________________________________________________________________
_name = [_this,0,"",[""]] call bis_fnc_param;
 
_list = missionnamespace getvariable ["bis_fnc_rscLayer_list",[]];
| <!-- [] call [[BIS_fnc_rscLayer]]; --> |= Syntax
 
|p1= |= Parameter 1
 
| |= Return value
____________________________________________________________________________________________
 
|x1= <code></code> |=
____________________________________________________________________________________________
 
| |= See also
 
}}


<h3 style="display:none">Notes</h3>
if (_name == "") then {
<dl class="command_description">
if (_fnc_scriptNameParent != _fnc_scriptName) then {
<!-- Note Section BEGIN -->
_name = _fnc_scriptNameParent;
};
};
if (_name == "") exitwith {"RSC Layer name cannot be empty string" call bis_fnc_error; -1};


<!-- Note Section END -->
_id = _list find _name;
</dl>
_id = if (_id < 0) then {
_id = (count _list + 2) / 2;
_list set [count _list,_name];
_list set [count _list,_id];
_id
} else {
_list select (_id + 1)
};


<h3 style="display:none">Bottom Section</h3>
missionnamespace setvariable ["bis_fnc_rscLayer_list",_list];
[[Category:Function Group: GUI|{{uc:rscLayer}}]]
_id
[[Category:Functions|{{uc:rscLayer}}]]
</syntaxhighlight>
[[Category:{{Name|arma3}}: Functions|{{uc:rscLayer}}]]

Revision as of 18:59, 18 October 2013

/*
	Author: Karel Moricky

	Description:
	Register RSC layer.

	Parameter(s):
	_this select 0: STRING - layer name. Parent function name is used automatically when param is nil.

	Returns:
	NUMBER
*/

private ["_name","_list","_id"];
_name = [_this,0,"",[""]] call bis_fnc_param;
_list = missionnamespace getvariable ["bis_fnc_rscLayer_list",[]];

if (_name == "") then {
	if (_fnc_scriptNameParent != _fnc_scriptName) then {
		_name = _fnc_scriptNameParent;
	};
};
if (_name == "") exitwith {"RSC Layer name cannot be empty string" call bis_fnc_error; -1};

_id = _list find _name;
_id = if (_id < 0) then {
	_id = (count _list + 2) / 2;
	_list set [count _list,_name];
	_list set [count _list,_id];
	_id
} else {
	_list select (_id + 1)
};

missionnamespace setvariable ["bis_fnc_rscLayer_list",_list];
_id