Jump to content
Sign in to follow this  
igneous01

Strange Errors and Long loading times when using CfgFunctions in mission

Recommended Posts

I am compiling a collection of functions in a mission using the cfgFunctions in description.ext

The functions are all added fine and can be called, but upon loading the mission in preview, it takes a really long time to load, and I get this in my rpt:

if ({_x in _veh} count units _grp == count units _grp) then
{
_>
 Error position: <units _grp == count units _grp) then
{
_>
 Error units: Type String, expected Object,Group
File C:\Users\Sapphire\Documents\Arma 3\missions\Random%20Position%20Generator.Altis\Extended Functions\boolean\Efnc_groupInVehicle.sqf, line 14

This happens for a lot of the functions where I did not use BIS_fnc_params or validated the arguments.

It looks like while on mission load, something is trying to call each function with some test parameters (notably string, null, nothing at all). If the test fails, than the error is logged in rpt.

Is this intentional? Would it not make more sense to test this upon compiling of functions rather than at mission load?

And if it is intentional, why isn't this documented? It's really frustrating to deal with.

Also, I get this error in game on some functions:

EF_fnc_singleParam : preInit is of invalid type - default

here is what I am using in Description.ext

class EF
{

	class Functional
	{
		class singleParam
		{
			preInit = 1; // 1 to call the function upon mission start, before objects are initialized. Passed arguments are ["preInit"]
			ext = ".sqf"; // Set file type, can be ".sqf" or ".fsm" (meaning scripted FSM). Default is ".sqf".
			file = "Extended Functions\functional\Efnc_singleParam.sqf";
		};
	};

Based on what I understood from the docs on how to add functions via cfgFunctions

Can anyone shed some light on these issues?

Share this post


Link to post
Share on other sites

You are missing one }; at least, but that was probably just left out from the paste.

It looks like while on mission load, something is trying to call each function with some test parameters (notably string, null, nothing at all). If the test fails, than the error is logged in rpt.

Is this intentional? Would it not make more sense to test this upon compiling of functions rather than at mission load?

And if it is intentional, why isn't this documented? It's really frustrating to deal with.

I might be misunderstanding something (sorry if I did), but if you put preInit = 1 as an attribute to a function, it'll be automatically called pre-initialisation. Like it says in the comment of what you pasted: "1 to call the function upon mission start, before objects are initialized". If you just want to compile functions for later use, leave preInit (and postInit) out altogether.

As another note, you don't need to specify ext if you have the file path.

Share this post


Link to post
Share on other sites

thats just it - it tells me preInit = 1 is an invalid value (expects object?)

Also to make the 'test' issue a little more clearer:

if I add a functions via cfgFunctions

- if it does not use BIS_fnc_param to validate all arguments

- if it does not validate arguments manually

- rpt will log a bunch of errors from something trying to call the function like so ["", objNull] call thisFnc at missionLoad!

- I made sure nothing is calling these functions (init, unit init box, include all clean) at init time

Share this post


Link to post
Share on other sites

Sorry if I'm making it worse by not getting it, but just to be sure: so you do want to call the script automatically at missionLoad, and have preInit = 1 in there for a reason, then? Because it's confusing that you talk like it shouldn't do that when it's set to 1.

And clarifying further, if you don't want to have the Functions Library automatically call the script when the mission is loaded, then leave preInit = 1 out. All you need for a function is the file path. The invalid type it complains about might be the preInit variable that preInit passes to the function. From the comment of what you pasted: 'Passed arguments are ["preInit"]'

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  

×