Constants: (or Global's, as NWN2 calls them)
By definition, a constant is a fixed, but possibly a unspecified value.
Constants in nwnscript are predefined number values assigned to a word for easy identification. For example, lets say I have 3 apples, red, yellow, and green. I want to represent each apple with the numbers 1, 2, and 3. I also want to remember which number value represents which apple. To do so, I make a constant list - something like this;
APPLE_RED = 1
APPLE_YELLOW = 2
APPLE_GREEN = 3
Now I don't need to remember the actual number value. If I want to describe an apple, I enter one of the three constants. APPLE_RED, APPLE_YELLOW, or APPLE_GREEN.
There are hundreds of Visual effect constants in nwnscript. Imagine trying to remember what all the numbers actually represented. Would you know off the top of your head what the number 183 visual effect is? Unless you have a photo graphic memory, probably not. However, if you saw VFX_FNF_SOUND_BURST you would know what effect that is - SOUND_BURST. You would also know that the visual is a FNF type, or "Fire and Forget". Much easier than seeing 183 and then looking up on some chart what 183 is.
All constants for nwnscript are pre defined in the nwscript.nss file and loaded at run time. They are also "global" to every script you write, which I believe is why NWN2 calls them global's instead of constants. With NWN2, the numeric value for each constant, or global is shown in the info box within the script editor. NWN1 does not show this number value. Hint: If you think you might need to know what the actual number value is for a constant in NWN1, open the files "nwscript" in the script editor. Right click in the editor and select "Select All" and then right click and select "Copy". Now open Note pad and right click and "Paste". Save the file for later use. This gives you a text file that you can open to look up the constant value. later, we will learn how to define our own constants.