Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
phenixfulcrum

How to use the 'escape' key to close a dialog box

Recommended Posts

hi,

sorry for my english because i'm french.

With Vektorboson's dialog tutorial (http://home.arcor.de/vektorboson/en/index.html), i learned to use dialogs and i created a dialog which allows player to follow a group with a camera (like debug spectator by Vektoboson or Spectator by Kegetys).

There's a button (named 'quit'wink.gif in my dialog which close the dialog with this command: closedialog 0

But if the player doesn't use this button but use the 'escape' key, the dialog doesn't close and the game is blocked on the camera view.

How can i affect the escape key with the script command 'closedialog 0'.

Someone know what to do ? Perhaps vektorboson will read this topic and helps me?

thx a lot, Phenix.

Share this post


Link to post
Share on other sites

Hi,

Depend what you want to do.

If you don't have esc button, when user escape the dialog is close automatically.

You can use predifened buttons

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">// Predefined controls

#define IDC_OK 1

#define IDC_CANCEL 2

<span id='postcolor'>

And in your dialog description:

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">

class ButtonCancel : RscbuttonWP

{

idc = IDC_CANCEL;

text = $STR_DISP_CANCEL;

x = 0.89;

y = 0.90;

w = 0.1;

h = 0.060;

sizeEx = 0.030;

soundClick[] = {"ui\ui_cc", 0.2, 1};

action = "Cancel = true";

};

class ButtonOK : RscbuttonWP

{

idc = IDC_OK;

x = 0.77;

y = 0.90;

w = 0.1;

h = 0.060;

sizeEx = 0.030;

text = $STR_DISP_OK;

default = 1;

soundClick[] = {"ui\ui_ok", 0.2, 1};

action = "validation = true";

};

<span id='postcolor'>

May this help you (more this button is localised)

uiox

Si tu veux voir des dialogues un peu plus élaborés tu peux regarder dans OFPEC dans editor depot dans les pending un exemple de mission avec differents scripts traitant des dialogues.

Share this post


Link to post
Share on other sites

Hi uiox,

i tried the code you gave me and it works fine.

On OFPEC Forum, Vektorboson gives another way to do that.

If u are interested, can read his answer here : http://www.ofpec.com/yabbse....art=new

I download your Action Engine and test it. It is a the better use of dialogs i've never seen before.

Are u a member of the chain of command team?

Because in my next mission i use the first version of the commande engine. I choose that version because i think it will be more easier for french players to understand for the first time : it will be a platoon level mission.

After, i will create another mission at company lever with the CE2

phenix.

Share this post


Link to post
Share on other sites

one question that might be related to this: In Kegetys Spectatemode script you loose the menu after pressing ESC (for example to access the options menu, or to check the lobby). After doing this they can't switch between players anymore and if the player they are spectating dies, they are stuck at his dead body...

How can I recognize that the menu isn't displayed anymore? I'd like to reopen it automatically after some time (not immediately, so players get a chance to access the menus), but being completely at a loss with dialogs, I don't know how to check for this condition?

Share this post


Link to post
Share on other sites

To check if the dialog is open or not use "dialog".

Its all in the link above smile.gif

wow.gif PEACE

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  

×