wesnoth.message colours?

Discussion of Lua and LuaWML support, development, and ideas.

Moderators: Forum Moderators, Developers

Post Reply
Choicerer
Posts: 238
Joined: April 29th, 2017, 11:37 pm

wesnoth.message colours?

Post by Choicerer » February 20th, 2018, 8:47 pm

I know you can make it so a wesnoth.message looks like it's sent by a player in-game, but would it be possible to change the colour to something else than white, too? Either through lua or wesnoth (I'm not very good at lua, so I don't know)

User avatar
Ravana
Moderator
Posts: 1887
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: wesnoth.message colours?

Post by Ravana » February 20th, 2018, 9:10 pm

I looked relevant source code, and this can only be possible by defining new color(after 9) and using that as side. Though not sure if you can specify side who is saying that even.

Choicerer
Posts: 238
Joined: April 29th, 2017, 11:37 pm

Re: wesnoth.message colours?

Post by Choicerer » February 20th, 2018, 9:30 pm

Thanks. That's what I'm after, showing a chat message with a certain side colour, but it doesn't seem to be possible? I guess the Pango markup formatting codes you can use for [message] tags etc wouldn't work, since this is lua text?

User avatar
Celtic_Minstrel
Developer
Posts: 1277
Joined: August 3rd, 2012, 11:26 pm
Contact:

Re: wesnoth.message colours?

Post by Celtic_Minstrel » February 27th, 2018, 1:30 am

Pango formatting almost certainly won't work, but it has nothing to do with Lua. In-game chat is one of the few places still using the old text rendering engine, which doesn't know anything about Pango. I suppose there's a chance that the old-style formatting codes could work, but I wouldn't count on it,

I think what Ravana meant is that you could create a hidden side, assign it the colour you want, and instruct the message() call to pretend the message came from that side. I'm not sure if that actually works though.
Author of The Black Cross of Aleron campaign and Default++ era.
Maintainer of Steelhive.

Choicerer
Posts: 238
Joined: April 29th, 2017, 11:37 pm

Re: wesnoth.message colours?

Post by Choicerer » February 28th, 2018, 12:16 pm

Celtic_Minstrel wrote:
February 27th, 2018, 1:30 am
Pango formatting almost certainly won't work, but it has nothing to do with Lua. In-game chat is one of the few places still using the old text rendering engine, which doesn't know anything about Pango. I suppose there's a chance that the old-style formatting codes could work, but I wouldn't count on it,
Old style formatting code?
Celtic_Minstrel wrote:
February 27th, 2018, 1:30 am
I think what Ravana meant is that you could create a hidden side, assign it the colour you want, and instruct the message() call to pretend the message came from that side. I'm not sure if that actually works though.
Yeah, but how could I instruct the message() call?

User avatar
Celtic_Minstrel
Developer
Posts: 1277
Joined: August 3rd, 2012, 11:26 pm
Contact:

Re: wesnoth.message colours?

Post by Celtic_Minstrel » March 1st, 2018, 3:16 am

That's what I'm not sure about since I haven't looked up what parameters it takes on the wiki.

About old-style formatting codes, it was something used in older versions of the game, before Pango formatting was a thing. It involved putting certain special characters at the start of your string. I don't recall what characters were used though, and the chances it'll actually still work even in chat in 1.13 are pretty slim (it definitely wouldn't work anywhere else).
Author of The Black Cross of Aleron campaign and Default++ era.
Maintainer of Steelhive.

Choicerer
Posts: 238
Joined: April 29th, 2017, 11:37 pm

Re: wesnoth.message colours?

Post by Choicerer » March 1st, 2018, 1:00 pm

Oh, you haven't? Well, I, obviously, did so I know there is no such parameter to supply it with. Oh well. Ravana said the mod this would be for passes the Turing test anyhow, so I suppose it's not that bad.

Post Reply