home *** CD-ROM | disk | FTP | other *** search
- new MessageVector(MsgBoxMessageVector);
- $LastframeTarget = 0;
-
-
- function onChatMessage(%message, %voice, %pitch)
- {
- if (GetWordCount(%message)) {
- ChatBox.AddLine(%message);
- }
- }
- function onServerMessage(%message)
- {
- if (GetWordCount(%message)) {
- ChatBox.AddLine(%message);
- }
- }
-
- function ChatBox::addLine(%this,%text)
- {
- %textHeight = %this.profile.fontSize;
- if (%textHeight <= 0)
- %textHeight = 12;
- %chatScrollHeight = getWord(%this.getGroup().getGroup().extent, 1);
- %chatPosition = getWord(%this.extent, 1) - %chatScrollHeight +
- getWord(%this.position, 1);
- %linesToScroll = mFloor((%chatPosition / %textHeight) + 0.5);
- if (%linesToScroll > 0)
- %origPosition = %this.position;
- while( !chatPageDown.isVisible() && MsgBoxMessageVector.getNumLines() &&
- (MsgBoxMessageVector.getNumLines() >= $pref::frameMessageLogSize))
- {
- %tag = MsgBoxMessageVector.getLineTag(0);
- if(%tag != 0)
- %tag.delete();
- MsgBoxMessageVector.popFrontLine();
- }
- MsgBoxMessageVector.pushBackLine(%text, $LastframeTarget);
- $LastframeTarget = 0;
- if (%linesToScroll > 0)
- {
- chatPageDown.setVisible(true);
- %this.position = %origPosition;
- }
- else
- chatPageDown.setVisible(false);
- }