Jump to content

Recommended Posts

EDIT 

 

I use 

 

class Xenoa_Ouverture {
   idd = 1000;
   name = "Xenoa_Ouverture";
   movingenable = false;
   enablesimulation = true;
   onLoad= "uiNamespace setVariable ['Xenoa_Ouverture',_this select 0]";
   class controlsBackground
   {
   };
   class controls
   {
       class Xenoa_Ouverture1 : RscPicture
       {
           idc = 1001;
           text = "textures\GUI\OVT.paa";
           x = 0.291457333333334 * safezoneW + safezoneX;
           y = 0.129638439581351 * safezoneH + safezoneY;
           w = 0.424167666666666 * safezoneW;
           h = 0.802568981921979 * safezoneH;
           tooltipcolortext[] = {0.250980392156863,0.466666666666667,0.670588235294118,1};
           tooltipcolorshade[] = {1,1,1,0};
       };
       class progressBar : RscProgress
       {
          idc = 1000;
          w = 0.102083333333333 * safezoneW;
          h = 0.010941960038059 * safezoneH;
          x = 0.452083333333333 * safezoneW + safezoneX;
          y = 0.723358705994291 * safezoneH + safezoneY;
       };
   };
};




// SCRIPT
  
  
disableSerialization;
createDialog "Xenoa_Ouverture";
_ui = uiNamespace getVariable "Xenoa_Ouverture";
_progress = _ui displayCtrl 1000;
_pgText = _ui displayCtrl 1001;
_pgText ctrlSetText format ["%2 (1%1)...","%"];
_progress progressSetPosition 0.01;
_cP = 0.01;

sleep 5;

_cP = _cP + 0.01;
_progress progressSetPosition _cP;
_pgText ctrlSetText format["(%1%2)...",round(_cP * 100),"%"];

 

Share this post


Link to post
Share on other sites

try to wait until you're sure to get the display 

 

createDialog "Xenoa_Ouverture";
waitUntil {!isNull (uiNamespace getVariable ["Xenoa_Ouverture",displayNull])};
_ui = uiNamespace getVariable "Xenoa_Ouverture";

 

Share this post


Link to post
Share on other sites

Another option is to execute the script with the onLoad line. This way you can make sure that the dialog is open and you can also pass the dialog as _this parameter instead of setting a variable.

Also the IDD 1000 might be already taken by another dialog, from BI or another community author. I eg always use the current date for my IDDs in format YYMMDD.

Share this post


Link to post
Share on other sites

Hmm 

 

16:47:46 Warning Message: Picture  (1%)... not found
16:47:46 Suspending not allowed in this context
16:47:46 Error in expression < progressSetPosition 0.01;
_cP = 0.01;

sleep 5;

_cP = _cP + 0.01;
_progress pr>
16:47:46   Error position: <sleep 5;

_cP = _cP + 0.01;
_progress pr>

Share this post


Link to post
Share on other sites

you defined a picture...

class Xenoa_Ouverture1 : RscPicture
_pgText = _ui displayCtrl 1001;

and filled the picture with

_pgText ctrlSetText format ["%2 (1%1)...","%"];

and your errormsg:

16:47:46 Warning Message: Picture  (1%)... not found

 

it crys: "I want a picture, not a text."

Share this post


Link to post
Share on other sites

 

Yes I did not modify the post more I had understood this. My worry is that I can not make anything fluid in 0.1 - 0.5 - 1 for example ..

 

disableSerialization;
createDialog "Xenoa_Ouverture";
_ui = uiNamespace getVariable "Xenoa_Ouverture";
_progress = _ui displayCtrl 1000;
_progress progressSetPosition 0.01;
_cP = 0.01;

sleep 1;

_cP = _cP + 0.5;
_progress progressSetPosition _cP;

 

Share this post


Link to post
Share on other sites
To make clear I am looking to make a charging bar for opening a phone. Charging will only take a few seconds (2-3 seconds) and then open the home page!

Share this post


Link to post
Share on other sites
Spoiler

