View Single Post
  #1  
Old 06-16-2007, 02:12 AM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
Objects into Arrays using Add()?

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(stringvars) {
  
temp.list = 0;
  
temp.sObj 0;
  
temp.array = 0;
  
temp.0;
  
  array = 
string.tokenize(":");
  list = 
Mud.(@ vars);

  for (
0< 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.0;
  
temp.0;
  
temp.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 (0obj.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. :[
__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote