OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: Denisko-Redisko on 25 Sep 2009, 09:08:20

Title: library from logic, is that good?
Post by: Denisko-Redisko on 25 Sep 2009, 09:08:20
Arma2 brought something new to the script-coding: the library functions defined in the config. The benefit of this method doesn't seem to me obvious.

What good is that the functions belonging to same library are described in separate files?
What good is that the function name and its code are located in different files?
What good is that to a mere coding is added to messing with the config?

For example, I read the script "AddOns\modules\Functions\variables\fn_areEqual.sqf" line 71:
Code: [Select]
_r = [_d1 select _j, _d2 select _j] call BIS_fnc_areEqual;What is BIS_fnc_areEqual? Search doesn't find it! Oh, this is a recursive call! Damn!

Why not simply write:
Code: [Select]
BIS_fnc_areEqual = (
     / / Code
     <argList> call BIS_fnc_areEqual
);
Of course, I mean that this issue should be addressed to the BIS, but I'm asking this also because this method is becoming popular.

Sorry that so emotionally  :confused:
I'm afraid that I just can't see some significant advantages.
Title: Re: library from logic, is that good?
Post by: Planck on 25 Sep 2009, 12:50:29
Tons of functions you will find in modules.pbo.

Unpack the PBO and look in the functions folder inside the resulting modules folder.

Inside the functions folder are 17 other folders, most of which have functions inside.

The folder 'variables' contains the function you mentioned fn_areequal.sqf.

Also inside the modules.pbo check the cfgfunctions.hpp file.


Planck
Title: Re: library from logic, is that good?
Post by: Trexian on 25 Sep 2009, 14:38:49
I've found AMAZING resources at dev-heaven:
http://dev-heaven.net/repositories/show/cmb

Functions:
http://dev-heaven.net/repositories/browse/cmb/scripts/A2/unformatted/ca/modules/Functions

For the fnc areEqual:
http://dev-heaven.net/repositories/changes/cmb/scripts/A2/unformatted/ca/modules/Functions/variables/fn_areEqual.sqf

It is a bit odd - look on the page for "view" and "download."  Clicking on the links that seem intuitive for me doesn't work. :D
Title: Re: library from logic, is that good?
Post by: Denisko-Redisko on 26 Sep 2009, 21:08:10
Thanks Plank for the answer.
My post isn't about that. All this is good for missionmakers.
But it is also an example to follow. Bad example.
BIS added namespaces, and when I heard about this, I thought - this is so cool. Three. I was shocked. BIS have a good sense of humor. Color TV? What specifically, purple or orange?

Trexian, thanks for the link.