[Mod] Beerchat: Chat rooms, colors and shortcuts [beerchat]

User avatar
Beerholder
Member
 
Posts: 198
Joined: Wed Aug 03, 2016 20:23
GitHub: evrooije
In-game: Beerholder

[Mod] Beerchat: Chat rooms, colors and shortcuts [beerchat]

by Beerholder » Fri Jul 14, 2017 14:11

[Mod] Beerchat [beerchat]

[Mod] Beerchat [beerchat] is a chat mod that supports chat channels/ chat rooms, colored messages, muting players, message sounds and chat shortcuts. It is in use on the Beerarchy server and as it is quite feature rich and has no dependencies on the Beerarchy subgame (or any other mods for that matter), I decided to spin it off just in case other people would like to use it. Full list of features:

  • Support for chat rooms, called channels, in which members can privately chat without flooding the main channel
  • The default chat has been turned into a channel as well, called main. You can leave (and rejoin) the main channel, e.g. when you are not interested or it is too spammy
  • Extremely easy to chat in a channel, just start your message with #your channel name: (in case of spaces in the channel name) or #my_channel (no colon needed if there are no spaces in the name)
  • You can still chat the old way. Just enter your message like you used to do and it will appear in the main chat automatically (no need to prepend with #main or do other difficult things)
  • Channels can be assigned a color so messages in that channel appear in that color. This way you can easily differentiate between main channel chats and private channel chats
  • Distance based chatting, called whispering. Players out of range will not see your message, players in range will see the message in a different color. Ideal to talk to nearby people and to differentiate messages
  • Provides shortcuts: @ for PMs, # for chat room messages and $ to whisper
  • Remembers the last player or last channel a message was sent to. So at first you can @player or #my_channel and after that just use @ or # only to send to that player/ channel again. Ability to switch channels so normal messages will be sent there
  • Uses the console/ standard chat "window" for chat messages
  • Message formats fully configurable (currently in the init.lua but really easy to do, all settings are in the top of the file and documented). You can pass parameters to the message strings as well. So if you want to strip the channel name from the main channel you can do so. You can shuffle elements around e.g. placing the channel name at the end of a message. You can add a time. You can put from_player and to_player in all messages or just a few
  • Sound notifications for private and channel messages
  • State is stored in mod storage and player attributes so they survive a server restart. E.g. channels you have created and joined will still be there after server restart. Players you have muted will also survive a server restart.
+ Screenshots

Source code: https://github.com/evrooije/beerchat
Download: https://github.com/evrooije/beerchat/archive/master.zip
Depends: none
Requires Minetest 0.4.16 because of mod storage and player attributes support in the mod
Attribution: Some code used from orwell's atchat: viewtopic.php?f=11&t=13593 and of course the other chat mods for their inspiration

+ Future plans

Using the Mod In-Game

Channel Management
Channels are like chat rooms. Messages in channels are only sent to the members of that channel. They can be made private by password protecting it and a color to differentiate from the main chat. Channel management is done via chat commands. Parameters to these commands are comma separated. To create a channel, use the /create_channel or /cc command and supply channel name, optional password and optional color (defaults to white). Channels can be deleted via /delete_channel or /dc and this can only be done by the channel owner. The owner does not need to supply the channel's password to delete the channel. The /my_channels or /mc command shows the channels you are owner/ member of in json format. Some channel management examples below:

Code: Select all
/create_channel my super secret room,mysecretpass01,#00ffff
/create_channel my public room
/create_channel my red colored room without password,,#ff0000
/delete_channel my super secret room

To join a channel use the /join_channel or /jc command which takes the channel name and optionally a password. To leave a channel do /leave_channel or /lc and supply the channel name. If you are the owner of a channel, you can send an invite to a player using the /invite_channel or /ic command which will then send the channel name and password to the invited player.

Code: Select all
/jc someone else's channel,pass01
/lc channel i got bored with
/ic my private room,NicePlayer01


Channel Chats
When you chat normally, everything is written to the channel called main. Chats to main are prefixed with |#main| and given the default main channel color white. In order to write to a specific channel you have joined, start your chat with a #, then the channel name and then a colon. Messages sent this way will only be seen by the other members of the channel (unless someone has muted the sender, see also muting below). If you want to send another message to the same channel you can start it with just the # (without channel name). To switch to a channel in order to send messages to that channel without specifying the channel name, you can use #channel_name:

Code: Select all
#my channel: This will be sent to my channel
# This will also be sent to my channel as that was the last one used
#jokes In this case a colon is not needed as there is no space in the channel name
# This message will also be sent to the jokes channel
#peace_and_quiet
This normal message will now not be sent to main, but to the peace_and_quiet channel instead. No need to put a hash in front of your message
#main
Switched back to the main chat channel

These "hash chats" are prefixed with |#channel name| and appear in the color of that particular channel as specified during channel creation (or default white if no color was supplied at that time).

NOTE: You can leave the main channel! So if things are getting spammy, besides muting people (see below) you can leave the main channel and just chat in the other channels you are a member of.

Muting Players
To mute a player, just do /mute or /ignore player name. Unmuting is done via /unmute or /unignore player name. E.g.:

Code: Select all
/mute Griefer666
/unmute NicePlayerAfterAll


Private Messages
You can send private messages the old way using /msg but there is now a shorthand as well using the @ sign (like the at chat mod, code was inspired by this mod). To at chat a PM, just supply the user name or comma separated names you want to send the PM to. If you start the message with just @ without supplying player names, it will send the message to the last user(s) you sent a PM to, e.g.:

Code: Select all
@JohnDoe How's life?
@JohnDoe,MaryJane Shall we have a party at spawn >8-)))
@ Hey John, Mary, I will be at spawn in 5 minutes ok?


