How to get chat to show up in terminal?

User avatar
PolySaken
Member
 
Posts: 270
Joined: Thu Nov 09, 2017 05:18
Location: djelibabi
GitHub: PolySaken-I-Am
In-game: PolySaken

How to get chat to show up in terminal?

by PolySaken » Sat Sep 15, 2018 04:31

I'd like to know how to get the messages entered by players to show up in chat.
I've set debug_log_level to 'verbose' (was 'action') and nothing changed.
If I remember correctly, minetesthosting.com's window thingy showed chat messages. I don't want to have to join the server to read chat, so Is there a way to do this?
 

User avatar
PolySaken
Member
 
Posts: 270
Joined: Thu Nov 09, 2017 05:18
Location: djelibabi
GitHub: PolySaken-I-Am
In-game: PolySaken

Re: How to get chat to show up in terminal?

by PolySaken » Sat Sep 15, 2018 04:41

So I made a mod that just print()s all the messages, but I feel like there is a better way.
 

User avatar
Hybrid Dog
Member
 
Posts: 2671
Joined: Thu Nov 01, 2012 12:46

Re: How to get chat to show up in terminal?

by Hybrid Dog » Tue Sep 25, 2018 17:29

Printing directly what the player writes is dangerous because they can use the ASCII escape character to make all the text in your terminal invisible.
Instead of using print(msg), you can use minetest.log("action", msg).
To remove escape characters: minetest.log("action", msg:gsub(string.char(27), "ESC"))

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪
 


Return to Modding Discussion



Who is online

Users browsing this forum: No registered users and 2 guests