View Single Post
  #9  
Old 02-22-2007, 12:40 AM
Kristi Kristi is offline
Bowie's Deciple
Kristi's Avatar
Join Date: Dec 2003
Location: Boston, MA
Posts: 748
Kristi has a spectacular aura aboutKristi has a spectacular aura about
Send a message via AIM to Kristi Send a message via MSN to Kristi
The playerenters function (same as playercreated) does not happen again when you reenter a room with a player youve already met in a gani (apparently). instead, the timeout keeps going. Likewise, leaving the room is destroying the objects, so when you return, there is nothing to reference. This is my solution.

PHP Code:
function onCreated() {
  
onTimeout();
}

function 
createStat(i,stat) {
  
with (findimg(201 i)) {
    
font "Verdana";
    
style "cb";
    
zoom = (stat == "nick") ? 0.7:0.5;
    
layer 1;
    
textshadow true;
    
shadowcolor = {111};
    
shadowoffset = {0.10.1};
    if (
stat == "armor") {
      
red 0;
      
green 0;
      
blue 1;
    }
    
thiso.(stat "img") = this;
  }
}

function 
onTimeOut() {
  
temp.i;
  
temp.stattemp.stats
  
stats = {"nick""hp""armor"};
  
  
0;
  for (
statstats) { 
    if(
this.(stat "img").font != "Verdana"// Does not exist
      
createStat(i,stat);
    
i++;
  }
  
this.nickimg.player.1.5;
  
this.nickimg.player.3.2;
  
this.nickimg.text player.nick;

  
this.hpimg.player.1.5;
  
this.hpimg.player.1;
  
this.hpimg.text "HP: " player.attr[11];
  
temp.colors hpColor(player.attr[11]);
  
this.hpimg.red temp.colors[0];
  
this.hpimg.green temp.colors[1];
  
this.hpimg.blue temp.colors[2];

  
this.armorimg.player.1.5;
  
this.armorimg.player.4;
  
this.armorimg.text "Armor: " player.attr[12];
  
setTimer(0.05);
}

function 
hpColor(pattr) {
  
temp.hp temp.pattr.substring(0temp.pattr.pos("/"));
  if (
temp.hp >= 7) {
    return {
0,1,0,1};
  }
  else if (
temp.hp >= 4) {
    return {
1,1,0,1};
  }
  else {
    return {
1,0,0,1};
  }

__________________

Last edited by Kristi; 02-22-2007 at 12:54 AM..
Reply With Quote