Page 1 of 1

Chat Processor

Posted: Mon Aug 29, 2016 9:54 am
by decompile
Hello Guys,

I think its time that we need an 'chat processor' plugin with an api, so we can modify the chat by our own.
It would be great for ranking plugins, admin chat colors and more.

It should work for every game, which supports SayText2, since thats probably the most used one.

It should probably give other plugins the usage of:

- OnChatMessage
and
- OnChatMessagePost

Would be awesome if this exists.

EDIT:

After googling around, I saw that a new "Chat processor" plugin has been published on sourcemod forums, which is a new & fixed version of an older chat processor.

It supports every SayText2 game, and allows to easily modify names & messages.

https://forums.alliedmods.net/showthread.php?t=286913

https://github.com/Drixevel/Chat-Processor

Re: Chat Processor

Posted: Mon Aug 29, 2016 10:15 am
by iPlayer
Sounds more like a custom package to me
But overall is a very nice idea, because chat modifying can turn out to be a very nested process with many little things that scripter would need to keep in mind. Having a custom package that handles it will help unify it.

Re: Chat Processor

Posted: Mon Aug 29, 2016 10:54 am
by decompile
Oh ye,

I actually meant custom package, but cause of the forum section name it was still in my mind :P

Re: Chat Processor

Posted: Mon Aug 29, 2016 1:47 pm
by BackRaw
I'm interested in trying out this idea. But I'll need a usage example - I'm not sure, but maybe something like this:

Syntax: Select all

from processors.chat import OnChatMessage

@OnChatMessage(cmd="votemap")
def on_chat_message_votemap(player, args):
if args:
# process args, e.g. directly add the first argument to the voting list if it is a correct map name
else:
# send VoteMap menu to player

# I'm not sure, but is HERE where you would call every OnChatMessagePost(cmd="votemap") function?


# ADMIN is not defined anywhere, it's just a hint of how it *could* work
@OnChatMessage(cmd="setmap", auth=ADMIN)
def on_chat_message_setmap(player, args):
# auth=ADMIN handles checking if the player typing the command is an actual admin
# tho this could be done using TypedSayCommand, but I'm currently not quite sure how

# change the map to the first argument if it is a correct map name
Or more like this:

Syntax: Select all

from processors.chat import OnChatMessage

@OnChatMessage(cmd="votemap")
def on_chat_message_votemap(player, mapname):
# add the 'mapname' to the voting list
# it is an actual map name because ChatProcessor already figured that out in the background


Please tell me if I'm totally wrong with this or if this is what you would expect the package to do. :D

Re: Chat Processor

Posted: Mon Aug 29, 2016 3:10 pm
by Doldol
SayFilter and SayCommand?

While having read viewtopic.php?f=20&t=1138

Why is an additional library needed?

Re: Chat Processor

Posted: Mon Aug 29, 2016 3:18 pm
by decompile
You guys probably understood it wrong. The main thing of the plugin would be the modification of a "player chat message".

A example code from the sourcemod version is that you can use:

Code: Select all

public Action OnChatMessage(int& author, Handle recipients, eChatFlags& flag, char[] name, char[] message, bool& bProcessColors, bool& bRemoveColors)
{
   Format(name, MAXLENGTH_NAME, "{red}%s", name);
   Format(message, MAXLENGTH_MESSAGE, "{blue}%s", message);
   return Plugin_Changed;
}

public void OnChatMessagePost(int author, Handle recipients, eChatFlags flag, const char[] name, const char[] message, bool bProcessColors, bool bRemoveColors)
{
   PrintToServer("[TEST] %s: %s [%b/%b]", name, message, bProcessColors, bRemoveColors);
}


as an example

EDIT:

first of all, it would support all games (You can see I want to use this for CS:S & CS:GO, but both versions use different message things like protobuf etc) and i rather want to have a custom package for this. (API)

Re: Chat Processor

Posted: Mon Aug 29, 2016 3:54 pm
by iPlayer
I'd rather make it so the callback function would return the new message or a tuple defining a new message (cause as far as I remember, message can be defined in both message name and one of the params).

Re: Chat Processor

Posted: Thu Sep 08, 2016 6:24 pm
by BackRaw
iPlayer wrote:I'd rather make it so the callback function would return the new message or a tuple defining a new message (cause as far as I remember, message can be defined in both message name and one of the params).

Let's compete :D haha