Custom Terms

Started by Ilmion, Mon 20/09/2010 19:23:25

Previous topic - Next topic

Ilmion

I've been reading through the demo quest documentation (second post here : Demo Quest 3.1 Thread) 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.

Khris

Which section exactly? I couldn't find anything. Do you mean Custom properties? Or actually "Custom Terms"?

Ilmion

It's in the programming convention (6.3), in the global script header example.

Code: ags
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) {     
   } 

Khris

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.

An example use of constants would be parameters of a module that are supposed to be altered by the user.

Ilmion

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

Khris

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.

Ilmion

I was looking at it that way too, but regardless I found some interesting knowledge.

SMF spam blocked by CleanTalk