I need to shown the enumerations as text, is that possible?
Example:
I declare
Var Enum Example
{
Something,
Something else,
Something different
} En_Example;
And then I use something like broadcastmessage (En_Example);
Alright, that will show the number, say if En_Example is Something then it's going to broadcast a zero, but I want it to broadcast "Something", how can I do this?
Enumerations shown as text.
Re: Enumerations shown as text.
I remember seeing a function that prints the string representation of an enumeration within code, but it was UE3 or Unreal227... I could totally implement this in XC_Engine.
Re: Enumerations shown as text.
Code: Select all
native static final function name GetEnum( object E, int i );
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
Re: Enumerations shown as text.
They way to use it may be a little odd. Remember that enum values are just numbers, so you can plug them into any parameter of types byte or int. That first parameter, however, expects the object representing enum declaration itself. (It's just a standard object literal of type Enum, like the Class, Texture or Sound type literals you probably use all over the place.)
Examples: (logging merely serves as example usage of the GetEnum output)
You could also mess up:
Examples: (logging merely serves as example usage of the GetEnum output)
Code: Select all
Log(GetEnum(Enum'EPhysics', 2)); // logs "PHYS_Falling"
Log(GetEnum(Enum'EDrawType', class'Projectile'.default.DrawType)); // should log "DT_Mesh", unless you messed with something you shouldn't mess with
Log(GetEnum(Enum'ENetRole', Role)); // might log e.g. "ROLE_Authority" in offline games
Code: Select all
Log(GetEnum(Enum'EPhysics', Level.NetMode)); // would log e.g. "PHYS_Walking" instead of "NM_DedicatedServer" or "PHYS_Falling" instead of "NM_ListenServer"
Re: Enumerations shown as text.
Alright, I will try this out and I'll tell you what I get, if all else fails then I'll use an array or something.