• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

 #ifdefined or #ifmacro or any other precompile check [SUGGESTION]

xDGameStudios

GameMaker Staff
GameMaker Dev.
Hi YoYo team and everyone!
I would like to know if it was possible to add a #ifdefined or #ifmacro precompile check
or another precompile check to check for use within extensions (I'm saying this because I think this is more of an extension development modular feature).

#ifextension extension_name
...
#endif

imagine I have a extension that works differently depending on where there is another extension present or not... for example:

extension A:
Code:
#define stuff_manager

extension B:
Code:
var stuff = [........];

#ifdefined stuff_manager

stuff_manager_add_new_stuff(stuff);    // this function is from stuff manager

#endif
return stuff;
or would it be a bad ideia to have something like this?!
 

rwkay

GameMaker Staff
GameMaker Dev.
I am really against doing this as it turns code into spaghetti and is really not a good idea, we already do compile time optimisation so doing something like

#macro ENABLE_STUFF_MANAGER 0

if (ENABLE_STUFF_MANAGER) {
stuff_manager_add_new_stuff( stuff );
}

will already drop the code out completely and it will not be in the compiled output, so I do not see the need to have the macro spaghetti over and above the normal spaghetti of code.

Russell
 

xDGameStudios

GameMaker Staff
GameMaker Dev.
I am really against doing this as it turns code into spaghetti and is really not a good idea, we already do compile time optimisation so doing something like

#macro ENABLE_STUFF_MANAGER 0

if (ENABLE_STUFF_MANAGER) {
stuff_manager_add_new_stuff( stuff );
}

will already drop the code out completely and it will not be in the compiled output, so I do not see the need to have the macro spaghetti over and above the normal spaghetti of code.

Russell
I understand what you mean.. but then we must have an ENABLE_STUFF_MANAGER macro despite having the extension or not... because if not the
if-statement would give an error ENABLE_STUFF_MANAGER doesn't exist!
 

rwkay

GameMaker Staff
GameMaker Dev.
well you have to have the macro somewhere but you can set it to 1 or 0 depending on if you want the code to run (much like the #if def type thing above)...

never liked the checking for the existence of things before executing code

Russell
 
Top