Jump to content
Robustcolor

hint with linebreak/column

Recommended Posts

Hi, how can i make a array with units showing up as a column/linebreaks with the hint command? This code below shows everything in a line.

_aliveUnits = [];
_aliveUnits pushBack (allUnits select {alive _x});
hint (format ["Remaining units %1", _aliveUnits]);

 

Share this post


Link to post
Share on other sites
_aliveUnits = allUnits select {alive _x};
hint parseText format ["Alive units:<br/>%1", _aliveUnits joinString "<br/>"];

 

Edited by 7erra
fixed <br/> tag
  • Like 3

Share this post


Link to post
Share on other sites
21 minutes ago, 7erra said:

_aliveUnits = allUnits select {alive _x};
hint (parseText format ["Remaining units<br>%1", _aliveUnits joinString "<br/>"]);

 

 

That's where I was headed, but I couldn't get it to work. It seems like it should. I would be interested to know why!

hint parseText (_aliveUnits joinString "<br/>");

Works, but then we don't have the header.

 

@Schatten's works nicely.

  • Like 2

Share this post


Link to post
Share on other sites
10 minutes ago, Harzach said:

That's where I was headed, but I couldn't get it to work. It seems like it should. I would be interested to know why!

That's because Arma only interprets XML-like syntax, e.g. "<br/>", not "<br>". This works:

hint (parseText (format ["Remaining units<br/>%1", _aliveUnits joinString "<br/>"]));

 

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites

Ah, I think the "<br>" was maybe a typo in 7erra's code.

 

7 minutes ago, Schatten said:

This works:

 

I'm getting this:

 

XpWWBUx.png

Share this post


Link to post
Share on other sites

Yea the <br> was a typo. Should work now.

  • Like 1

Share this post


Link to post
Share on other sites
24 minutes ago, Schatten said:

 

Ah, I was using the OP's array-building code by accident. With @7erra's it works great.

*edit* - and @7erra's code works as well. The issue was using OP's original code to build the array. Clarity achieved!

  • Like 1

Share this post


Link to post
Share on other sites

Thanks! This worked great with using pushBack / array.

hint (format ["Remaining units\n%1", _aliveUnits joinString "\n"]);

Question, is it possible to add color to the header text with above code?

Share this post


Link to post
Share on other sites
14 minutes ago, Robustcolor said:

Question, is it possible to add color to the header text with above code?

No.

To do this you need to use @7erra's code and structured text.

  • Like 2

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

×