How to get chat to show up in terminal?

Post Reply
User avatar
PolySaken
Member
Posts: 817
Joined: Thu Nov 09, 2017 05:18
GitHub: PolySaken-I-Am
In-game: PolySaken
Location: Wānaka, Aotearoa
Contact:

How to get chat to show up in terminal?

by PolySaken » Post

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?
Guidebook Lib, for in-game docs | Poly Decor, some cool blocks | Vision Lib, an all-purpose library.

User avatar
PolySaken
Member
Posts: 817
Joined: Thu Nov 09, 2017 05:18
GitHub: PolySaken-I-Am
In-game: PolySaken
Location: Wānaka, Aotearoa
Contact:

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

by PolySaken » Post

So I made a mod that just print()s all the messages, but I feel like there is a better way.
Guidebook Lib, for in-game docs | Poly Decor, some cool blocks | Vision Lib, an all-purpose library.

User avatar
Hybrid Dog
Member
Posts: 2835
Joined: Thu Nov 01, 2012 12:46
GitHub: HybridDog

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

by Hybrid Dog » Post

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"))

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

Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests