Maybe you could use a type for the chat messages:
SeedRnd MilliSecs() Graphics3D 800, 600, 0, 2 SetBuffer BackBuffer() ;----------------------------------------------------------------------------------------------------- ; Globals ;----------------------------------------------------------------------------------------------------- Const textheight = 20;use stringheight Type msg Field s$ Field col End Type Global chatscroll, scroll, scrollmode Global msgbox, msgtex Global msgfont = LoadFont("Arial", 20) ;----------------------------------------------------------------------------------------------------- ; Initialize() ;----------------------------------------------------------------------------------------------------- camera = CreateCamera() PositionEntity camera, 0, 0, -15 InitChat() AddChat("Ready.", $FF0000) Repeat If Rand(60) = 15 Then AddChat(RandomWord$(), $FFFF00) If Rand(60) = 15 Then AddChat(">" + RandomWord$(), $00FF00) UpdateChat() RenderWorld() Flip Until KeyHit(1) End ;----------------------------------------------------------------------------------------------------- ; UpdateChat() ;----------------------------------------------------------------------------------------------------- Function UpdateChat() ClsColor 0, 0, 127 Cls SetFont msgfont tel = 0 For m.msg = Each msg Color 0, 0, m\col Text 0, tel * textheight - scroll, m\s$ tel = tel + 1 If tel = 14 Then Exit Next If scrollmode Then If scroll <= chatscroll Then scroll = scroll + 2;speed If scroll > chatscroll Then scroll = 0 Delete First msg scrollmode = 0 chatscroll = 0 End If Else If chatscroll = 0 Then If tel > 13 Then chatscroll = chatscroll + textheight: scrollmode = 1 End If CopyRect 0, 0, 256, 256, 0, 0, BackBuffer(), TextureBuffer(msgtex) EntityTexture msgbox, msgtex End Function ;----------------------------------------------------------------------------------------------------- ; InitChat() ;----------------------------------------------------------------------------------------------------- Function InitChat() msgtex = CreateTexture(256, 256) msgbox = CreateCube() ScaleEntity msgbox, 4, 3, 0.001 MoveEntity msgbox, -10.8, 8, 0 EntityTexture msgbox, msgtex End Function ;----------------------------------------------------------------------------------------------------- ; AddChat() ;----------------------------------------------------------------------------------------------------- Function AddChat(s$, col) m.msg = New msg m\s$ = s$ m\col = col End Function ;----------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------- Function RandomWord$() d$ = "" For l = 4 To Rand(8) + 4 Restore onm = nm Repeat nm = Rand(15) Until nm <> onm For i = 1 To nm Read c$ Next d$ = d$ + c$ Next d$ = Upper$(Left$(d$, 1)) + Mid$(d$, 2, Len(d$) - 1) Return d$ End Function Data "talk", "house", "freak", "hold", "lamp", "driver", "school", "directors", "broadcast", "show", "dance", "song", "machine", "computer", "sea"