OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: goldmember13 on 08 Oct 2003, 16:19:55
-
hi!
I want to know if possible to use preprocessFile command in script but only work this in init.sqs? Because When I call a function( in a script) with preprocessFile the program did not find it, but this same function call works in init.sqs.
-
You can always call a function from a script (I know you know that ;)). You can preProcess such function at the init of a mission (init.sqs or init field of a unit) or during the mission (through script or trigger or whatever). All you must do is:
_MyFunction = preprocessfile "MMK_Func.sqf"
and then use the var:
Returned_Value = _arguments call _MyFunction
Notice that _MyFunction is a local var, so you can only use it within scripts. If you want to use it in the global space just remov the underscore "_".
You can also use the preprocessing while calling the func.:
Returned_value = _arguments call (preprocessfile "MMK_Func.sqf")I just don't recomend it.
Though I store the returned value in the var 'Returned_value', it doesn't mean that the function returns, indeed, any value! It could just be a simple process without arg return.
#Edit
There's the 'loadFile' too! It works very similarily, however you cannot have comments in the func ('//comment')