/** * fn_messageTo.sqf * @Descr: Proxy for CSE UI * @Author: Insane * * @Arguments: [unit, headline, text, timer (optional)] * @Return: - * @Example: [player, "Test", "Text text"] call TDC_fnc_messageTo; */ [_this, _fnc_scriptName] call TDC_fnc_debug; _unit = [_this, 0, objNull] call BIS_fnc_param; _headline = [_this, 1, ""] call BIS_fnc_param; _text = [_this, 2, ""] call BIS_fnc_param; _timer = [_this, 3, 5] call BIS_fnc_param; if ((time - TDC_lastmsg) < _timer) then { sleep (_timer - (time - TDC_lastmsg)); }; TDC_lastmsg = time; _textOut = ""; _headlineLen = count (toArray _headline); switch (typeName _text) do { case "ARRAY": { _textOut = []; { _xLen = count (toArray _x); if ((_headlineLen*3) > _xLen) then { _textOut set [count _textOut, format["%1 ",_x]]; } else { _textOut set [count _textOut, format["%1 ",_x]]; }; } foreach _text; }; case "STRING": { _xLen = count (toArray _text); if ((_headlineLen*3) > _xLen) then { _textOut = [format["%1 ",_text]]; } else { _textOut = [format["%1 ",_text]]; }; }; default { _textOut = [_text]; }; }; [_unit, _headline, _textOut] call cse_fnc_sendDisplayInformationTo;