Game Development Community

Define - how do I define the word "defaultState" to mean 1?

by Josias Gibbs · in Torque Game Engine · 09/19/2008 (4:13 pm) · 2 replies

I'm building a simple state machine in TGB, and I'd like my states to have better names than 1, 2, 3, etc. In C, I would say:

#define DEFAULTSTATE 1
#define HEADINGTOCENTER 2
#define SOMEOTHERSTATENAME 3

or

enum state {default, headingToCenter, someOtherStateName, ...}

but how would I do it in Torque Script?

#1
09/19/2008 (4:19 pm)
Probably global variables?
$STATE_DEFAULT = 1;
$STATE_HEADINGTOCENTER = 2;
$STATE_BLABLA = 3;
Or even just string literals if you want.

TorqueScript does not have a concept of defines or macros btw, would be cool, although that might make compile time error checking even less useful.
#2
09/21/2008 (9:44 am)
Exactly what I needed to know - thanks as always James.