Page tree
Skip to end of metadata
Go to start of metadata



Introduced in

Version:1.00

Description

Description:

Reads and processes the content of the specified file.

The processed file is stripped of any comments, and any preprocessor commands that are executed when the string is returned.

Example:

_a = 1; // one
_b = 2; // two
#define ten 10
_c = ten; // ten

Would be returned as:

_a = 1; 
_b = 2; 

_c = 10; 

Due to the hard-drive access this command executes (and the lack of caching), this command should not be used in time-critical script loops.

If no path is supplied with the script name, then the file is assumed to be in the mission folder. If the specified script is not found in there, other locations are searched, depending on the VBS version and current mode (Editor, SP, or MP). See Location for details.

Syntax

Syntax:preprocessFile fileName
Parameters:
  • fileName: String - Either no, or a relative, or an absolute path (see Location for details).
Return Value:String

Examples

Examples:
_content = preprocessFile "myFunction.sqf"

Additional Information

See also: preprocessFileLineNumbers, clearPreprocessCache, PreProcessor Commands
Multiplayer:
Problems:In V2.0+, this command returns the same data as preprocessFileLineNumbers (it includes the header line).

Notes







Posted on Deb 18, 2011
Kronzky
To retrieve a return value from a regular script (i.e. to have it behave like a function), put the return value into the last line (with or without a trailing semicolon), and call it with call compile preProcessFile:
chkDamage.sqf:


_unit = _this select 0;
_health = getDammage _unit;
_health

Call syntax (from another script):

_damage=[player] call compile preprocessFile "chkDamage.sqf";