[Mod] Chat2 [0.1.0] [chat2]

Post Reply
User avatar
lag01
Member
Posts: 321
Joined: Sun Mar 16, 2014 03:41
GitHub: AndrejIT
IRC: lag01
In-game: lag
Contact:

[Mod] Chat2 [0.1.0] [chat2]

by lag01 » Post

This mod is meant to solve problem when game chat is too intensive - players logging in/out, speaking among themselves, system messages etc. and it is hard to follow messages addressed to you.
Modes:
  • default: show you messages in different colors, when someone mention your name or PM you, also nearby chat or shouts(!).
  • "/chat2 *": show also regular messages, so it can be used instead of default chat (close default game chat by pressing F2)
  • Can turn on/off by writing command "/chat2"
License: LGPL 2.1 or later.
Dependencies: chat_anticurse? (my other mod, but should work without it too)

Download: zip
Browse on: GitHub

User avatar
rubenwardy
Moderator
Posts: 6972
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

Re: [Mod] Chat2 [0.1.0] [chat2]

by rubenwardy » Post

A few tips

Code: Select all

function chat2.add_message(player, new_text, new_color)
Is the same as

Code: Select all

chat2.add_message = function(player, new_text, new_color)
With

Code: Select all

if something == nil then
You can use

Code: Select all

if not something then
Providing 'something' isn't a boolean.

Coloured chat is going to be added soon™ to the Minetest core, just as a warning.
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

User avatar
lag01
Member
Posts: 321
Joined: Sun Mar 16, 2014 03:41
GitHub: AndrejIT
IRC: lag01
In-game: lag
Contact:

Re: [Mod] Chat2 [0.1.0] [chat2]

by lag01 » Post

rubenwardy wrote:A few tips
...

Code: Select all

function chat2.add_message(player, new_text, new_color)
...

Code: Select all

if not something then
...
Thanks, i will try to remember that next time!
rubenwardy wrote:Coloured chat is going to be added soon™ to the Minetest core, just as a warning.
Oh, that would be nice, especially with good api. Meanwhile, we can test colored chat in real world environment using mods like this one :)

amadin
Member
Posts: 549
Joined: Tue Jun 16, 2015 16:23

Re: [Mod] Chat2 [0.1.0] [chat2]

by amadin » Post

Does it is bug? Chat2 cuts long sentences whith message <invalid multibyte string>.
Image

User avatar
Krock
Developer
Posts: 4649
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: [Mod] Chat2 [0.1.0] [chat2]

by Krock » Post

amadin wrote:Does it is bug? Chat2 cuts long sentences whith message <invalid multibyte string>.
http://s18.postimg.org/qi3ihk61l/image.jpg
That's a Minetest core issue. It looks like the character conversion failed there.
What you can do is: check for a newer client version and/or report this as an issue on GitHub.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
lag01
Member
Posts: 321
Joined: Sun Mar 16, 2014 03:41
GitHub: AndrejIT
IRC: lag01
In-game: lag
Contact:

Re: [Mod] Chat2 [0.1.0] [chat2]

by lag01 » Post

problem is because i use wrong function string.sub() to split utf8 string, and it sometimes split some utf8 letters in half, resulting in this error.
later will think of solution...

User avatar
lag01
Member
Posts: 321
Joined: Sun Mar 16, 2014 03:41
GitHub: AndrejIT
IRC: lag01
In-game: lag
Contact:

Re: [Mod] Chat2 [0.1.0] [chat2]

by lag01 » Post

I tried to write custom splitting code, but <invalid multibyte string> still occurs sometimes. So need future testing...

amadin
Member
Posts: 549
Joined: Tue Jun 16, 2015 16:23

Re: [Mod] Chat2 [0.1.0] [chat2]

by amadin » Post

Do you can turn off case sensitive of nicknames in chat and chat commands by your mod? If not, maybe you know how to do it to me?

User avatar
lag01
Member
Posts: 321
Joined: Sun Mar 16, 2014 03:41
GitHub: AndrejIT
IRC: lag01
In-game: lag
Contact:

