View Single Post
  #1  
Old 07-05-2007, 07:49 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Problems with message system

Hello 'o great scripting community.

I haven't scripted for a while, and I'm starting again. I am having trouble with this message system, and it is very odd--noone can seem to find any bug in it.

PHP Code:
//#CLIENTSIDE
function onCreated()
{
  
this.color_staff = "#FF3333";
  
this.color_global = "#FFFFFF";
  
this.color_battleground = "#3300FF";
  
this.color_team = "#00FF00";
  
this.color_pm = "#FFFF00";
  
client.messages.clear();
  
client.messages.add( { "Welcome to" SPC servername @ "," SPC player.nick @ "!", "global" } );
  
sleep( .11 );
  
setTimer( 0.05 );
}
function 
onTimeOut()
{
  if ( 
this.textArray.size() > 15 )
  {
    
this.textArray.delete( 0 );
  }
  if ( 
client.messages.size() > 0 )
  {
    for ( 
i = 0; i < client.messages.size(); i ++ )
    {
      
a = client.messages[i];
      
this.textArray.add( "<font color=\"" @ this.( "color_" @ a[1] ) @ "\">" @ a[0] @ "</font>" );
    }
    
client.messages.clear();
    for ( 
i: this.textArray )
    {
      if ( 
this.textArray.index( i ) != 0 )
      {
        
nText = interfaceMessages.text @ "\n" @ i;
      }
      else
      {
        
nText = i;
      }
    }
    
interfaceMessages.text = nText;
    
interfaceScroll.scrollto( 0, 10000 );
    
client.messages.clear();
  }
  
setTimer( 0.05 );
} 
The bugs seem to happen once you hit 15 messages, it should delete the oldest--right? No, it deletes them all. Either that, or it doesn't delete any. Really weird ... please help!

Thanks for all the help,
Chris Zakuto
__________________
Reply With Quote