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