Home   Help Search Login Register  

Author Topic: how to use the 'escape' key to close a dialog box  (Read 942 times)

0 Members and 1 Guest are viewing this topic.

phenixfulcrum

  • Guest
how to use the 'escape' key to close a dialog box
« on: 25 Oct 2002, 17:07:01 »
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') 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.

vektorboson

  • Guest
Re:how to use the 'escape' key to close a dialog box
« Reply #1 on: 26 Oct 2002, 01:04:14 »
Yes, Vektorboson reads this thread, and he answers, too!

Since 1.85 there is the command dialog which determines whether a dialog is opened or not. So if you press ESCAPE dialog will turn to false.

So in your script where you create the dialog you execute also another script that monitors whether the dialog was closed:

Code: [Select]
_ok = createDialog "MyDialog"
[] exec "monitorDialog.sqs"

And here is "monitorDialog.sqs"

Code: [Select]
@!dialog

camdestroy _camera
_camera cameraEffect ["terminate", "back"]
...
...

This should solve your problems,

greetings,

Vektorboson

phenixfulcrum

  • Guest
Re:how to use the 'escape' key to close a dialog box
« Reply #2 on: 28 Oct 2002, 00:12:21 »
Hi Vektorboson,

You told me all what i need. that's great!

I'm happy to see that OFP scripters are ready spend time to share their experience whith everybody.

Vektorboson,I discovered your work since your offer us the Console (on BIS Forum) which is a great tool for scripters.

One more time, i congrulate u for the help u gave me.
Don't worry, i will talk about your web page in french forums.

See u soon.

Thx, Phenix.