Re: [Mod] Chat2 [0.1.0] [chat2]

by lag01 » Post

amadin wrote:Do you can turn off case sensitive of nicknames in chat and chat commands by your mod? If not, maybe you know how to do it to me?
Here, in attachment. I changed two lines, so your nick and search words are searched case insensitive. It applies to all players, so i am not sure if it is ok as default.

Please report to me, if <invalid multibyte string> still happens.
Attachments
chat2.zip
with case insensitive nick and search words.
(12.91 KiB) Downloaded 117 times

amadin
Member
Posts: 549
Joined: Tue Jun 16, 2015 16:23

Re: [Mod] Chat2 [0.1.0] [chat2]

by amadin » Post

lag01 wrote:
amadin wrote:Do you can turn off case sensitive of nicknames in chat and chat commands by your mod? If not, maybe you know how to do it to me?
Here, in attachment. I changed two lines, so your nick and search words are searched case insensitive. It applies to all players, so i am not sure if it is ok as default.

Please report to me, if <invalid multibyte string> still happens.
Nothing changed - i still can use only case sensitive nicknames and and i still see error <invalid multibyte string>.

amadin
Member
Posts: 549
Joined: Tue Jun 16, 2015 16:23

Re: [Mod] Chat2 [0.1.0] [chat2]

by amadin » Post

I propose to introduce an alternative to the command / msg - the command / m (for speed type) and / n (near) for messages to players near me (do non write in public chat). I do not know whether or not it is feasible, but would like to input box ("T") remembers the previous chat command as the linux console, because f10 is far and it closes (covers) half of screen.

User avatar
Samson1
Member
Posts: 95
Joined: Wed Apr 01, 2015 19:41
GitHub: MoJo4000
IRC: Samson1
In-game: Samson1

Re: [Mod] Chat2 [0.1.0] [chat2]

by Samson1 » Post

Are there colours for Admins? Server owners?

User avatar
kaadmy
Member
Posts: 706
Joined: Thu Aug 27, 2015 23:07
GitHub: kaadmy
IRC: KaadmY
In-game: KaadmY kaadmy NeD

Re: [Mod] Chat2 [0.1.0] [chat2]

by kaadmy » Post

How would you figure out who's a moderator/admin? Currently admins/mods just have different privs, all of which any player can have. Maybe have a builtin list of moderators?
Never paint white stripes on roads near Zebra crossings.

Pixture

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

Re: [Mod] Chat2 [0.1.0] [chat2]

by orwell » Post

kaadmy wrote:How would you figure out who's a moderator/admin? Currently admins/mods just have different privs, all of which any player can have. Maybe have a builtin list of moderators?
Why not add a privilege (e.g. "moderator") to identify moderators? Maybe add more privs like this and make colors configurable in your mod. This wouldn't need a server restart when adding a new moderator.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

User avatar
rubenwardy
Moderator
Posts: 6972
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

Re: [Mod] Chat2 [0.1.0] [chat2]

by rubenwardy » Post

Whilst that's an abuse of the privilege system (it's meant to grant players the ability to do something, not to rank and list users) it'll be the quickest way to do it.
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

Re: [Mod] Chat2 [0.1.0] [chat2]

by orwell » Post

rubenwardy wrote:Whilst that's an abuse of the privilege system ...
Maybe it is not the purpose of the privilege system, but if you have not too many different ranks, it's just right.
BTW, being a moderator actually IS a privilege.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

Re: [Mod] Chat2 [0.1.0] [chat2]

by orwell » Post

Just uploaded that mod. It's not that much code. You could use the idea (or even the code, then include the copyright notice in license.txt).
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

User avatar
Wuzzy
Member
Posts: 4786
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Re: [Mod] Chat2 [0.1.0] [chat2]

by Wuzzy » Post

Note: Minetest now allows to color the chat natively. So the main reason for duplicating the chat is gone, now you can colorize the chat directly by using `core.colorize`.
So I think this mod should be re-done so it does not need a laggy HUD element anymore.

Post Reply

Who is online

Users browsing this forum: No registered users and 26 guests