Hi,
I want to find a way to detect addons inside a config.cpp. So if someone has a particular addon installed, I can add the appropriate class. The RequiredAddons section is no good, as it will throw up an error message during startup, if the addon is missing.
I did try and use this in ATC_HwaksC5.pbo:
#IfDef ATC_Runways
class ATC_HwaksC5
   {
   };
#EndIf
But #IfDef only detects variables created with #Define, and I guess, #Define variables are local to thier config? So even if I add:
#Define ATC_Runways
To the config in ATC_Runways.pbo, it still would not work.
I also tried using Scope:
// type scope
// used for show entry
#define private 0 //! item is never visible
#define protected 1 //! "advanced designer" switch must be activated to use it
#define public 2 //! anyone can see/use it
I defined a function in the C5 config:
#define ATCSCOPE Call LoadFile "\ATC_HwaksC5\ATC_Detect.sqf"
Where ATC_detect.sqf contains:
private ["_result","_logic"];
_Result=2;
_Logic="ATC_Logic" CreateVehicle [0,0,0];
If (IsNull _Logic) Then {_Result=0};
DeleteVehicle _Logic;
_Result
ATC_Logic is defined in ATC_Runways.pbo, if ATC_Runways.pbo is not installed createvehicle will return ObjNull and my function will return 0. Otherwise the function returns 2.
And further down in the C5's config:
class ATC_C5Galaxy: c5galaxy
   {
   scope=ATCSCOPE;
   displayName="C-5A Galaxy (Hawk)";
   vehicleClass="ATC Aircraft";
   .
   .
   .
   .
   .
   .
   };
So all this works fine, up to a point. Remove ATC_Runways and the function returns 0, and the the C5 is not displayed. The function returns 2 when ATC_Runways.pbo is installed and that displays ATC_HawkC5 in the editor. But I also get this error message when I first launch the game:
I don't know what mission it's reffering to. I guess it must be the default OFP desert island into? I only get the error when ATC_Runways.pbo is installed, which is very strange.
Any ideas?
Cheers