TokenNameValueTypes: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (FloatTokenNames moved to TokenNameValueTypes: made a single page (and therefor single link) to all the separate bools, ints, string, and array definitions. It's a small 'quick read' blurb for each 'type' and dont require separate pages as such.)
mNo edit summary
Line 18: Line 18:
  #define false 0
  #define false 0
  #define true 1
  #define true 1
LightOn = true;
'''Arrays[]={...};'''
Arrays are of unrestricted content in terms of what 'types' they can have in them, and, their number.


  LightOn = true;
Arrays, can be (and often are) embedded within arrays.
 
Arrays can have mixtures of type in the same array
 
  sound[] = {"fuel_explosion",10.000000,1};
 
Quite frequently a specific array will have a fixed number of dimensions. For instance
 
color[]={1.0,0.3,0.6,0.0};
 
The fact is, the color array as used by the ofp engine, has, 4 values. (all of them floats)
 
However consider this
 
cargoAction[]={"ManActM113Medic","ManActM113Medic","ManActM113Injured"};
 
the number of elements in this array, happens to be 3, and happens to describe a Medic bmp that can carry three soldiers!
 
Other models carry more (or less).

Revision as of 09:45, 1 July 2006

Token Name values

The ofp engine, and specifically, a binarised file (signature raP) identifies only a few different 'types' of Token Name

aString = "A string";
anInteger = 1234567;
aFloat = 0.0123;
anArray[] = {.....};

Everything that can be stated in a config.cpp, a description.ext, a mission.sqm for TokenName value pairs devolves to one of the above 'types'.

Separately, a fifth type exists called boolean.

aBoolean = 0;

In fact the engine only stores and 'sees' this value as an integer. But by convention in humanly readable text files (config.cpp vs config.bin), integers that can only have zero or non zero values are declared in statements as

#define false 0
#define true 1
LightOn = true;

Arrays[]={...};

Arrays are of unrestricted content in terms of what 'types' they can have in them, and, their number.

Arrays, can be (and often are) embedded within arrays.

Arrays can have mixtures of type in the same array

sound[] = {"fuel_explosion",10.000000,1};

Quite frequently a specific array will have a fixed number of dimensions. For instance

color[]={1.0,0.3,0.6,0.0};

The fact is, the color array as used by the ofp engine, has, 4 values. (all of them floats)

However consider this

cargoAction[]={"ManActM113Medic","ManActM113Medic","ManActM113Injured"};

the number of elements in this array, happens to be 3, and happens to describe a Medic bmp that can carry three soldiers!

Other models carry more (or less).