Home   Help Search Login Register  

Author Topic: PreprocessFile and Macros  (Read 568 times)

0 Members and 1 Guest are viewing this topic.

Unnamed

  • Guest
PreprocessFile and Macros
« on: 05 Feb 2004, 19:13:44 »
Quote
Return preprocessed content of given file. Preprocessor is C-like, supports comments using // or /* and */ and macros defined with #define
This is from the Comref. Anyone know how you use macros with #Define ?

Cheers

Offline Dinger

  • Contributing Member
  • **
  • where's the ultra-theoretical mega-scripting forum
Re:PreprocessFile and Macros
« Reply #1 on: 05 Feb 2004, 20:53:18 »
Yeah, for example:

#define private 0

private is the macro, and 0 is the value to replace it with.
so every time you use private in the processed file, it replaces it with zero.

Note that you cannot preprocess .sqfs inside of an addon.
Dinger/Cfit

Unnamed

  • Guest
Re:PreprocessFile and Macros
« Reply #2 on: 06 Feb 2004, 12:54:49 »
I did try this using PreProcessFile on a function in my mission editor directory:

#Define MyMacro "Hello";

Hint Format ["This Macro %1",MyMacro];

But it seems to invalidate the function, you can call it without any errors. It just wont execute the hint until I remove the #Define line.

Am I using it correctly?


Edit:

Scratch that, #define is case sensitive and you dont need a semicolon. This works without any problems:

Code: [Select]
#define MyMacro Count [1,2,3]

Hint Format ["This Macro %1",MyMacro];

Cheers

P.S I read in an earlier thread about Loadfile and Addons, that functions in an Addon are already processed. Is this correct, I did not think the PBO utils were that sophisticated?
« Last Edit: 06 Feb 2004, 13:29:54 by Unnamed »

Extreme Studios

  • Guest
Re:PreprocessFile and Macros
« Reply #3 on: 07 Feb 2004, 15:45:06 »
It's probably best that you don't go into that unless your good at c++ programming or something, i don't.