diff --git a/fn_templateFunc.sqf b/fn_templateFunc.sqf new file mode 100644 index 0000000..68c8915 --- /dev/null +++ b/fn_templateFunc.sqf @@ -0,0 +1,58 @@ +/* + Author: + Insert author name here + + Last Updated: + Provide date of most recent update to the function + + Description: + Provide a description of the purpose and output of the custom function + + Paramters: + 0: STRING - Example parameter - Provide description of purpose + 1: BOOLEAN - Example parameter - Provide description of purpose + + Returns: + Define the variable type returned by this function. If no variable returning as a part of code, add 'true;' to the last line of your function and set BOOLEAN here. + This ensures that the function does not return 'nil', which depending on how you are executing this function could lead to errors. 'true;' ensures that the function returns something on successful run. + + Examples: + Provide example of how to execute your custom code. Example provided below from fn_toggleLayerSim.sqf + ["Objective01-Assault", true] call TAG_fnc_toggleLayerSim; +*/ + +// Define variables for input via parameter +params ["_stringParam", "_booleanParam"]; + +// Import data based on provided parameters +private _stringVariable = _stringParam; +private _booleanParam = _booleanParam; + +// Execute code +{ + // Do something here; +} +true; + +/* + IMPORTANT + Your custom function file MUST be prefixed with 'fn_' - This ensures the Arma engine picks it up and compiltes it. + To utilise this code in a mission, you must import the function file into your mission folder under /MISSION_NAME/functions/* + You must then define the function in your mission's Description.ext file in the CfgFunctions class. This is an example of how fn_toggleLayerSim.sqf has been imported in one of my missions: + + class CfgFunctions + { + class CLRK // This classname should be what you want the 'tag' of your function's to be (e.g TAG_fnc_functionName) + { + tag = "CLRK"; // Define the function 'tag' here + class Layers // This allows you to create different function categories. A 'Category' by default serves as a folder under '/functions' - i.e \functions\categoryName + { + file = "functions"; // This defines the folder where this function file can be found + class toggleLayerSim {}; // This defines the name of the function. This should be your function's file name minus 'fn_' and '.sqf' (prefix and suffix gone basically) + }; + }; + }; + + I then execute this code using the following line in the mission: + ["layer_name", true] call CLRK_fnc_toggleLayerSim; +*/ \ No newline at end of file