Quote:
Originally Posted by Chandler
Make sure you're getting the var names
PHP Code:
echo("Vars Found:" SPC getstringkeys("this.mud"));
I was also thinking about the DynamicVars function.
Also, why do people use files for their mudlibs!
DON'T DO IT, IT ISN'T NECESSARY. :[
|
What the hell? ARE YOU EVEN READING WHAT I POSTED
And I use files because objects will be SAVED TO FILE when they're not in use. Like when you logoff. My system is designed as an object-controller, current types are (arch, ench, char, plyr, item, cont) for Archetype, Enchantment, (npc) Character, Player, Item, and Container. The files must be saved when they're not in use.
script from mudobject Class
PHP Code:
public function destroyObject() {
triggerAll("onDestroyObject", null);
echo("Destroyed MudObject: " @ this.mudid);
MudControl.allobjects.delete(MudControl.allobjects.index(this));
destroy();
}
script from mudint_saveable Class
PHP Code:
public function saveObject() {
temp.file = 0;
temp.vars = 0;
temp.i = 0;
file = new TStaticVar();
vars = this.getMudVars(true, true);
//echo("SaveVars: " @ vars);
for (i = 0; i < vars.size(); i ++) {
file.(@ vars[i]) = this.(@ vars[i]);
}
MudControl.saveRefs(file, this);
file.savevars(format("%s/%s/%s.txt", MudControl.mudpath, this.mudtype, this.mudid), 0);
triggerAll("onSavedObject", null);
echo("Saved Object: " @ this.mudid);
file.destroy();
}
public function onDestroyObject_mudint_saveable() {
saveObject();
}
Notice how when an object is (properly) destroyed, it is automatically saved if the object has the Saveable interface.