What is a constant and how do I use it?

From OHRRPGCE-Wiki
Jump to navigationJump to search

A constant is a word that represents a number in a plotscript. Your HSI file is full of them, and you can look at it for examples. Whenever a constant appears in a script, the compiler will replace it with the number it represents.

This is very similar to what a variable is used for, the difference is, constants can only be set once and never changed, but variables can be changed and changed again.

The constants in your HSI file can be very useful. If you use these constants, you only have to remember names, and not ID numbers. Your scripts are also a little easier to understand, because if you come back to your script later you do not have to remember what all those ID numbers represent.

Example[edit]

play song (4)
play song (song:Sorrow Theme)

The first example does not use constants. It plays song number 4. This is fine, as long as you remember which song that is. The second example plays the song named Sorrow Theme using the constants from your HSI file. Since Sorrow Theme is song number 4, both examples do exactly the same thing

See Also[edit]