Development > Coding

How to color strings in menus

(1/1)

Hoehrer:
I do know that you can color the strings with a function in ufo-file itself.
e.g the white color of the selected-items in buy/research-menu:

--- Code: ---confunc researchselect0  { research_clear *txt_item0  color "1 1 1 1" }
--- End code ---


But is there a method to do this from c-code? Similar to setting the name with

--- Code: ---Cvar_Set("mn_researchitem0",  "New Name" );
--- End code ---



--- Code: ---string txt_item0
{
string "*cvar mn_researchitem0"
pos "50 40"
color "0 .78 0 1"
size "275 16"
click { cmd "research_select 0" }
}
--- End code ---


i mean, i could set this with a code like ...
--- Code: ---color "*cvar mn_researchitem_color0"
--- End code ---

and

--- Code: ---Cvar_Set("mn_researchitem_color0",  "1 0 0 1" );
--- End code ---

...but wouldn't that overwrite the color-permanently? so "researchselect0" doesn't work anymore?

I need this info because i want to color the research-item according to it's status.

I'll test this out as soon as i can, but i could save myself precious time if s/b knows that something like this is possible (and probably done elsewhere already).

Werner

Navigation

[0] Message Index

Go to full version