Whispering
You can whisper by starting your message with the $ sign. Only players within a range of 32 blocks will then be able to see your chat (which happens to be the same maximum range of seeing other players). The dollar chat will be sent to the main channel in a grey color. If you want to dollar chat with a larger or shorter range, you can supply the radius straight after the dollar. The maximum radius is (for now) 200 blocks (or you might just start using normal chat or use channels if you don't want others to hear you). Whispering is just there so that when used, chats from nearby players are colored differently (light grey) and can be more easily distinguished from the chat of players further away. The below dollar chats whisper the message to 16, 32 and 64 nodes respectively.

Code: Select all
$16 Can you hear me major Tom
$ Can you hear me now, major Tom?
$64 Can you heeeeeeeeeere I am floating round my tin can


Mod Settings, Configuration and Customization
+ Configuration

+ Customizing the Message Formats


About the Code
Be warned, the code is not pretty and even though it was refactored after spinning it off from the beerarchy subgame, it may need quite some more refactoring. And it would be nicer if it actually supplied an API, but oh well it was hacked together in 2-3 days. Also, it requires Minetest 0.4.16 as it uses both mod storage and player attributes to keep track of the channels and muted players. Otherwise, the code *should* work pretty much out of the box and I have not run into major issues yet on the Beerarchy server where it is actually running. However be careful when running this mod together with other chat mods, as they could very likely interfere with each other. Have fun and let me know in case of issues!
Attachments
beerchat2.png
(381.3 KiB) Not downloaded yet
beerchat1.png
(435.9 KiB) Not downloaded yet
Last edited by Beerholder on Sun Jul 23, 2017 22:51, edited 2 times in total.
 

User avatar
maikerumine
Member
 
Posts: 1345
Joined: Mon Aug 04, 2014 14:27
GitHub: maikerumine
In-game: maikerumine
 

User avatar
azekill_DIABLO
Member
 
Posts: 7459
Joined: Wed Oct 29, 2014 20:05
Location: OMICRON
GitHub: azekillDIABLO
In-game: azekill_DIABLO
 

User avatar
Beerholder
Member
 
Posts: 198
Joined: Wed Aug 03, 2016 20:23
GitHub: evrooije
In-game: Beerholder

Re: [Mod] Beerchat [beerchat]

by Beerholder » Sun Jul 16, 2017 10:21

azekill_DIABLO wrote:Perfectly done!

Well not that quite perfectly (hence in WIP I guess ;) just found a bug on Beerarchy where using the @ history caused a crash. Just patched it now in master so just git pull or redownload and it should be fixed!
 

User avatar
azekill_DIABLO
Member
 
Posts: 7459
Joined: Wed Oct 29, 2014 20:05
Location: OMICRON
GitHub: azekillDIABLO
In-game: azekill_DIABLO

Re: [Mod] Beerchat [beerchat]

by azekill_DIABLO » Sun Jul 16, 2017 10:38

Beerholder wrote:
azekill_DIABLO wrote:Perfectly done!

Well not that quite perfectly (hence in WIP I guess ;) just found a bug on Beerarchy where using the @ history caused a crash. Just patched it now in master so just git pull or redownload and it should be fixed!

Cool thing, dude. I'd like to have my own server. It would be the first mod i'd put on it!
 

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

User avatar
Beerholder
Member
 
Posts: 198
Joined: Wed Aug 03, 2016 20:23
GitHub: evrooije
In-game: Beerholder

Re: [Mod] Beerchat: Chat rooms, colors and shortcuts [beerch

by Beerholder » Sun Jul 16, 2017 14:57

rubenwardy wrote:Awesome! How well does this integrate with the IRC mod?

Not at the moment but I can definitely have a look at it and see if that is possible :)
 

User avatar
Beerholder
Member
 
Posts: 198
Joined: Wed Aug 03, 2016 20:23
GitHub: evrooije
In-game: Beerholder

Re: [Mod] Beerchat: Chat rooms, colors and shortcuts [beerch

by Beerholder » Sun Jul 23, 2017 23:03

Update 2017-07-04
Added the ability to switch channels by just supplying #channel_name. You can now do this:

Code: Select all
#my_channel
This message (without the hash prefix) will be sent to my_channel
No need to do #my_channel message or # message
#main
We now switched back to the main channel

Assuming you named your main channel main. Also fixed one small bug (typo in variable name) and a typo in one of the strings.
 

User avatar
ThomasMonroe
Member
 
Posts: 278
Joined: Tue Apr 04, 2017 16:21
Location: Wherever I am at
GitHub: ThomasMonroe314
IRC: ThomasMonroe TMcSquared
In-game: ThomasMonroe TMcSquared

Re: [Mod] Beerchat: Chat rooms, colors and shortcuts [beerch

by ThomasMonroe » Wed Jul 26, 2017 20:17

I hope you get this to work with the IRC Mod cause that would be awesome.
Projects|:*sigh* school: :Qub³d: :Legends Of Survival: :making people think:
I don't make things messy, I just *cough* disturb the local entropy.
 


Return to WIP Mods



Who is online

Users browsing this forum: Gibeinumo, Google [Bot] and 2 guests