player addAction ["Progress",
{    with uiNamespace do
    {    waitUntil {!isNull findDisplay 46};
        disableSerialization;
        tag_myProgressBar = findDisplay 46 ctrlCreate ["RscProgress",-1];
        tag_myProgressBar ctrlSetPosition [safezoneX+0.3*safezoneW,safezoneY+0.95*safezoneH,0.4*safezoneW,0.02*safezoneH];
        tag_myProgressBar ctrlSetTextColor [0.2,0.8,0.4,0.8];
        tag_myProgressBar progressSetPosition 0.5;
        tag_myProgressBar ctrlCommit 0;
    };
    
    disableSerialization;
    _ctrl = uiNamespace getVariable "tag_myProgressBar";
    private _n = 0;
    while {_n < 1} do
    {    _n = _n + 0.01;
        _ctrl progressSetPosition _n;
        sleep 0.01;
    };
    while {_n > 0} do
    {    _n = _n - 0.01;
        _ctrl progressSetPosition _n;
        sleep 0.01;
    };
    sleep 2;
    
    ctrlDelete _ctrl;
    uiNamespace setVariable ["tag_myProgressBar",nil];
}];

 

 

give you an action named "Progress" and try...

 

Edit:

another one:

Spoiler

player addAction ["Progress",
{    with uiNamespace do
    {    waitUntil {!isNull findDisplay 46};
        disableSerialization;
        tag_myProgressBar = findDisplay 46 ctrlCreate ["RscProgress",-1];
        tag_myProgressBar ctrlSetPosition [safezoneX+0.3*safezoneW,safezoneY+0.95*safezoneH,0.4*safezoneW,0.02*safezoneH];
        tag_myProgressBar ctrlSetTextColor [0.2,0.8,0.4,0.8];
        tag_myProgressBar progressSetPosition 0.5;
        tag_myProgressBar ctrlCommit 0;
    };
    
    disableSerialization;
    _ctrl = uiNamespace getVariable "tag_myProgressBar";
    private _n = 0;
    while {_n < 1} do
    {    _n = _n + 0.01;
        _ctrl progressSetPosition _n;
        sleep 0.01;
    };
    while {_n > 0} do
    {    _n = _n - 0.01;
        _ctrl progressSetPosition _n;
        sleep 0.01;
    };
    
    sleep 1;
    ctrlDelete _ctrl;
    uiNamespace setVariable ["tag_myProgressBar",nil];
    sleep 1;

    _id = floor random (43);
    _quote = call compile format ["[(localize 'STR_QUOTE_%1'),(localize 'STR_AUTHOR_%1')]",_id];
    _quote params ["_text","_author"];
    _txt = parseText format ["<br/><t align='center' size='1.3' color='#dca3a3'>%1</t><br/><br/><t align='right' color='#afcfff'>%2</t>",_text,_author];

    with uiNamespace do
    {    waitUntil {!isNull findDisplay 46};
        disableSerialization;
        "100" cutRsc ["RscTitleDisplayEmpty", "PLAIN"];
        tag_myDisplay = uiNamespace getVariable "RscTitleDisplayEmpty";
        tag_myOtherRsc = tag_myDisplay ctrlCreate ["RscStructuredText",-1];
        tag_myOtherRsc ctrlSetPosition [safezoneX+0.3*safezoneW,safezoneY+0.4*safezoneH,0.4*safezoneW,0.2*safezoneH];
        tag_myOtherRsc ctrlSetStructuredText _txt;
        tag_myOtherRsc ctrlSetBackgroundColor [0,0,0,0.8];
        tag_myOtherRsc ctrlSetFade 1;
        tag_myOtherRsc ctrlCommit 0;
    };

    _ctrl = uiNamespace getVariable "tag_myOtherRsc";
    _ctrl ctrlSetFade 0;
    _ctrl ctrlCommit 1;
    sleep 6;
    _ctrl ctrlSetFade 1;
    _ctrl ctrlCommit 1;

    sleep 1;
    _disp = uiNamespace getVariable "tag_myDisplay";
    _disp closeDisplay 1;
    uiNamespace setVariable ["tag_myOtherRsc",nil];
    uiNamespace setVariable ["tag_myDisplay",nil];
}];

 

 

