Author Topic: Making functions in custom-defined scriptObjects  (Read 398 times)

I've gotten it to work for defining variables in scriptObjects:
Code: [Select]
$test = new scriptObject(){test = 1;}echo($test.test);
but I haven't been able to get any variation of defining a function to work. Does anyone know how to do this, or is it just not possible? Thanks.


EDIT: In a master-child-child scenario, how does one make a list object? I tried listObject as the simplest choice, but unsurprisingly it did not work.

Code: [Select]
==>$master = new scriptObject(){exists = 1;};
==>$child = new scriptObject(){master = $master;};
==>echo($child.master.exists);
1

How can I make $master in this example have a list to the children that it owns?
« Last Edit: December 10, 2010, 11:42:29 PM by Xalos »

Code: [Select]
$master.child = $child;
Code: [Select]
function ScriptObject::die(%this)
{
    if(isObject(%this.child))
        %this.child.delete();
    %this.schedule(10,delete);
}

But for masters/childs/etc, you should make the master a ScriptGroup for easyness
Code: (Console Input) [Select]
==> new ScriptGroup(masterObj);
==>  new ScriptObject(someChild);
==> masterObj.add(someChild);
==> echo(someChild.getGroup.getName());
masterObj
==> masterObj.listObjects();
    0: ScriptObject - someChild
« Last Edit: December 11, 2010, 04:34:43 AM by Bauklotz »