Usage - Chatcommands
- .set_colour to set the colour of chat sent to the server, you can use either HTML named colours or HTML hexdecimal colour codes.
- .rainbow to generate and send rainbow text
github
Download
can you tell me whats in debug.txt?mini wrote:The mod doesn't work for me. When i use .rainbow my client does show a grey window. And .set_colour is the same but if i use .set_colour the client does show a grey window when i type a message.
Code: Select all
2017-06-17 10:04:08: ERROR[Main]: ModError: Runtime error from mod 'colour_chat' in callback on_sending_message(): /home/nils/.minetest/clientmods/colour_chat/init.lua:67: attempt to call field 'send_chat_message' (a nil value)
Code: Select all
local data = minetest.get_mod_storage()
local dColor = "#00FF00"
local chatSource = function(msg) -- Find out who was talking to us
if string.sub(msg, 1, 1) == "<" then -- Normal messages
local parts = string.split(msg, ">") -- Split it at the closing >
return string.sub(parts[1], 2, string.len(parts[1])) -- Return the first part minus the first character
elseif string.sub(msg, 1, 2) == "* " then -- /me messages
local parts = string.split(msg, " ") -- Split the message before and after the name
return parts[2] -- Return the name (this one is easy)
end
return false -- If nothing else returned, return false
end
minetest.register_chatcommand("setcolor", { -- Assign a colour to chat messages from a specific person
params = "<name> <color>",
description = "Colourize a specified player's chat messages",
func = function(param)
local args = string.split(param, " ") -- Split up the arguments
local setName = "player_" .. args[1] -- The setting name to set
local color = args[2]
if not color then -- If a color was not specified, use the default color.
color = dColor
end
data:set_string(setName, color)
minetest.display_chat_message("Player color set sucessfully!")
end
})
minetest.register_chatcommand("delcolor", {
params = "<name>",
description = "Set a specified player's chat messages to the default colour",
func = function(param)
local setName = "player_" .. param
data:set_string(setName, nil) -- Set the color as blank
minetest.display_chat_message("Player color set sucessfully!")
end
})
minetest.register_chatcommand("listcolors", {
params = "",
description = "List player/colour pairs",
func = function(param)
local list = data:to_table().fields
for key,value in pairs(list) do
if string.sub(key, 1, 7) == "player_" then
key = string.sub(key, 8, string.len(key))
end
minetest.display_chat_message(key .. ", " .. minetest.colorize(value, value))
end
end
})
minetest.register_on_connect(function()
minetest.register_on_receiving_chat_messages(function(message)
local msgPlain = minetest.strip_colors(message)
local source = chatSource(msgPlain)
if not source then -- If the chat was not from a player, return
return
end
local playerSet = "player_" .. source -- The setting name
local color = data:get_string(playerSet) -- Get the desired color
if color == "" then -- If no color, return
return
end
message = minetest.colorize(color, msgPlain)
minetest.display_chat_message(message)
return true
end)
end)
Why should i send you private message, you are not the owner of the csm.Fedora24 wrote:can you PM in color?
That wasn't helpful. I'm talking about /msg in minetest chat with color mod. Don't troll the forumEnrikoo wrote:Why should i send you private message, you are not the owner of the csm.Fedora24 wrote:can you PM in color?
I am not trolling, I asked a serious questionEnrikoo wrote:Fedora24: I don't want to message you in pm i don't try to trolling in forum and it isn't your csm anyway.
You don't need it to do, but i just posted it in this topic that red-001 can look it.Fedora24 wrote:I am not trolling, I asked a serious question
Er wollte fragen, ob es möglich sei, deine privaten Nachrichten im Spiel zu färbenEnrikoo wrote:You don't need it to do, but i just posted it in this topic that red-001 can look it.Fedora24 wrote:I am not trolling, I asked a serious question
Er redet nicht über die clientseitige Mod von Techy5Enrikoo wrote:But i can't talk in chat with Techy5 csm because i didn't pasted it in init LUA.
I can't because i don't use Techy5 csm in Minetest.Fedora24 wrote:can you PM in color?
Users browsing this forum: No registered users and 2 guests