https://wiki.beyondunreal.com/w/api.php?action=feedcontributions&user=216.156.220.117&feedformat=atomUnreal Wiki - User contributions [en]2017-11-17T22:44:58ZUser contributionsMediaWiki 1.25.1https://wiki.beyondunreal.com/Compiler_directives?diff=46436Compiler directives2017-08-16T23:29:02Z<p>216.156.220.117: /* Unreal Engine 3 */</p>
<hr />
<div>'''Compiler directives''' are lines in [[UnrealScript]] source files that affect compiler behavior and have no meaning at runtime. They are not really used anymore in [[Unreal Engine 3]], which comes with a powerful [[preprocessor]] instead.<br />
<br />
Directives are parsed during the compile process, not before that. This means they cannot be used in [[defaultproperties]] or [[cpptext]] sections. In fact, any directives in cpptext blocks will end up in exported header files for preprocessing by the C++ compiler.<br />
<br />
==Syntax==<br />
Compiler directives must be placed on a separate line. The syntax is as follows:<br />
'''#'''''directivename'' ''parameters''<br />
There must not be anything else before the '''#''' on that line and there shouldn't be anything after the directive name and parameters, except maybe a line comment. Directive names are case-insensitive, like any other part of UnrealScript syntax.<br />
<br />
==Unreal Engine 1/2==<br />
===call===<br />
Similar to the "exec" console command in the editor and the game. Loads a list of console commands from a text file and executes them.<br />
<br />
See [[exec commands]] for a useful selection of commands.<br />
<br />
===error===<br />
Immediately stops compiling with the message: "#Error directive encountered"<br />
<br />
Note that there is no built-in conditional compiling, so using this directive may be quite pointless without an external preprocessor tool like [[UCPP]].<br />
<br />
===exec===<br />
The most-used directive and probably the only one most UnrealScript programmers ever need to use. The '''#exec''' directive executes an editor console command in the context of the compiler.<br />
<br />
See [[exec commands]] for a useful selection of commands.<br />
<br />
==Unreal Engine 2==<br />
<br />
===include===<br />
Loads a text file and replaces the #include line with its content.<br />
<br />
There are several things to watch out for when using this directive:<br />
* Line numbers reported in errors and warnings after the #include line will reflect the source text with the included content, so they no longer match the original source line numbers.<br />
* If the included file contains a [[defaultproperties]] block, it is not included directly. Instead, its content is inserted into the class's defaultproperties block.<br />
<br />
==Unreal Engine 3==<br />
The only known directive in Unreal Engine 3 is '''#linenumber''', which is inserted by the preprocessor after an '''`include''' marco to make sure the compiler reports the line numbers the user expects.<br />
<br />
{{navbox unrealscript}}</div>216.156.220.117