Thread: Clearing Vars
View Single Post
  #1  
Old 03-30-2009, 07:32 PM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
Clearing Vars

I don't understand why these vars are not storing? They're being deleted once I reconnect

PHP Code:
function onCreated() {
  echo(
"Size:" SPC this.getCharacterList());
  
  for (
temp.i = 0; temp.i < 5; temp.i++) {
    
this.onCharacterCreate();
  }

  echo(
"Size:" SPC this.getCharacterList());
}

function 
onCharacterCreate() {
  
temp.charsize = this.getCharacterList().size();
  if (
temp.charsize >= 15) return false;
  
  
temp.char.level = 1;
  
temp.char.exp = int(random(20, 99));
  
temp.char.gender = randomstring("Male", "Female");
  
temp.char.brave = int(random(1, 10));
  
temp.char.faith = int(random(1, 10));
  
temp.char.move = int(random(5, 10));

  
temp.stats = {"str", "dex", "con", "int", "wis", "cha"};
  for (
temp.i: temp.stats) {
    
temp.char.(@ i) = int(random(5, 16));
  }
  
  
temp.char.hpmax = int(random(75, 110));
  
temp.char.mpmax = int(random(75, 110));

  
temp.list = {"Squire", "Knight", "Chemist"};
  
temp.class = randomstring(temp.list);
  
temp.char.classes = temp.list;
  
temp.char.class = temp.class; 
  
temp.char.(@ temp.class).level = 1;
  
temp.char.(@ temp.class).exp = temp.char.exp;
  
temp.char.(@ temp.class).jp = int(random(5, 25));
  
  
temp.buffs = { {"dex", "str", "hpmax"}, //Squire
                 
{"str", "con", "hpmax"}, //Knight
                 
{"int", "wis", "mpmax"} //Chemist
               
};
  for (
temp.i: temp.buffs[temp.list.index(temp.class)]) {
    
temp.char.(@ i) += int(random(5, 15));
  }
  
  
temp.char.hp = temp.char.hpmax;
  
temp.char.mp = temp.char.mpmax;
  
  
this.clientr.("char_" @ (temp.charsize + 1)).copyfrom(temp.char);
  echo(
"Created" SPC temp.charsize + 1);
}

function 
getCharacterList() {
  return 
getstringkeys("this.clientr.char_");
} 
Any suggestions? thanks

[Don't comment on the this.clientr/clientr, that isn't the problem]
Reply With Quote