first progressBar then display.

 

I will only push you in the right direction, not write complete scripts, thats your part.

the adddAction is only for demonstration.

 

Edited by Lucullus
  • Like 1

Share this post


Link to post
Share on other sites

 

Very well it works very well but I would like not to go through an addaction but more by an opening. Example Y -> Opening GUI -> Progress BAR -> END ---> Opening GUI 2

Share this post


Link to post
Share on other sites

You see ? At the opening we launch directly the progressbar which is in the mistletoe of the phone at the end of this progress bar we launch the createdialog of the homepage

Share this post


Link to post
Share on other sites

Create a progress bar control in your dialog. When the dialog is opened, hide all of your GUI controls except from the progress bar. Next, start the progress bar script. After this has finished, unhide all of your controls in addition to hiding the progress bar.


(This is just a demo to test in the debug console):
 

Spoiler

player addAction ["Progress", { 
	[] spawn {
		waitUntil {!isNull findDisplay 46};
		disableSerialization;

		_display = findDisplay 46 createDisplay "RscDisplayEmpty";
		
		_background = _display ctrlCreate ["RscText", -1]; 
		_background ctrlSetPosition [safezoneX + 0.1 * safezoneW, safezoneY + 0.1 * safezoneH, safezoneW * 0.8, safezoneH * 0.8];
		_background ctrlSetBackgroundColor [0,0,0,1];
		_background ctrlCommit 0;
		
		_text = _display ctrlCreate ["RscText", -1];
		_text ctrlSetPosition [safezoneX + 0.15 * safezoneW, (safezoneY + 0.1 * safezoneH) + (safezoneH * 0.4 - 0.02 * safezoneH), 0.7 * safezoneW, 0.4 * safezoneH];
		_text ctrlSetText "TEST TEST TEST";
		_text ctrlSetFontHeight 0.5;
		_text ctrlCommit 0;
		
		_progress = _display ctrlCreate ["RscProgress", -1];
		_progress ctrlSetPosition [safezoneX + 0.15 * safezoneW, (safezoneY + 0.1 * safezoneH) + (safezoneH * 0.4 - 0.02 * safezoneH), 0.7 * safezoneW, 0.02 * safezoneH];
		_progress ctrlSetTextColor [0.2,0.8,0.4,0.8];
		_progress ctrlCommit 0;
		
		{_x ctrlSetFade 1;_x ctrlCommit 0;} forEach [_text];
		
		_start = diag_tickTime;
		_end = _start + 5;
		
		waitUntil {
			_progress progressSetPosition linearConversion [_start, _end, diag_tickTime, 0, 1, true];
			diag_tickTime > _end
		};	
		
		_progress ctrlSetFade 1;
		_progress ctrlCommit 0;
		{_x ctrlSetFade 0;_x ctrlCommit 0;} forEach [_text];
		

		sleep 5;
		{ctrlDelete _x;} forEach [_background, _progress, _text];
	};
}];

 

 

  • Like 1

Share this post


Link to post
Share on other sites

 

Yes but is it possible without addaction? That all this starts right at the execution of a dialog?

Share this post


Link to post
Share on other sites
9 minutes ago, Cap Oral said:

 

Yes but is it possible without addaction? That all this starts right at the execution of a dialog?

Yes, the addAction was just for to visualise what I was explaining.
Write a script which does what I explained and execute it from an onLoad display eventHandler 

Share this post


Link to post
Share on other sites

 

I try and try again but I do not arrive at the result I expect to make sure that

_background = _display ctrlCreate ["RscText", -1];  

is replaced by a createdialog that I would have created?

 

I try to open one of my mistletoe at the launch of the script and then create the progressbar to finally close the mui gui and reopen a

 

 

Share this post


Link to post
Share on other sites

Your dialogs are all right, the scripts are examples for animate the progress.

Create your dialog, animate the progress, close your dialog and open the next one.

 

I've updated my first post.

This shows you a way, HallyG's solution another.

There are so many ways...

 

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

×