Warning: include(/var/www/html/forum/Sources/../../../includes/depot_files/OFPEC_get_header_image.inc.php): failed to open stream: No such file or directory in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 146

Warning: include(): Failed opening '/var/www/html/forum/Sources/../../../includes/depot_files/OFPEC_get_header_image.inc.php' for inclusion (include_path='.:/usr/local/lib/php') in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 146

Notice: Undefined index: OFPEC in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152

Notice: Trying to access array offset on value of type null in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152

Notice: Trying to access array offset on value of type null in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152
    Home   Help Login Register  

Author Topic: preprocessFile problem  (Read 1376 times)

0 Members and 1 Guest are viewing this topic.

goldmember13

  • Guest
preprocessFile problem
« 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.

Komuna

  • Guest
Re: preprocessFile problem
« Reply #1 on: 10 Oct 2003, 15:28:13 »
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:

Code: [Select]
_MyFunction = preprocessfile "MMK_Func.sqf"
and then use the var:

Code: [Select]
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.:

Code: [Select]
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')
« Last Edit: 10 Oct 2003, 15:30:44 by Komuna »