Jump to content
Sign in to follow this  
VictorFarbau

BIS_fnc available for addons?

Recommended Posts

I am struggling a bit with that BIS_fnc concept. Until some patch level there was a core set of BIS_fnc tagged functions that worked just fine.

Now the user has to place a "Functions" module onto the map - otherwise functions won't work.

I find this extension of functionality ambiguous - now we have regular scripting commands but also another set of commands through functions dependant on a module. Not sure what the purpose of this split is.

Nonetheless some of these functions are incredibly useful. But does it make sense to use them in any addon? In terms of concept - aren't they bound to fail unless used on user maps that happen use the functions module?

Cheers,

VictorFarbau

Share this post


Link to post
Share on other sites

Myself, when i want to use such BIS functions, i tend to include the script into my works but with different name so they wont interfere with the original. This way i'm sure i have full control that it works as i wanted it to.

Or you simply precompile the function the same way the module would do it. After all, at the end the functions modules does nothing else than precompiling them and when and where it is done is irrelevant.

Share this post


Link to post
Share on other sites

1. Spawn the Functions Module when you don't detect it

or

2. When you use CBA, the functions module is always placed and compiled, regardless if it is existing in the missions. Functions are all compiled at preInit, but for some further initializations required by some functions in the functions module, best to wait for;

waitUntil {bis_fnc_init}; // I think it was ;)

Share this post


Link to post
Share on other sites
Spawn the Functions Module [...]

@Sickboy - now I am angry that I didn't think of this myself so I won't thank you :D I do hold scripts until <bis_fnc_init> already; I just noticed recently that they sometimes never started due to the missing functions module. I'll go for that approach, thanks!

@Myke - I see where you're coming from. But I have learned to let go and use existing pieces of code :) Who knows, maybe stuff gets updated or extended in the future. I am fine with just referencing it.

Cheers guys,

VictorFarbau

Share this post


Link to post
Share on other sites

At least during development it may be wise to use a copy of the function, so that you can re-enable it's debug output. Checking the output may give clues on why it doesn't produce the correct results (wrong parameters given etc). When everything works, and you don't need any modifications to it, then it may be good to move back to the official one. Keep in mind that what gets fixed in the official version may break it for you.

Share this post


Link to post
Share on other sites

Duplicating and reinventing the wheel isn't necessary.

Frameworks, function collections etc are a good thing. Generally fixes or changes shouldn't break backwards compatibility, unless for a very good reason, and therefore it's fine if you have to adjust your code for it.

You can debug input/output of all the functions easily anyway; in your own scripts, or by using an adjusted functions init script.

Or do like CBA/ACE; Build in optional debugging into every script and function, preprocessor based; so the debug code can be completely removed from the code at compile preProcess.

Then enable / disable it on several levels (part of script file, whole script file, whole component, whole mod, etc etc).

Share this post


Link to post
Share on other sites

The BIS functions module is a treasure, definitely worth using and has little cost aside from the waitUntil for it to warm up - true of most modules out there. Just yesterday was adding some light sources to hangars, buildings pointed in various directions. Use the fnc_RelPos call meant not having to mash about with a lot of trigometry, just focus on offsets from center of building and the the code spin the lights around to match building orientation.

Share this post


Link to post
Share on other sites
1. Spawn the Functions Module when you don't detect it

Ok... I give up. :) I'm sure it is something ridiculously simple, but how do I create the functions module in a script? :)

Share this post


Link to post
Share on other sites
Ok... I give up. :) I'm sure it is something ridiculously simple, but how do I create the functions module in a script? :)

createCenter sideLogic;
_grpLogicFunctionsManager = createGroup sideLogic;
_FunctionsManager = _grpLogicFunctionsManager createUnit ["FunctionsManager", [1, 1, 1], [], 0, "NONE"];

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×