idl0r 10 Posted August 8, 2011 Hi everybody, I'd like to use a header in some scripts. Its no problem if I do that in the mission root directory as the #include directive supports directories as well. The problem start if you're in a sub directory and want to include something from e.g. mission root or another sub directory. Example: <missionroot>/subdir1/foo.hpp: #define FOOBAR <missionroot>/foo.sqf: #include <subdir1\foo.hpp> That above works as well as #include "..." but this case doesn't: <missionroot>/subdir2/foobar.sqf: #include "..\subdir1\foo.hpp" So "..\" isn't supported at all and the server/client "crashes" because it can't find the header. My question is now: Is there a way to *properly* include header/files in such cases anyway? I tried to google a bit about it and the only thing I found was using "mpmissions\__cur_mp.<island>\<file name>" or "missions\__cur_sp.<island>\<file name>". I don't know whether it works at all or not but even then I'd be still just a workaround to me. Share this post Link to post Share on other sites
sickboy 13 Posted August 8, 2011 Indeed you need to use the full path. Not sure if missions/ or mpmissions/ is supposed to be in front of it (not much experience ref missions and includes), but you'll figure that out when trying it :) Share this post Link to post Share on other sites
idl0r 10 Posted August 8, 2011 Yeah, well.. the full path may be different then depending on SP/MP if you're referring to the __cur_mp thingy - right? Share this post Link to post Share on other sites
sickboy 13 Posted August 8, 2011 Yeah, well.. the full path may be different then depending on SP/MP if you're referring to the __cur_mp thingy - right? __cur_mp = MP, __cur_sp == SP, hence I don't expect the requirement of missions\ / mpmissions\ in front, but it could very well be required. Share this post Link to post Share on other sites
idl0r 10 Posted August 8, 2011 That means I'd have to use something like this: if (isServer) then { #include "__cur_mp.<island>\..." } else { #include "__cur_sp.<island>\..." }; That would be just horrible... Share this post Link to post Share on other sites
Muzzleflash 111 Posted August 8, 2011 I think the most practical solution would be to simple copy the header files into the subfolders. Maybe make a bat file to do it like in domination. Share this post Link to post Share on other sites
sickboy 13 Posted August 8, 2011 if (isServer) then {#include "__cur_mp.<island>\..." } else { #include "__cur_sp.<island>\..." }; That wouldn't work. Also the difference should be isMultiplayer, not isServer :) isServer is true in singleplayer for instance ;) I reference scripts/headers from addons (#include "\addon_prefix\script_or_header_file"). And even put the missions in addon too. But I suppose you want an addonless mission. Share this post Link to post Share on other sites
idl0r 10 Posted August 8, 2011 I reference scripts/headers from addons (#include "\addon_prefix\script_or_header_file"). And even put the missions in addon too. But I suppose you want an addonless mission. Right. ---------- Post added at 02:27 PM ---------- Previous post was at 02:15 PM ---------- I think the most practical solution would be to simple copy the header files into the subfolders. Maybe make a bat file to do it like in domination. I don't want to have e.g. 5 duplicates of my header just to be able to include it. Makes it just more "complicated" esp. if somebody else (probably one who is unexperienced) want to edit something etc. Share this post Link to post Share on other sites