Quote:
Originally Posted by cbkbud
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.
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!
|
PHP Code:
...
function onTimeOut()
{
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>" );
}
while ( this.textArray.size() > 15 )
{
this.textArray.delete( 0 );
}
// client.messages.clear();
// ^ not needed because you clear it below.
...
}
setTimer( 0.05 );
}
*Note: "..." means I took out some code but didn't change it.
I didn't test it, but I think that should take care of the problem.