prykpryk 11 Posted September 21, 2016 Hi. I'm working on a script: Pryk_fnc_hitTranspose = { _array = getAllHitPointsDamage _this; _text = ""; _newarray = []; for "_i" from 0 to ((count (_array select 0))-1) do { _hitpoint = _array select 0 select _i; _dmg = round ((_array select 2 select _i)*100); _text = composetext [_text, linebreak, _hitpoint , ": ",str _dmg, "%"]; }; //_text = formatText ["<t align='left'>%1<t/>",_text]; //My best bet _text; }; This function returns a structured text with linebreaks in it. I'm displaying this using another hint function somewhere outside. However I also want the text to be aligned to the left. My attempt of doing this is commented. parseText only accepts strings and turning _text into a string loses linebreaks. Any ideas? Share this post Link to post Share on other sites
Tajin 348 Posted September 21, 2016 Why not use xml linebreaks then <br /> ? Pryk_fnc_hitTranspose = { _array = getAllHitPointsDamage _this; _newarray = []; _text = ""; for "_i" from 0 to ((count (_array select 0))-1) do { _hitpoint = _array select 0 select _i; _dmg = round ((_array select 2 select _i)*100); _text = _text + "<br />" + _hitpoint + ": " + (str _dmg) + "%"; }; _text = parseText ("<t align='left'>" + _text + "</t>"); _text; }; this should do 2 Share this post Link to post Share on other sites
prykpryk 11 Posted September 21, 2016 Nice idea. Thanks. PS. Removing _text = "" in outer scope did break it :) Share this post Link to post Share on other sites
HallyG 239 Posted September 21, 2016 Pryk_fnc_hitTranspose = { private _arr = getAllHitPointsDamage _this; private _arrNew = (_arr select 0) apply { format ["%1: %2%3", _x, round ((_this getHitPointDamage _x) * 100), "%"] }; private _text = _arrNew joinString "<br/>"; _text = parseText ("<t align='left'>" + _text + "</t>"); _text; }; Just an alternative using different commands. :) 2 Share this post Link to post Share on other sites
Tajin 348 Posted September 21, 2016 PS. Removing _text = "" in outer scope did break it :) That was by accident. ^^ Share this post Link to post Share on other sites
prykpryk 11 Posted September 21, 2016 Pryk_fnc_hitTranspose = { private _arr = getAllHitPointsDamage _this; private _arrNew = (_arr select 0) apply { format ["%1: %2%3", _x, round ((_this getHitPointDamage _x) * 100), "%"] }; private _text = _arrNew joinString "<br/>"; _text = parseText ("<t align='left'>" + _text + "</t>"); _text; }; Just an alternative using different commands. :) Now that's a clever use of the new commands Share this post Link to post Share on other sites