it's easy ;)
if(isObject(exampleGroup))
exampleGroup.delete();
new ScriptGroup(exampleGroup);
function exampleGroup::exampleFunction(%this,%exampleNumber)
{
for(%i=0;%i<%exampleNumber;%i++)
{
%obj = new ScriptObject();
%obj.number = %exampleNumber;
%this.add(%obj);
}
}
function exampleGroup::dumpExampleObjects(%this)
{
for(%i=0;%i<%this.getCount();%i++)
{
%obj = %this.getObject(%i);
%num = %obj.number;
echo("Object: " @ %obj @ " Number: " @ %number);
}
}
if you do for example
exampleGroup.exampleFunction(5);
it will create 5 example objects and will add it to the example group.
then when you do exampleGroup.dumpExampleObjects(); it loops through all the objects inside the exampleGroup
then it gets each object, finds the number in it, and echos it.
Some quick notes
ScriptGroup.add(%object) - will add an object to the group
ScriptGroup.getCount() - will list the amount of objects in the script group
ScriptGroup.getObject(%count) - it will get the object in the group. %count i think is like, the first object added to the group would be 0, the next 1, the one after that would be 2. etc.
ScriptGroup.remove(%object) - removes an object from the group
ScriptGroup.isMember(%object) - returns a boolean value, checking to see if the object is a member of the script group.