Jump to content
Sign in to follow this  
Muzzleflash

Preprocessor "Defines" for Addons

Recommended Posts

I was wondering if there is any preprocessor definition for ACE and ACRE. What I mean is, say I have an ammobox I empty and add custom weapons and magazines to it, I want to know if ACE is running before adding ACE weapons and if ACRE is running before adding radios, so there doensn't come any missing classnames errors.

//ammobox.sqf

/*
Adding standard equipment here
.....
.....
*/

#ifdef _ACE_SOMETHING_
//Add ACE weapons
#endif

#ifdef _ACRE_SOMETHING_
//Add ACRE radios
#endif

I'm only asking spefically for ACE + (ACEX I guess) and ACRE. However, I left the thread title generic so other people can ask and post #defines for other addons.

Thanks.

----------------

I'm guessing you could do some kind of check using configs ( >> syntax ) and if the entry exists then the addons is most likely loaded. However I don't think that can be translated into preprocesser macros which I think is cleaner for this situation.

Edited by Muzzleflash

Share this post


Link to post
Share on other sites

Ace is an addon so its already defined and running before the mission starts..

Share this post


Link to post
Share on other sites

Didn't think of that.. Hmm.. :(

---------- Post added at 20:35 ---------- Previous post was at 20:25 ----------

Will something like this work reliably:

if (getText (configFile >> "CfgWeapons" >> "ACE_Earplugs" >> "displayName") == "") then {
 G_ACE_Enabled = false;
} else {
 G_ACE_Enabled = true;
};

Edited by Muzzleflash

Share this post


Link to post
Share on other sites
if (isClass (configFile >> "cfgWeapons" >> "ACE_Earplugs")) then {
   G_ACE_Enabled = true;
} else {
   G_ACE_Enabled = false;
};

Share this post


Link to post
Share on other sites

Sorry fixed it now. I used the "quick" editor and the lack of the actual CODE button made me forget. And somehow I missed while checking my post got.. well posted.

Edit--

Ah your's is shorter.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×