Functions Library – Arma 2
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Some wiki formatting) |
Lou Montana (talk | contribs) m (Add category) |
||
Line 78: | Line 78: | ||
[[Category: Functions Library]] | [[Category: Functions Library]] | ||
{{GameCategory|arma2|Editing}} | |||
{{GameCategory|arma2|Editor Modules}} | {{GameCategory|arma2|Editor Modules}} |
Revision as of 17:52, 4 August 2021
Function Library is pack of script functions available from anywhere in game.
Initialization
Paths
Editor:
Modules (F7) > Function Library
Data:
ca\modules\functions ca\modules_e\functions ca\modules_pmc\functions
Startup
Place Function manager on map. No additional synchronizing needed.
Usage
First, you need to check if Functions were already initialized:
waitUntil { !isNil "BIS_fnc_init" };
After that, you can call any function using following syntax:
_fnc = [params] call TAG_fnc_functionName
In-game functions viewer
See BIS_fnc_help
Adding new functions
List of functions is defined in config - CfgFunctions. New ones can be also added in Description.ext file of mission or campaign.
class cfgFunctions
{
class BIS
{
class category1
{
class Test1 { description = "Testing file 1" };
};
};
class TAG
{
class category1
{
class Test2
{
description = "Testing file 2";
file = "test.sqf";
};
};
};
};
If 'file' path is not set, system will search for file 'functions\category\fn_function.sqf" (if CfgFunctions is defined in Description.ext) or 'ca\modules\functions\category\fn_function.sqf" (if CfgFunctions is defined in config.cpp).
Result is:
- BIS_fnc_Test1 - will load script \functions\category1\test1.sqf from mission or campaign directory
- TAG_fnc_Test2 - will load script test.sqf