mod to highlight when a player joins or leaves?
mod to highlight when a player joins or leaves?
Is there a mod that will show in highlighted text when a player joins or leaves? I joinded a random MT server earlier and It has that feature. I already look on the forums for a mod but no luck. Any help would be awesome! Thanks!
Screenshot:
Screenshot:
- Attachments
-
- screenshot_20180702_210329.png (116.81 KiB) Viewed 1168 times
Testin' mines since 1989
- AspireMint
- Member
- Posts: 415
- Joined: Mon Jul 09, 2012 12:59
- GitHub: AspireMint
- IRC: AspireMint
- In-game: AspireMint
- Location: Stuck at spawn
Re: mod to highlight when a player joins or leaves?
You can try this powerful csm: https://github.com/doyousketch2/friendly_chat
But might not work correctly on some servers that already has colored chat.
But might not work correctly on some servers that already has colored chat.
- Krock
- Developer
- Posts: 4650
- Joined: Thu Oct 03, 2013 07:48
- GitHub: SmallJoker
- Location: Switzerland
- Contact:
Re: mod to highlight when a player joins or leaves?
That's IhrFussel's server with custom mods which aren't public. I don't know any mod which currently does this, but implementing it yourself is quite easy:
Solution for Minetest 5.0.0-dev or newer: Overwrite minetest.send_join_message in a new mod
Solution for Minetest 0.4.x (hacky): Edit the builtin code
Local solution for Minetest >= 0.4.16: Write or use a CSM that checks whether the chat line has the default join message format and colorize it locally.
Here you can find the documentation of "minetest.colorize", which makes colorizing messages very easy.
Solution for Minetest 5.0.0-dev or newer: Overwrite minetest.send_join_message in a new mod
Solution for Minetest 0.4.x (hacky): Edit the builtin code
Local solution for Minetest >= 0.4.16: Write or use a CSM that checks whether the chat line has the default join message format and colorize it locally.
Here you can find the documentation of "minetest.colorize", which makes colorizing messages very easy.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>
Re: mod to highlight when a player joins or leaves?
Thanks for these answers! I’ll look into them soon.
Testin' mines since 1989
Re: mod to highlight when a player joins or leaves?
But that wouldn't apply for all clients. Just my client. I'm running a server for my family and some of them are on phones so they can't install CSM's.Krock wrote: Local solution for Minetest >= 0.4.16: Write or use a CSM that checks whether the chat line has the default join message format and colorize it locally..
Testin' mines since 1989
- stormchaser3000
- Member
- Posts: 422
- Joined: Sun Oct 06, 2013 21:02
- GitHub: stormchaser3000
Re: mod to highlight when a player joins or leaves?
as far as i know it should be possible to install CSMs on android phones when using the official client. but just to be sure i will do some testing and then edit this postJoseph13 wrote:But that wouldn't apply for all clients. Just my client. I'm running a server for my family and some of them are on phones so they can't install CSM's.Krock wrote: Local solution for Minetest >= 0.4.16: Write or use a CSM that checks whether the chat line has the default join message format and colorize it locally..
Re: mod to highlight when a player joins or leaves?
But they are playing on iOS devices- so as I said CSM’s won’t work. Is there any way to take a CSM mod and put it on the server mods list? Or is that physically impossible?stormchaser3000 wrote:
as far as i know it should be possible to install CSMs on android phones when using the official client. but just to be sure i will do some testing and then edit this post
Testin' mines since 1989
- Krock
- Developer
- Posts: 4650
- Joined: Thu Oct 03, 2013 07:48
- GitHub: SmallJoker
- Location: Switzerland
- Contact:
Re: mod to highlight when a player joins or leaves?
Hence, local solution. Because it only applies to your client.Joseph13 wrote:But that wouldn't apply for all clients. Just my client.Krock wrote:Local solution for Minetest >= 0.4.16
They should update to 0.4.16 or newer to make it work. Sending CSMs by the server is yet not possible (not even in 5.0.0-dev, surprise!), so consider using one of the other solutions by writing a SSM (regular mod).Joseph13 wrote:But they are playing on iOS devices- so as I said CSM’s won’t work. Is there any way to take a CSM mod and put it on the server mods list? Or is that physically impossible?
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>
Re: mod to highlight when a player joins or leaves?
I looked into doing it as a normal mod, tried this:Krock wrote: by writing a SSM (regular mod).
but it gave me an error:
I know I did this completely wrong but is it as simple as this code or is it much harder to make work properly?
- Attachments
-
- Captur1e.PNG1.PNG (107.92 KiB) Viewed 1168 times
-
- Capture.PNG (22.21 KiB) Viewed 1168 times
Testin' mines since 1989
- stormchaser3000
- Member
- Posts: 422
- Joined: Sun Oct 06, 2013 21:02
- GitHub: stormchaser3000
Re: mod to highlight when a player joins or leaves?
ah i see the problem. also i asked on #minetest on freenode and one of the developers said it is not possible to send CSMs to clients from the server yet. i am sorry to say but minetest is no officially supported on IOS because of the licensing restrictions on the apple app store which would prevent minetest from being put on that store because of the license minetest is licensed under (if i understand correctly). the versions of minetest on the IOS appstore are usually not legal because they break the terms of the LGPL 2.1 (which minetest is licensed under) by not releasing their modified versions of the minetest source code. I am not sure if these IOS clients will ever work with CSMs for 1) because of the restrictions placed on IOS users from apple and 2) because these IOS apps are unofficial and might not properly support CSMs anyway. i wish i could be of better help however i would wait a while to see if anyone else who knows more than me could help.Joseph13 wrote:But they are playing on iOS devices- so as I said CSM’s won’t work. Is there any way to take a CSM mod and put it on the server mods list? Or is that physically impossible?stormchaser3000 wrote:
as far as i know it should be possible to install CSMs on android phones when using the official client. but just to be sure i will do some testing and then edit this post
EDIT: previous edit deleted because i should read everything before posting
Re: mod to highlight when a player joins or leaves?
OK. I already knew about the licensing issues on iOS. And even if it ever did get licensed you couldn't access the file system like you can on android.
Testin' mines since 1989
Re: mod to highlight when a player joins or leaves?
I guess the main objective is to make a mod that will act very similar to that of IhrFussel's server. Green text, better join/leave message and maybe the time counter(although not really going for that.)
Maybe the owner of IhrFussel's server could PM me and share the details of the mod(maybe even the code? :) )
Maybe the owner of IhrFussel's server could PM me and share the details of the mod(maybe even the code? :) )
Testin' mines since 1989
- ExeterDad
- Member
- Posts: 1717
- Joined: Sun Jun 01, 2014 20:00
- In-game: ExeterDad
- Location: New Hampshire U.S.A
Re: mod to highlight when a player joins or leaves?
Joseph... player_list is local to the builtin. So you can't see it with another mod. You need to make your own.
Right before the code posted above add:
I'm at work and unable to test... but I bet it will work for you. But.... it won't override the existing builtin function unless you comment the builtin function out.
Right before the code posted above add:
Code: Select all
local player_list = {}
HOMETOWN -Our little server. Keep the HOMETOWN chatter @ http://hometownserver.com - Our server map: http://media.hometownserver.com
Re: mod to highlight when a player joins or leaves?
I’ll try it! Thanks!ExeterDad wrote:Joseph... player_list is local to the builtin. So you can't see it with another mod. You need to make your own.
Right before the code posted above add:I'm at work and unable to test... but I bet it will work for you. But.... it won't override the existing builtin function unless you comment the builtin function out.Code: Select all
local player_list = {}
Testin' mines since 1989
Re: mod to highlight when a player joins or leaves?
I addd that line and it works - but Minetest still puts the old server messages as well. So when I join my sever it looks like:
Joseph joined the game.
Joseph joined the mod.
The second message being the modded one. I need to disable the old one and change the color of the text. Know how to do both?
Joseph joined the game.
Joseph joined the mod.
The second message being the modded one. I need to disable the old one and change the color of the text. Know how to do both?
Testin' mines since 1989
- ExeterDad
- Member
- Posts: 1717
- Joined: Sun Jun 01, 2014 20:00
- In-game: ExeterDad
- Location: New Hampshire U.S.A
Re: mod to highlight when a player joins or leaves?
This is the hacky part mentioned earlier. You have to disable the code in the builtin file. Not the best way because you will lose your modification when you upgrade. But if you must....Joseph13 wrote:I addd that line and it works - but Minetest still puts the old server messages as well. So when I join my sever it looks like:
Joseph joined the game.
Joseph joined the mod.
The second message being the modded one. I need to disable the old one and change the color of the text. Know how to do both?
Edit builtin/game/misc.lua
Find:
Code: Select all
core.register_on_joinplayer(function(player)
local player_name = player:get_player_name()
player_list[player_name] = player
if not minetest.is_singleplayer() then
core.chat_send_all("*** " .. player_name .. " joined the game.")
end
end)
core.register_on_leaveplayer(function(player, timed_out)
local player_name = player:get_player_name()
player_list[player_name] = nil
local announcement = "*** " .. player_name .. " left the game."
if timed_out then
announcement = announcement .. " (timed out)"
end
core.chat_send_all(announcement)
end)
The second one comments out the announcement, and removes the player from the list that's needed in connected players.
Code: Select all
--[[
core.register_on_joinplayer(function(player)
local player_name = player:get_player_name()
player_list[player_name] = player
if not minetest.is_singleplayer() then
core.chat_send_all("*** " .. player_name .. " joined the game.")
end
end)
--]]
core.register_on_leaveplayer(function(player, timed_out)
local player_name = player:get_player_name()
player_list[player_name] = nil
-- local announcement = "*** " .. player_name .. " left the game."
-- if timed_out then
-- announcement = announcement .. " (timed out)"
-- end
-- core.chat_send_all(announcement)
end)
Code: Select all
local player_list = {}
Edited to fix my screw up.
Last edited by ExeterDad on Tue Jul 03, 2018 20:18, edited 2 times in total.
HOMETOWN -Our little server. Keep the HOMETOWN chatter @ http://hometownserver.com - Our server map: http://media.hometownserver.com
Re: mod to highlight when a player joins or leaves?
Now to make the text green..
Testin' mines since 1989
- ExeterDad
- Member
- Posts: 1717
- Joined: Sun Jun 01, 2014 20:00
- In-game: ExeterDad
- Location: New Hampshire U.S.A
Re: mod to highlight when a player joins or leaves?
Wait! Both need not be commented out. I'm editing now.Joseph13 wrote:Tysm!
HOMETOWN -Our little server. Keep the HOMETOWN chatter @ http://hometownserver.com - Our server map: http://media.hometownserver.com
Re: mod to highlight when a player joins or leaves?
But it will still show the “player left” messages won’t it?
Testin' mines since 1989
- ExeterDad
- Member
- Posts: 1717
- Joined: Sun Jun 01, 2014 20:00
- In-game: ExeterDad
- Location: New Hampshire U.S.A
Re: mod to highlight when a player joins or leaves?
No the message part is commented out, but it will still remove their name from the list which must happen.Joseph13 wrote:But it will still show the “player left” messages won’t it?
To change the color to a green, change the needed messages to something like this:
Code: Select all
core.chat_send_all(core.colorize("#2aff00", "*** " .. player_name .. " joined the game100."))
core.chat_send_all(core.colorize("#2aff00", announcement))
In whatever code you posted earlier.
HOMETOWN -Our little server. Keep the HOMETOWN chatter @ http://hometownserver.com - Our server map: http://media.hometownserver.com
Re: mod to highlight when a player joins or leaves?
Alright! So I can make the “join”messages green and the “leave” messages red or grey!
Testin' mines since 1989
- ExeterDad
- Member
- Posts: 1717
- Joined: Sun Jun 01, 2014 20:00
- In-game: ExeterDad
- Location: New Hampshire U.S.A
Re: mod to highlight when a player joins or leaves?
You can change the color to anything. What's used in my example is hex colors.
https://www.w3schools.com/colors/colors_picker.asp
https://www.w3schools.com/colors/colors_picker.asp
HOMETOWN -Our little server. Keep the HOMETOWN chatter @ http://hometownserver.com - Our server map: http://media.hometownserver.com
Who is online
Users browsing this forum: dxt_73, Majestic-12 [Bot] and 22 guests