-
Legendary
[V9.0] [INTERNATIONAL] [RNN] LogChat
Supported TurboHUD version: 9.0
-Features:
.Store in a file (logs\Chat.txt) all the messages received by the Chat. To deactivate it, change SaveChat to false.
.Store in a file (logs\ChatWhisper.txt) all whispers. To disable it, change SaveWhisper to false.
.Notify with a sound (sounds\Whisper.wav) if a whisper has been received.
.Pressing the "/" key of BLoqNum or opening the chat dialog will show the last 20 whispers on the screen
Download: LogChat.cs and Whisper.wav
Installation: Place LogChat.cs in "plugins\RNN\LogChat.cs" , and Whisper.wav in "sounds\Whisper.wav"
Knowns Issues: So far I have only tried it with version 19.03.26.1 of TH. In this version if we receive a repeated message is usually ignored, perhaps due to some flood protection or a bug, but also if we receive a message and then go to the menu or start game, the last message is repeated. If it is a bug of the TH will be corrected in future versions surely, and if it is a problem of my code I will review it these days. This plugin I did to test the new added function, I hope it's useful to someone.
Update: I have decided to also discard the received messages identical to the previous one, to be coherent, but still there are inconsistencies when leaving or entering a game (to/from menu)
Custom code (Plugins\User\PluginEnablerOrDisablerPlugin.cs , it's not mandatory) :
Code:
using System.Windows.Forms; // This line at the beginning of the file, if not exist
//The following lines place in .. public void Customize() { -HERE- }
Hud.GetPlugin<RNN.LogChat>().Enabled = true;
Hud.RunOnPlugin<RNN.LogChat>(plugin =>
{
plugin.xpos = 0.65f; // 0 ... 1
plugin.ypos = 0.45f; // 0 ... 1
plugin.SoundWhisper = true; // Notify if we receive a Whisper, it will be used .. sounds\Whisper.wav
plugin.SaveChat = true; // Save all chat messages, once formatted, to logs\Chat.txt
plugin.SaveWhisper = true; // Save whispers messages, once formatted, to logs\ChatWhisper.txt
plugin.HotKey = Keys.Divide; // Press and hold "/" of BLoqNum to show the last whispers
plugin.WhispMax = 20; // maximum number of whispers that will be displayed on the screen
plugin.ShowWithHotKey = true; // Show Whispers when you keep press HotKey ("/" by default) , true -> enabled and false -> disabled
plugin.ShowWithEditLine = true; // Show Whispers when you open the Chat, true -> enabled and false -> disabled
} );
if you liked the plugin, raise your thumb
Last edited by RNN; 04-05-2019 at 10:38 AM.
Reason: Edited text only
-
Post Thanks / Like - 7 Thanks
-
Active Member
It works with the latest TH version.
I'm just curious why you create a chat/chatWhisper log files when you never use them but just read the dictionary you made in your plugin.
-
Savvy ? 🐒
Originally Posted by
jaeheung09
It works with the latest TH version.
I'm just curious why you create a chat/chatWhisper log files when you never use them but just read the dictionary you made in your plugin.
Hud plugins can log to txt files but not read from them.
So, it's.. well, for logging purpose I guess ;p
-
Contributor
Originally Posted by
jaeheung09
It works with the latest TH version.
I'm just curious why you create a chat/chatWhisper log files when you never use them but just read the dictionary you made in your plugin.
Log files can be very useful as it is the only way to communicate with outer world except reading pixel colors, AFAIK.
For example you can collect statistics or other useful info in separate background "log listener" process and write results back to C# plugin files so when you restart THUD you have updated you state as well
-
Active Member
Originally Posted by
JarJarD3
Log files can be very useful as it is the only way to communicate with outer world except reading pixel colors, AFAIK.
For example you can collect statistics or other useful info in separate background "log listener" process and write results back to C# plugin files so when you restart THUD you have updated you state as well
That's right. Log files can be the only way to to communicate with outer world together with reading pixel colors and key events.
We can make good use of log files created in user plugins.
Last edited by jaeheung09; 03-27-2019 at 04:00 PM.
-
Legendary
The whispers that are shown on the screen are saved in a dictionary, I only keep 20 records, I'm deleting the oldest one as I add a new one, although all could easily be retained by removing a line (until TH is closed)
Well, the logs I did, in part, to be able to consult them later, sometimes you need to know who said what, or what exactly, and at what moment. The general chat is not saved anywhere, and whispers only if you have the open batllenet launcher, or so it was before. I also found it practical to add the exact day and time. Sometimes you give data that you do not want to lose, such as web addresses, and you do not have to write them down. The main reason to create them was to see what I could do: D, I was curious about the text format that was sent, and if I could extract it easily.
Last edited by RNN; 03-27-2019 at 04:04 PM.
-
Legendary
Updated
Comment only useful for plugin developers:
I Change the regular expression to separate the parts of the message. The separator is the character "|" , and this can be followed by H or h. If it is H the text that follows will not be shown to the user, if it is h it will be displayed. You have to take the precaution of not taking as a separator the "|" that the users write, they will be received as "\ |" . Change SaveChatDebug = true for view text received
Last edited by RNN; 03-29-2019 at 10:33 AM.
-
Active Member
Instead remove the hotkey, and make it appear like so; only while chat line is active (another possibility)
Code:
private IUiElement chatentry
{
get { return Hud.Render.GetUiElement("Root.NormalLayer.chatentry_dialog_backgroundScreen.chatentry_content.chat_editline"); }
}
public void PaintWorld(WorldLayer layer)
{
if (!chatentry.Visible) return;
//if (!Hud.Input.IsKeyDown(HotKey)) return;
-
Post Thanks / Like - 1 Thanks
RNN (1 members gave Thanks to iThinkiWin for this useful post)
-
Legendary
Oh Interesting, thank you, it's a good alternative, and even I could leave both options::
Code:
public bool ShowWithHotKey { get; set; }
public bool ShowWithEditLine { get; set; }
private IUiElement chatentry
{
get { return Hud.Render.GetUiElement("Root.NormalLayer.chatentry_dialog_backgroundScreen.chatentry_content.chat_editline"); }
}
public override void Load(IController hud)
{
ShowWithHotKey = true; // Show Whispers when you keep press HotKey ("/" by default) , true -> enabled and false -> disabled
ShowWithEditLine = true; // Show Whispers when you open the Chat, true -> enabled and false -> disabled
.....
}
public void PaintWorld(WorldLayer layer)
{
if ( (!ShowWithEditLine || !chatentry.Visible) && (!ShowWithHotKey || !Hud.Input.IsKeyDown(HotKey))) return;
.....
}
I will include it when I update
-
Post Thanks / Like - 1 Thanks
iThinkiWin (1 members gave Thanks to RNN for this useful post)
-
Legendary
updated, with the changes mentioned before.
-
Member
-
Post Thanks / Like - 1 Thanks
RNN (1 members gave Thanks to FoxPox for this useful post)
-
Legendary
At first glance there seems to be a bug in the latest version of TH and the plugin can not collect any text that appears in the chat (there are no calls to OnChatLineChanged every time the chat text changes). I wrote to KJ to check if this is so. Currently this plugin does not give exceptions but it does not work, I will warn when I do.
Last edited by RNN; 05-13-2019 at 09:30 AM.
-
Legendary
With the current version (19.5.15.2 BETA) the plugint works again
-
Contributor
can this plugin modify to log the encounter / kill elite , rare??
-
Legendary
I made this plugin for general use, I don't want to focus it on specific functions during the game (it would be a subject for another plugin).
Some time ago I considered doing an elite counter using chat messages but there are two problems:
1) You have to find the format / pattern that follows the text and it can be different for each language (regular expressions are useful for this), in addition there is no direct way to find out in TH the language in which the game is configured nor the TH itself.
2) The biggest problem: To improve the readability and management of the text of the chat, TH eliminates the color codes, this makes it difficult to distinguish between elites yellow/blue and the rare .