wesnoth.message colours?

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

Moderator: Forum Moderators

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

wesnoth.message colours?

Post by Choicerer »

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
Forum Moderator
Posts: 2933
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: wesnoth.message colours?

Post by Ravana »

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 »

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: 2158
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: wesnoth.message colours?

Post by Celtic_Minstrel »

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.
Former maintainer of Steelhive.
Choicerer
Posts: 238
Joined: April 29th, 2017, 11:37 pm

Re: wesnoth.message colours?

Post by Choicerer »

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: 2158
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: wesnoth.message colours?

Post by Celtic_Minstrel »

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.
Former maintainer of Steelhive.
Choicerer
Posts: 238
Joined: April 29th, 2017, 11:37 pm

Re: wesnoth.message colours?

Post by Choicerer »

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