Hi all,
I need a little help with colouring a font string in LUA. Maybe I am just missing the obvious solution right now.
I know how to assign a colour to a complete string, but what I would actually like to achieve in this case is something like:
Ice, Ore, Nividium
Is it possible to assign multiple colours to different parts of a font string?
If not, what would you recommend? Having a table cell for each part of the string or is there a better way?
Thanks a lot for your help.
LUA font colour
Moderators: Scripting / Modding Moderators, Moderators for English X Forum
-
- Posts: 585
- Joined: Thu, 26. Feb 04, 00:08
Having the colour info contained in the single string or the table that contains the formatted string would imply that there would need to be some form of delimiter in the raw string - just like you did with the BB code in your post.
It's early days on my own personal UI code voyage of discovery but I haven't come across anything like that in any of the code in the vanilla game so probably not.
Your idea of using individual cells sounds like the right idea. I guess with a bit of tweaking you could make the cells look like one single cell if you wanted the string to look like a single statement. A bit fiddly but then show me a bit of the UI that is not - lol!
Good luck!
It's early days on my own personal UI code voyage of discovery but I haven't come across anything like that in any of the code in the vanilla game so probably not.
Your idea of using individual cells sounds like the right idea. I guess with a bit of tweaking you could make the cells look like one single cell if you wanted the string to look like a single statement. A bit fiddly but then show me a bit of the UI that is not - lol!
Good luck!

-
- Posts: 1842
- Joined: Tue, 2. Nov 10, 02:20
-
- Posts: 124
- Joined: Sat, 22. Jan 11, 21:13
-
- Posts: 1842
- Joined: Tue, 2. Nov 10, 02:20
There's a new development on this front: v3 beta uses multiple font colors within single cells (at least in the object menu -- menu_object.xpl).
I haven't picked the file apart to see how it's formatted yet, but it's worth checking out and I thought I'd mention it here in case one of you guys want to take a look before I get around to it.
I haven't picked the file apart to see how it's formatted yet, but it's worth checking out and I thought I'd mention it here in case one of you guys want to take a look before I get around to it.
-
- Posts: 124
- Joined: Sat, 22. Jan 11, 21:13
-
- Posts: 585
- Joined: Thu, 26. Feb 04, 00:08
-
- Posts: 1842
- Joined: Tue, 2. Nov 10, 02:20
Welp... NightNord's decomplier can't handle as many of the new lua menus as the old ones, it seems , including the new object menu file. It'll take some more digging to find out how those multi-color strings are being formatted.
So make sure you've got a safe archive of 2.51's xpl files -- there's no way of knowing if or when anyone with Nord's level of comp-sci skill will be interested in advancing the decompiler project in the future, and as opening new files becomes more challenging then solid reference materials will be harder to come by.
So make sure you've got a safe archive of 2.51's xpl files -- there's no way of knowing if or when anyone with Nord's level of comp-sci skill will be interested in advancing the decompiler project in the future, and as opening new files becomes more challenging then solid reference materials will be harder to come by.