class IRC_Page extends UT2K3TabPanel abstract; var moEditBox TextEntry; var GUIScrollTextBox TextDisplay; var localized string HasLeftText; var localized string HasJoinedText; var localized string WasKickedByText; var localized string NowKnownAsText; var localized string QuitText; var localized string SetsModeText; var localized string NewTopicText; var config int MaxChatScrollback; var config int InputHistorySize; var transient array InputHistory; var transient int InputHistoryPos; var transient bool bDoneInputScroll; var config color IRCTextColor; var config color IRCNickColor; var config color IRCActionColor; var config color IRCInfoColor; var config color IRCLinkColor; // Pure Virtual function ProcessInput(string Text) { } // When you hit enter in the input box, call the class function bool InternalOnKeyEvent(out byte Key, out byte State, float delta) { local string Input; local int Index; // Only care about key-press events if(State != 1) return false; if( Key == 0x0D ) // ENTER { Input = TextEntry.GetText(); if(Input != "") { // Add string to end of history Index = InputHistory.Length; InputHistory.Insert(Index, 1); InputHistory[Index] = Input; // If history is too long, remove chat from start of history if(InputHistory.Length > InputHistorySize) InputHistory.Remove(0, InputHistory.Length - InputHistorySize); // Once you enter something - reset history position to most recent entry InputHistoryPos = InputHistory.Length - 1; bDoneInputScroll = false; ProcessInput(Input); // Handle whatever you typed TextEntry.SetText(""); // And empty box again. } return true; } else if( Key == 0x26 ) // UP { if( InputHistory.Length > 0 ) // do nothing if no history { TextEntry.SetText( InputHistory[ InputHistoryPos ] ); InputHistoryPos--; if(InputHistoryPos < 0) InputHistoryPos = InputHistory.Length - 1; bDoneInputScroll = true; } return true; } else if( Key == 0x28 ) // DOWN { if( InputHistory.Length > 0 ) { if(!bDoneInputScroll) InputHistoryPos = 0; // Hack so pressing 'down' gives you the oldest input TextEntry.SetText( InputHistory[ InputHistoryPos ] ); InputHistoryPos++; if(InputHistoryPos > InputHistory.Length - 1) InputHistoryPos = 0; bDoneInputScroll = true; } return true; } return false; } function string ColorizeLinks(string InString) { local int i; local string OutString, Character, Word, ColourlessWord; local bool InWord, HaveWord; i=0; while(true) { // Get the next word in the string while( i