I'm trying to create an on-screen timer, but my script is not successfully setting the display's text. The display is showing up on screen, because I can see the background, but no text is appearing.
params ["_seconds"];
100 cutRsc ["RscZoneTimer", "PLAIN"];
for "_i" from _seconds to 0 step -1 do {
private _timeString = ([_i, "MM:SS"] call BIS_fnc_secondsToString) select [1, 4];
[(uiNamespace getVariable ["ZoneTimer", displayNull]) displayCtrl 1003, _timeString] remoteExec ["ctrlSetText"];
if (_i <= 10 && _i % 2 == 0) then {
[(uiNamespace getVariable ["ZoneTimer", displayNull]) displayCtrl 1003, [0.8, 0, 0, 1]] remoteExec ["ctrlSetTextColor"];
};
if (_i == 0) then {
["FD_CP_Clear_F"] remoteExec ["playSound"];
};
sleep 1;
};
100 cutText ["", "PLAIN"];
Here is the GUI:
import RscText;
#include "\a3\ui_f\hpp\definecommongrids.inc"
class RscTitles {
class RscZoneTimer {
idd = -1;
duration = 1e+6;
fadeIn = 0;
fadeOut = 0.5;
onLoad = "uiNamespace setVariable ['ZoneTimer', _this#0]";
onUnload = "";
class Controls {
class TimerText: RscText {
idc = 1003;
text = "";
x = 0.912595 * safezoneW + safezoneX;
y = 0.203 * safezoneH + safezoneY;
w = 0.0515744 * safezoneW;
h = 0.055 * safezoneH;
colorText[] = {1,1,1,1};
colorBackground[] = {0,0,0,0.5};
sizeEx = 3 * GUI_GRID_H;
};
};
};
};