Jump to content
RafaDombras

Hide display when dialog closes with keyboard Esc (Solved!)

Recommended Posts

Hi,

 

I need help my friends, it is an issue with my game, that couldn’t solve myself.

I'm using the IFA3 Lite mod.

The problem is:

 

I made a dialog to spend the resources won by capturing and holding the flags areas, and put a display over de dialog to show the disposable resources. When I close the dialog with the [close] button, the command closes the display, but when I press keyboard Esc, the dialog closes, but the display dont. The question is, how do I get a return that the dialog is closed, so the script can terminate the display?

 

The mission is very cool, it is a Battlefield like game, mixed with company of heroes,  I'm still developing, and I wish to prepare it to multiplayers, if someone could help me with it, I would be much glad.

 

Sorry by the English, I'm from Brazil, and love this game since cold war crises launch, it was love at first sight.

 

Thanks!

 

Share this post


Link to post
Share on other sites

Sounds like you could use the dialog "onUnload"

 

example code:

 

class ExampleDialog
{
 idd = 1234567;

 onUnload = "call onCloseMyDlg"; // <- executed when dialog is closed (ESC or other)

 

Share this post


Link to post
Share on other sites

Thank you! This will solve my issue, I'll post de mission here later, or there is a proper place so I can post it?

I'm using a bolean variable to order close the display, it will work for sure.

 

 

Share this post


Link to post
Share on other sites

I just try it and didn't work...

class DIALOG_SH_GROUP4
{
    idd = 2300;
    movingenable = 0;
    name = "TAG_DIALOG_SH_GROUP4";
    onLoad = "uiNamespace setVariable ['TAG_DIALOG_SH_GROUP4', _this select 0];";
    onUnLoad = "resDisplay = false;"; 

    class Controls
    {

 

Any idea?

Share this post


Link to post
Share on other sites

Case solved,

 

I was missing something trivial,

	onUnLoad = "2 cutRsc ['default','PLAIN'];"; 

and found this bolean internal variable that tests whether any user dialog is open. True if a dialog is open, false if not

 

Changed the HUD script and, it works!

2 cutRsc ["HUD_RESOURCES","PLAIN"];
waitUntil {!isNull (uiNameSpace getVariable "HUD_RESOURCES")};
_display = uiNameSpace getVariable "HUD_RESOURCES";
_setText = _display displayCtrl 4011;

while {dialog} do {
	_setText ctrlSetStructuredText (parseText format ["USA %1 | GER %2",USAFactionResources,GERFactionResources]);
	_setText ctrlSetBackgroundColor [0,0,0,0.5];
	sleep 0.1;
};

when I press Esc, the Dialog "2" is instantaneously closed.

 

https://community.bistudio.com/wiki/dialog

 

Thanks again gc!

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

×