Blockland Forums > Modification Help
Making functions in custom-defined scriptObjects
(1/1)
Xalos:
I've gotten it to work for defining variables in scriptObjects:

--- Code: ---$test = new scriptObject(){test = 1;}echo($test.test);
--- End code ---

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: ---==>$master = new scriptObject(){exists = 1;};
==>$child = new scriptObject(){master = $master;};
==>echo($child.master.exists);
1

--- End code ---

How can I make $master in this example have a list to the children that it owns?
Bauklotz:

--- Code: ---$master.child = $child;
--- End code ---


--- Code: ---function ScriptObject::die(%this)
{
    if(isObject(%this.child))
        %this.child.delete();
    %this.schedule(10,delete);
}

--- End code ---

But for masters/childs/etc, you should make the master a ScriptGroup for easyness

--- Code: (Console Input) ---==> new ScriptGroup(masterObj);
==>  new ScriptObject(someChild);
==> masterObj.add(someChild);
==> echo(someChild.getGroup.getName());
masterObj
==> masterObj.listObjects();
    0: ScriptObject - someChild

--- End code ---
Xalos:
Ah, okay. Thanks!
Navigation
Message Index

Go to full version