Official Soldat Forums

Server Talk => Scripting Discussions and Help => Topic started by: Szaman on April 18, 2014, 01:55:54 am

Title: Chat - filtering some messages
Post by: Szaman on April 18, 2014, 01:55:54 am
Hi,

This is not a big change and it would be GREAT improvement for Soldat scripting :)

Currently we have commands and chat. Many people accidentaly use chat instead of command and then we can see: /adminlog blabla123 on the chat...

If there was possibility to use something like:
Code: [Select]
function FilterChatMessages(SpeakerID: integer; ChatMsg : string) : boolean;
which should return true when the message should appear on the chat, and false when it shouldn't.
SpeakerID = 0 could be used when the origin of the message is the script and SpeakerID = -1 when this is admin message sent by client (/say ...).

Also it would be useful for implementing private chats (muting for all and then sending msg to the particular player).

Please, add this function in the nearest release.

Best regards,
Szaman.
Title: Re: Chat - filtering some messages
Post by: Bonecrusher on April 18, 2014, 02:45:57 am
Quote
Also it would be useful for implementing private chats (muting for all and then sending msg to the particular player).

/pm id text
Title: Re: Chat - filtering some messages
Post by: Szaman on April 18, 2014, 02:54:07 am
Yeah... that is very simple solution ;)
But I am talking about:
- private chat of all spectators without any prefixes
- private chat in form of:
Code: [Select]
/startpm Bonecrusher
hi
bla bla bla
ok, let's go back to the normal discussion...
/endpm
(all above messages went only to Bonecrusher)

And still... the most important case is to prevent showing commands written in chat...
Title: Re: Chat - filtering some messages
Post by: Akinaro on April 18, 2014, 02:58:37 am
its a bit bad idea, because if you want to say something to all people you need to end private conversation say it and then start pm again. Its nothing hard to write /pm 2 before you say something its less than 1sec

But I like idea of filtering commands, so if player type in normal chat "/"(before text) it should write it as a command, and when you type in command text with no / it should be written as a chat text
Title: Re: Chat - filtering some messages
Post by: Bonecrusher on April 18, 2014, 02:59:58 am
http://forums.soldat.pl/index.php?topic=40160.msg493349#msg493349
Title: Re: Chat - filtering some messages
Post by: Szaman on April 18, 2014, 03:03:50 am
OK, dudes... the idea about private chats was only an additional feature.

The main feature I am talking about is to give the scripter ability to filter messages (in any way he wants to).
Not only built-in filtering: if text starts with / then treat it as command (but it would be useful also :) ).
Title: Re: Chat - filtering some messages
Post by: Bonecrusher on April 18, 2014, 03:08:58 am
I'm almost certain I once saw a script which would change your message depending on the input. It would use black list of words and change it to something else without displaying first message.

Ex. major typing "noob"

message being displayed: 'im such a noob"
Title: Re: Chat - filtering some messages
Post by: Szaman on April 18, 2014, 03:10:33 am
Ok, if it is possible - great :) But how ? ;)
Title: Re: Chat - filtering some messages
Post by: Akinaro on April 18, 2014, 03:10:52 am
Well it would be better if it would be implemented to the game, not in external script. Its basic of the basic. It should be there all the time
Title: Re: Chat - filtering some messages
Post by: Bonecrusher on April 18, 2014, 03:11:50 am
We will have to wait for scripting experts messages.
Title: Re: Chat - filtering some messages
Post by: dominikkk26 on April 18, 2014, 03:42:18 am
This chat is possible to do right now. Do not forget delete(text, .. , ..)

EDIT:
SpeakerID: integer change to byte.
Title: Re: Chat - filtering some messages
Post by: Szaman on April 18, 2014, 03:53:36 am
@dominik: so changing parameter "text" will change the chat message ? And what will happen when you set it to empty string?

@akinaro: +1
Title: Re: Chat - filtering some messages
Post by: kicikici on April 18, 2014, 06:08:48 am
@Szaman, u weren't first peron who proposed this changes. This topic should explain everything: http://forums.soldat.pl/index.php?topic=37394.0
In last 4 years nothing was changed, so I doubt that something will change in nearest future.

