• 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.

Discussion Different macro values of different configuration

T-bond

Member
The new macro definition method is super cool, and long wanted.
But for now, I can't figure out the way how to change their value depending on the current configuration.
In GMS 1.4 for every configuration selected there was a separate Macro editor, so for example I could toggle between the ,,NoAd" or ,,Ad" configuration, and it would change my macros value.

If I want to do the same thing in GMS 2, I have to
Code:
if(use os_get_config() == "Ads")
 //Show ads
instead of
Code:
if(ENABLE_ADS)
 //Show ads
There should be an #ifdef directive at least to check if a configuration is enabled.
For example:
Code:
#ifdef __CONFIG_Android__
#macro ENABLE_ACHIEVEMENTS true
#macro ENABLE_CLOUD_SAVE true
#macro ENABLE_ADS true
#macro ENABLE_FACEBOOK true
#macro ENABLE_IAP true
#else
#macro ENABLE_ACHIEVEMENTS true
#macro ENABLE_CLOUD_SAVE true
#macro ENABLE_ADS false
#macro ENABLE_FACEBOOK false
#macro ENABLE_IAP false
#endif
It could speed up the runtime a bit, and would be also much easier to handle because of the new auto complete feature can help with macros.

(#macro could be replaced with #define, but it is fine also.)

So what do you think? Should be this added to GMS2 or not? (I'm interested in the whys too.)
If enough people say that they want this too, I will open a bug (suggestion) report for it.
 
Last edited:
M

Multimagyar

Guest
hmmmm an ifdef? I would certainly see the use of this.
I mostly did not use macros before because the inability to change them depending on platforms so I just used some global variables or something like that.

I'm not sure how difficult would be to add this though.
 

T-bond

Member
Very good point about the debug switch.
It could be use to leave out different codes from compilation too.

The only question is how hard would it be for the YYG staff to implement it, and maybe only @Mike know it.
 
Last edited:

GMWolf

aka fel666
This would be a very nice addition!
For now you can write a macro like so:
Code:
#macro ADS_ENABLED (os_get_config() == "Ads")
 

T-bond

Member
This would be a very nice addition!
For now you can write a macro like so:
Code:
#macro ADS_ENABLED (os_get_config() == "Ads")
Yes, but unfortunately it gets more and more complicated if you want to use multiple configuration to enable or disable the same future. For example, we have cloud save on Android and on Steam, but not on another platforms, and have ads on android, ios, but again not on another platforms, and so on.
 

GMWolf

aka fel666
Yes, but unfortunately it gets more and more complicated if you want to use multiple configuration to enable or disable the same future. For example, we have cloud save on Android and on Steam, but not on another platforms, and have ads on android, ios, but again not on another platforms, and so on.
Hence it would be a very nice addition.
 

T-bond

Member
Update: The support has responded to my ticket, and they said the #ifdef maybe will be in some of the future versions. :)
 

Jobo

Member
GMC Elder
I think we all agree that preprocessor directives would be a nice luxury to have.
 
Top