Jump to content
FunnyCookieEver

Use of stringtable in dynamicText func

Recommended Posts

I want to use custom titles for speech, that will appear at the bottom of the screen. But I have encountered such problem, that I don't know how to use text from stringtable in BIS_fnc_dynamicText. The idea was to make it easier show titles only by calling own script with string parameters and not to write long ([...] spawn BIS_fnc_dynamicText;) every time. I don't know how to insert STR_01_N_1 and STR_01_001 in to this script. Call of this script was supposed to look like this ( _nil = ["STR_01_N_1","STR_01_001"] execVM "text.sqf" ). Need help(. Here is the code that is not working...

private ["_name", "_text"];

// _name is a text from stringtable STR_01_N_1
// _text is a text from stringtable STR_01_001

_name = _this select 0;
_text = _this select 1;

["<t color='#FFD500' font='PuristaBold' size = '0.6'>_name</t> <t color='#FFFFFF' font='PuristaBold' size = '0.6'>_text</t>",0,1.1,4,1,0,789] spawn BIS_fnc_dynamicText;

 

Share this post


Link to post
Share on other sites

I use it for @hoverguy's vehicle shop actually:

if(!hasInterface) exitWith {}; // If no player client then exit

params ["_object", "_spawnMarkerArray"];

//build action text
_text = format ["%1%2%3", "<img image='HG_SVSS\UI\garage.paa' size='1.5'/><t color='#FF0000'>",
                          (localize "STR_HG_OPEN_GARAGE_SPAWNER"), "</t>"];

// adds Garage spawner
_object addAction
[
 _text,
 { _this call HG_fnc_dialogOnLoadGarage },
 _spawnMarkerArray,
 0,
 false,
 false,
 "",
 '(alive player) && !dialog'
]; 

 

  • Thanks 1

Share this post


Link to post
Share on other sites
[
	format [
		"<t color='#FFD500' font='PuristaBold' size = '0.6'>%1</t> <t color='#FFFFFF' font='PuristaBold' size = '0.6'>%2</t>",
		localize _name,localize _text
	],0,1.1,4,1,0,789
] spawn BIS_fnc_dynamicText;

localize "STR_01_N_1" will return some string you defined in your stringtable.xml, and if you need to join a string to a string, you can use + operator, format command and etc.

  • Thanks 1

Share this post


Link to post
Share on other sites

Well. I managed to combine my thoughts and your suggestions. Here is the final version that is working properly.

STR_01_N_1 - name

STR_01_001 - text

0,1,2 - how long text must be shown. 0 means 3 sec(default), 1 means 1.5 sec and 2 means 5 sec. These are most fitting numbers as for me.

 ["STR_01_N_1","STR_01_001",0] execVM "titles.sqf"

// _nil = ["STR_01_N_1","STR_01_00",0] execVM "titles.sqf"

private ["_name", "_text","_length"];

_name = _this select 0;
_text = _this select 1;
_length = _this select 2;

_ulength = 3;

if (_length == 1) then {
	_ulength = 1.5;
};

if (_length == 0) then {
	_ulength = 3;
};

if (_length == 2) then {
	_ulength = 5;
};

_temparray = [];
_separate = "<t color='#FFD500'>: <t/>";

_uname = format ["%1%2%3","<size='0.5'/><t color='#FFD500'>",(localize _name), "</t>"];
_utext = format ["%1%2%3","<size='0.5'/><t color='#FFFFFF'>",(localize _text), "</t>"];
_temparray = [_uname,_utext];
_alpha = _temparray joinString _separate;

[_alpha,0,1.1,_ulength,0.4,0,789] spawn BIS_fnc_dynamicText;

 

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

×