Did a search, and this appears to be the most recent post on the subject.
I am missing this kind of functionality.
Specifically, I would like to see a 'user-defined data type' or what is called a structure or 'struct' in C:
psuedo code of no particular language:
structure coord{
x : number;
y : number;
};
structure Enemy{
ID : number;
coord : coord; // <-- uses the struct defined above.
onscreen : boolean;
damaged : boolean;
name : text;
attack : number = 1;
defense : number = 1;
weaponModules : array[0..10] of hardpoints; //<-- an array of a struct.
};
Enemies : array[1..100] of Enemy; //<-- an array of the Enemy structure.
With this kind of structure, the code is a little better at self-documenting, as opposed to using plain arrays. For example:
Accessing Enemies.weaponModules[j].hitpoints is far more readable than something like aEnemyWeaponModules[i,j,4], where you have to leave yourself a note that Z-index 4 is 'hitpoints'. And you have to know how you are associating separate arrays that contain all the Enemy parameters, or else the documentation load gets worse and the code gets more cryptic if you are cramming everything into one array called aEnemies(x,y,z)
For all intents and purposes, it is a record with fields, as in a data base, with fields consisting of one or any of the base types of the language, which for C2 is essentially a 'number', boolean, or string (text). But it also can contain another struct as one of it's defined fields, and it can define an array of any of the three C2 base types or any previously defined structures. So you could have a hierarchy of structures, where potentially, only the lowest levels of the hierarchy actually contain base types.
For now, if I just want an instance of this kind of record, or want several instances to act as a table of records, then creating instance variables within an Array will be the closest I can come, I believe, with the exception that it can't create an array of instance variables (i.e., sub-arrays), nor can it create an instance variable, or 'field' of a type other than number, Boolean, or text. That, and the instances can't quite be referenced like an array, though C2 does provide good ways to pick specific instances or process all or a subset of instances, so maybe that is not an issue really.
Then to realize the full benefit, I would want to be able to write a function that takes as an input parameter (or input/output parameter, or typically called a by-ref parameter in some languages) one of these structures.
Of course, the structure concept and XML mesh well together, so you could have the XML plugin write a structure out to XML, or read an XML file into a structure, facilitating saving and loading save-games or game-options, or other persistent data.