My maketype function was just to see if I could replicate object instancing like how its built-in.
It would probably be more manageable to do something like:
PHP Code:
temp.file = new TStaticVar();
temp.file.joinedclasses = serverr.classes_inifile;
temp.file.load("stuff");
That should prevent you from having to worry about the base object being uncreated as the time your script runs. It would also allow you to update the class list for a type without going to change the script that creates it.
Also one can define
public function objecttype().
I'd really like if there was a function onJoined() you could define just for classes that would be run the instant the class is joined and before the next class is joined. I'd also like a function onLeaving() that would be run when an object leaves the class; including when the object is destroyed. Graal would wait until onJoin() or onLeave() are completed before continuing();
Example:
PHP Code:
//A random weapon
function onCreated() {
temp.obj = 0;
obj = new TStaticVar();
obj.joinedclasses = {"class1", "class2", "class3"};
// onJoined is called in order starting with first class in list, graal waits while these are finished.
obj.stuff(); // you do your stuff
obj.destroy();
// onLeaving is called starting with class3 and moving to class1 then when they're all complete, the object is destroyed.
}
// onCreated() would be called in the object if it still existed or no sleep() had been used in the above function.
Quote:
Originally Posted by DustyPorViva
Well I plan on going through and making the ini objects manually... I just needed to know how to load data from them. Thanks!
|
I just use loadlines() and parse the lines.
Quote:
Originally Posted by Chompy
And I would suggest you to check out his two mudlibs that he released, it's worth learning from 
|
I don't really like those, too overdone, its better just to have a universal MudObject that has all the features and has a single save file per object.
I currently don't even use an object for each item anymore as arrays are easier to handle, though I may change that if I find a performance difference.