Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: fireapache on Sun 31/07/2011 19:56:18

Title: Question about #define
Post by: fireapache on Sun 31/07/2011 19:56:18
Hi, Folks, I have got some questions to ask about definitions:

What the #define does?

In the KeyboardMovement.asc (Default Template) I found this: #define DISTANCE 10000

This is the same thing if I called const int or just int?

I've found #ifdef and #endif in another script, then the definition needs to be logical or I can use numerical equations?

Well, I'd like some complete explanation about this, please!  :=
Title: Re: Question about #define
Post by: Khris on Sun 31/07/2011 20:42:29
A quick forum seach for #ifdef yielded this:
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=32840.0

To elaborate, everything between #ifdef X and #endif is ignored and not compiled, if X is undefined.
Everything between #ifndef and #endif is only compiled when X is undefined.
There's also #ifver.

All of those can be used to find out what AGS version is used or whether the game's compiler settings are strict or not (only new-style commands or not) and similar stuff.
They are only needed by module coders who want their module to work with several older version of AGS, too.

You don't really need them to make your own game.
Title: Re: Question about #define
Post by: fireapache on Mon 01/08/2011 05:13:10
Hey, Thanks Khris, good reply!  8)