SkookumScript doesn’t have a macro language so it does not have a #define mechanism. However there are plans to have conditionally compiled code sections for debugging or different build types, etc. If you have any needs or wants in this area, please let us know.
Enum class type is just a temporary mechanism until enumerations become a proper part of the SkookumScript syntax. It is a hack though it works fairly well. You create a subclass of the
Enum class, add all the enumerations as class data members, then initialize the enumerations in the class constructor
!() with the values you want. You can see many examples generated from UE4 enumerations as subclasses of
Here is some additional info on how they work.
UE4 Blueprint enums are recently supported. They generate the appropriate SkookumScript
You can see how the future syntax will look with
enumerator on the Syntax online documentation page under “Planned and Future Syntax”.
Symbol objects are a good stand-in for many of the traditional uses for enumerations. They are sort of a hybrid between strings and Integers/enums. They are readable like strings though internally they use a hash value for comparisons so they are as fast as Integers. The main difference from enums is that there is only one
Symbol type and they are not constrained to any set of valid values. They basically look like strings that use single quotes.
SkookumScript currently doesn’t have true constants though there are a few good approximations.
It is easy to store class data members with a value set in a class constructor
!(). Some examples include
@@world which are defined in the
Object class so that they are available anywhere. We recommend storing such values in classes that are related to their use. However these class data members can all be modified - they aren’t actually constants.
You can also create constructor methods for the classes of the constants you want. This ensures that a new copy of a value is always what you want and you can freely modify its value without risk. This is done with many common
Vector3 directions such as
We may add true constants to the SkookumScript syntax in the future or introduce some sort of parser annotation as a compiler hint to prevent modifications on data members with such tags.