Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Ilmion on Mon 20/09/2010 19:23:25

Title: Custom Terms
Post by: Ilmion on Mon 20/09/2010 19:23:25
I've been reading through the demo quest documentation (second post here : Demo Quest 3.1 Thread (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=34048.0)) and there is section about Custom Terms. I take a quick glance (really quick) at the Demo Quest source code and search for uses if the custom term (like TOUCHED) and didn't find any.
What would I use those for ? What is the best exemple of use for the custom term.

Thank in advance.
Title: Re: Custom Terms
Post by: Khris on Mon 20/09/2010 20:52:14
Which section exactly? I couldn't find anything. Do you mean Custom properties? Or actually "Custom Terms"?
Title: Re: Custom Terms
Post by: Ilmion on Tue 21/09/2010 01:19:15
It's in the programming convention (6.3), in the global script header example.

Custom Terms:
   o Uppercase Notation
   o Single words
   o No prefix
   o Values arbitarily assigned

   // Script Header
   #define A                     -01000
   #define ALERGIC               -01001
   #define AUTOMATIC             -01002
      :
   #define B                     -02000
      :
   #define Z                     -26000

   // Script Header
   #define A                     -01000
   #define ALERGIC               -01001
   #define APPLE                 -01002
   #define AUTOMATIC             -01003

    // Any Room Script or Global Script
   int foobar = APPLE;           
   if (foobar==APPLE) {         
   }
   else if (foobar!=APPLE) {     
   }
Title: Re: Custom Terms
Post by: Khris on Tue 21/09/2010 08:07:36
I see, that should be constants.

AGS allows you to define your own constants using the #define "keyword".
Before the script is compiled, the name of the constant is replaced with its value.

AGS has pre-defined constants (http://www.adventuregamestudio.co.uk/manual/Constants.htm).

An example use of constants would be parameters of a module that are supposed to be altered by the user.
Title: Re: Custom Terms
Post by: Ilmion on Tue 21/09/2010 17:49:01
Thank you for your answer.

I know about the #define keyword, but I tough that the "Custom Term" uses of them was something specific of AGS.

So finally I must understand that  it's a convention on using constant for "term"...
Title: Re: Custom Terms
Post by: Khris on Tue 21/09/2010 19:00:04
The DemoQuest was updated last in March 2008. Everything in there is severely outdated and I wouldn't recommend its usage at all, let alone specific programming conventions.

Plus, those are only relevant if you plan to publish the sources.
Title: Re: Custom Terms
Post by: Ilmion on Wed 22/09/2010 00:48:52
I was looking at it that way too, but regardless I found some interesting knowledge.