Hmm, I was working a multiple object arrays and such. When I came across a problem. Using add to add objects to and array when they are returned from a function. Is there a problem here? It's worked before. :[
SERIALIZE FUNCTION
PHP Code:
public function deserialize(string, vars) {
temp.list = 0;
temp.sObj = 0;
temp.array = 0;
temp.i = 0;
array = string.tokenize(":");
list = Mud.(@ vars);
for (i = 0; i < list.size(); i++) {
makevar("sObj." @ list[i]) = array[i];
}
return makevar("sObj");
}
Returns the vars and the values perfectly when using echo and any var of sObj. However (and I have tried it without the makevar()), when I try to add it through array add in a function inside a different script....
PHP Code:
public function createObjects() {
join("serialize");
temp.file = 0;
temp.a = 0;
temp.b = 0;
temp.c = 0;
temp.obj = 0;
temp.obj2 = 0;
temp.var = 0;
temp.var2 = 0;
temp.var3 = 0;
plyr = findPlayer(this.account);
obj = makevar("MudPlayer_" @ this.account);
obj.abilitylist.clear();
obj.spelllist.clear();
obj.skilllist.clear();
//Abilities
for (a = 0; a < obj.abilities.size(); a++) {
file.loadVars("mud/" @ obj.abilities[a] @ ".arc");
obj2 = NULL;
obj2 = new TStaticVar();
for (var : file.getDynamicVarNames()) {
makevar("obj2." @ var) = makevar("file." @ var);
}
obj.abilitylist.add(makevar("obj2"));
obj.abilitylist[a].join("mud_object_ability");
obj.abilitylist[a].effectlist.clear();
for (var2 : obj.abilitylist[a].effects) {
obj.abilitylist[a].effectlist.add(deserialize(var2[1], "effectvars"));
echo (obj.abilitylist[a].effectlist[a].magnitude);
obj.abilitylist[a].effectlist[a].join("mud_object_effect");
}
}
}
Does not add the object to the array and no vars are returned or vals. :[