Difference between revisions of "HPL3/Scripting/Scripting Guide/Enums"
< HPL3
Jump to navigation
Jump to search
| Line 4: | Line 4: | ||
Enum is a user defined datatype in HPL3. It is used to assign names to the integral constants which makes a script easy to read and maintain. The keyword “enum” is used to declare an enumeration. | Enum is a user defined datatype in HPL3. It is used to assign names to the integral constants which makes a script easy to read and maintain. The keyword “enum” is used to declare an enumeration. | ||
| − | == How to Use Enums == | + | ==How to Use Enums== |
| − | Enums are mostly required as a parameter for existing HPL3 functions. One of the most common function which uses an enum is <code>Music_Play</code>. For example: | + | Enums are mostly required as a parameter for existing HPL3 functions. One of the most common function which uses an enum is <code>Music_Play</code>. For example:<syntaxhighlight lang="c++"> |
| − | + | Music_Play("MyMusicFile.ogg", 1.0f, false, eMusicPrio_BgAmb); | |
| − | + | </syntaxhighlight> | |
| + | The last parameter, eMusicPrio_BgAmb, is a value of the enum eMusicPrio. | ||
{{NavBar|HPL3/Scripting/Scripting_Guide/Local and Global Variables|Local and Global Variables|HPL3/Scripting/HPL3 Scripting Guide|HPL3 Scripting Guide|HPL3/Scripting/Scripting_Guide/Working with Classes|Working with Classes}} | {{NavBar|HPL3/Scripting/Scripting_Guide/Local and Global Variables|Local and Global Variables|HPL3/Scripting/HPL3 Scripting Guide|HPL3 Scripting Guide|HPL3/Scripting/Scripting_Guide/Working with Classes|Working with Classes}} | ||
[[Category:HPL3 Scripting]] | [[Category:HPL3 Scripting]] | ||
[[Category:English]] | [[Category:English]] | ||
Revision as of 23:09, 14 August 2020
Enum is a user defined datatype in HPL3. It is used to assign names to the integral constants which makes a script easy to read and maintain. The keyword “enum” is used to declare an enumeration.
How to Use Enums
Enums are mostly required as a parameter for existing HPL3 functions. One of the most common function which uses an enum is Music_Play. For example:
Music_Play("MyMusicFile.ogg", 1.0f, false, eMusicPrio_BgAmb);
The last parameter, eMusicPrio_BgAmb, is a value of the enum eMusicPrio.