Ex. major typing "noob"

message being displayed: 'im such a noob"

It's not possible using vanilia scriptcore abilities.

But I like idea of filtering commands, so if player type in normal chat "/"(before text) it should write it as a command, and when you type in command text with no / it should be written as a chat text

... or be ignored.
Title: Re: Chat - filtering some messages
Post by: Szaman on April 18, 2014, 06:20:34 am
Nice to know that there were such initiatives in the past.

So... does anyone knows why devs don't do anything about that? It's not so hard to implement it... :(
Title: Re: Chat - filtering some messages
Post by: Falcon` on April 18, 2014, 06:42:17 am
I suppose that the easiest API for that would be to make OnPlayerSpeak return boolean, just like On(Player)Command. Or string (new message).
The reason it's not yet implemented is because it requires protocol change which i rather not touch if i don't have to. The thing here is, that every chat message must be confirmed by the server (or rather, send back to client) or otherwise the client will re-send it. This can be noticed if you have high latency or generally crappy connection. The filtered messages would have to add some kind of exception here.
Title: Re: Chat - filtering some messages
Post by: Szaman on April 18, 2014, 07:18:17 am
OK. So add one byte/char on the beggining of the message - if server will send:
Code: [Select]
xThis is the message
then it will be shown to the others and if
Code: [Select]
zThis is the message
then client will ignore it and not display.

And the for example if OnPlayerSpeak returns something that is not an empty string then this returned message will be displayed (sent back with "x" on the begining), if empty string - sent whatever with "z" on the begining (ignored message).

Or does the client verifies the content of the message?
Title: Re: Chat - filtering some messages
Post by: Falcon` on April 18, 2014, 07:42:24 am
Honestly, i have no idea how exactly it's handled. My point was to explain why protocol change is required.
Title: Re: Chat - filtering some messages
Post by: Akinaro on April 18, 2014, 08:48:17 am
But in the "future"(5-10 year :P )we could have simple system that would automatically set player text to command if in front of it is "/"?
Title: Re: Chat - filtering some messages
Post by: Falcon` on April 18, 2014, 09:20:52 am
No. What if you want to tell somebody what the command is? I can already see all the frustration comming from "Gah, i forgot to prefix it with 'insert random prefix here'!"
Title: Re: Chat - filtering some messages
Post by: darDar on April 18, 2014, 09:34:26 am
I press 'shift' + '/' (Numpad) to create /cmd
The best would be if we had a console in my opinion + Shoozzas Chat Mod.

Title: Re: Chat - filtering some messages
Post by: Akinaro on April 18, 2014, 10:51:55 am
No. What if you want to tell somebody what the command is? I can already see all the frustration comming from "Gah, i forgot to prefix it with 'insert random prefix here'!"

I didn't say that it should change text to command if this text contain /, it should change it to command ONLY if / is at the beginning.
Title: Re: Chat - filtering some messages
Post by: Szaman on April 18, 2014, 11:08:05 am
Yeah - if u want to write (show someone) a command on the chat you can use space as prefix...
Title: Re: Chat - filtering some messages
Post by: Falcon` on April 18, 2014, 11:28:38 am
No. What if you want to tell somebody what the command is? I can already see all the frustration comming from "Gah, i forgot to prefix it with 'insert random prefix here'!"

I didn't say that it should change text to command if this text contain /, it should change it to command ONLY if / is at the beginning.
I can already see all the frustration comming from "Gah, i forgot to prefix it with 'insert random prefix here'!"
Read carefully, please.

Yeah - if u want to write (show someone) a command on the chat you can use space as prefix...
As i said, i think that would be confusing. And i don't see any disadvantages of having that only as scriptable option (assuming that OnPlayerSpeak is remade).
Title: Re: Chat - filtering some messages
Post by: Szaman on April 18, 2014, 11:30:21 am
@FalconPL: for me it could be only scriptable option. It doesn't has to be built-in.