Jump to content
Smart Games

Structured text on UI

Recommended Posts

Hello, i want to use a structured text to display a message on a UI. 

But the attributes color, valign, shadowColor don`t change!

 

If you find my mistake, i`d be really happy.

 

UI Class:

class Notification
{
  idd= 55000;
  duration = 5;
  onLoad= "uiNamespace setVariable ['MMF_Notification', _this #0]";

    controls[]=
    {
        MyNotification
    };

    class MyNotification: RscStructuredText
    {
      	idc = 1;
    };
};

 

Function to call and set it:

disableSerialization;
params
[
  ["_text", ""],
  ["_position", [0,0,0.2,0.1]],
  ["_bgColor", [0,0,0,1]],
  ["_size", "1"],
  ["_font", "PuristaMedium"],
  ["_color", "#FFFFFF"],
  ["_align", "right"],
  ["_valign", "middle"],
  ["_imagePath", ""],
  ["_shadow", "0"],
  ["_shadowColor", "#000000"],
  ["_shadowOffset", "0.5"],
  ["_underline", "0"]
];
titleRsc ["Notification","PLAIN"];

private _parent = uiNamespace getVariable "MMF_Notification";
private _ctrl = _parent displayCtrl 1;

_ctrl ctrlSetPosition _position;
_ctrl ctrlCommit 0;
_ctrl ctrlSetBackgroundColor _bgColor;

_ctrl ctrlSetStructuredText parseText format
[
"
  <t size=%2 font=%3 color=%4 align=%5 valign=%6 shadow=%7 shadowColor=%8 shadowOffset=%9 underline=%10 image=%11>
    %1 </br>
  </t>
",
_text,
_size,
_font,
_color,
_align,
_valign,
_shadow,
_shadowColor,
_shadowOffset,
_underline,
_imagePath
];

 

Any Ideas?

 

Thanks in advance,

Jacob

  • Like 1

Share this post


Link to post
Share on other sites
<t size='%2' font='%3' color='%4' align='%5' valign='%6' shadow='%7' shadowColor='%8' shadowOffset='%9' underline='%10' image='%11'>

Your attribute values should be in quotes.

StructuredText

Quote

All attribute values should be encapsulated in double "..." or single '...' quotes.

 

  • Like 3

Share this post


Link to post
Share on other sites
13 hours ago, Larrow said:

Your attribute values should be in quotes.

You`re an angle, @Larrow!

Looks like you mostly have to help me out with these simple mistakes.

 

But one more thing.

-> I can`t get valign to work. The Syntax should be right now. Is there some sort of bug with this command?

 

Thanks,

Jacob

Share this post


Link to post
Share on other sites
On 11/25/2020 at 4:34 PM, Smart Games said:

I can`t get valign to work

See notes on the examples on the ctrlSetStructuredText wiki page.

  • Like 2

Share this post


Link to post
Share on other sites

Just a question if you please. I remarked that the look (rendering) of an HUD display I made, is different for the mission test when player with description.ext or played with an addon (config.cpp). The classes are the same, even the reference to rscText and rscPicture  (the only two standard classes I used), and the values are same (type, shadow,...x,y,w,h) . Running by mod config.cpp instead of scenario description.ext, the (same) fonts are rendering smaller and the background  boxes slightly higher.

 

Any idea about this difference?

  • Like 2

Share this post


Link to post
Share on other sites
13 hours ago, pierremgi said:

Any idea about this difference?

That is weird. Cannot say I have ever noticed that, and I also have several UIs that I have converted from description.ext to addons.

Possible control value change in a BI pbo? :shrug: as in you need to specify a requiredAddon where the change happens?

Although this is unlikely to account for the change in position.

Share this post


Link to post
Share on other sites

@Larrow    Thanks for your answer. I'm digging deeper. Positions are OK. One extra thing I noticed is:  the text shadow is OK for the rscText from config.cpp and not for description.ext. I didn't specified a requiredAddon ... and I know I could play with rscStructuredText instead of rscText but that doesn't explain this weird difference.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×