Jump to content
Sign in to follow this  
riouken

ctrlSetStructuredText syntax

Recommended Posts

I am trying to create a simple mission timer that shows time since mission start. This will be in my already working Dialog. I have been reading about the syntax for ctrlSetStructuredText and parseText and I just cant seem to get it to display in my dialog. I have a structured text box in my dialog. Here is the script that im running to populate the box.

Thanks to Hoz for the formating.

while {true} do {
   _seconds = time;

   _hours = floor(_seconds / 3600);
   _seconds = _seconds - (_hours * 3600);
   _tensOfMinutes = floor(_seconds / 600);
   _seconds = _seconds - (_tensOfMinutes * 600);
   _minutes = floor(_seconds / 60);
   _seconds = _seconds - (_minutes * 60);
   _tensOfSeconds = floor(_seconds / 10);
   _wholeSeconds = floor(_seconds - (_tensOfSeconds * 10));
   _elapsed ="";

   _elapsed = format ["%1:%2%3:%4%5", _hours, _tensOfMinutes, _minutes,_tensOfSeconds, _wholeSeconds];

   (opcominterface displayCtrl 1100) ctrlSetStructuredText parseText _elapsed;

   sleep 1;

};

Im not getting any RPT errors, but no text is showing.

Here is my base class:

class RscStructuredText
{
access = 0;
type = 13;
idc = -1;
style = 0;
colorText[] = {0.8784,0.8471,0.651,1};
class Attributes
{
	font = "Zeppelin32";
	color = "#e0d8a6";
	align = "center";
	shadow = 1;
};
x = 0;
y = 0;
h = 0.035;
w = 0.1;
text = "";
size = 0.03921;
shadow = 2;
};

and here is my dialog:

class timer: RscStructuredText
{
idc = 1100;
       colorBackground[] = { 1, 1, 1, 1 };
x = 0.751116 * safezoneW + safezoneX;
y = 0.775602 * safezoneH + safezoneY;
w = 0.0896484 * safezoneW;
h = 0.0425 * safezoneH;
};

Share this post


Link to post
Share on other sites

Not very good with dialogs but try change:

(opcominterface displayCtrl 1100) ctrlSetStructuredText parseText _elapsed;

to

(opcominterface displayCtrl 1100) ctrlSetText format["%1", _elapsed];

Share this post


Link to post
Share on other sites

I just tested it and that does not work either.

I know the dialog box works because I changed the starting text to this:

class timer: RscStructuredText
{
idc = 1100;
       [color="Red"]text = "Test";[/color]
       colorBackground[] = { 1, 1, 1, 1 };
x = 0.751116 * safezoneW + safezoneX;
y = 0.775602 * safezoneH + safezoneY;
w = 0.0896484 * safezoneW;
h = 0.0425 * safezoneH;
};

And Test showed up just fine, I just cant seem to change the text after the dialog is up.

Share this post


Link to post
Share on other sites

Use BIS_fnc_dynamicText function instead ;)

Share this post


Link to post
Share on other sites

Thanks for the Helpp Gaia and JW Custom. I will work with those and see what I can get working.

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
Sign in to follow this  

×