Author Topic: How to check (and act) if dialog is ongoing?  (Read 916 times)

Babar

  • Creator, Mutator and Defecator
    • I can help with proof reading
    •  
    • I can help with scripting
    •  
    • I can help with story design
    •  
    • I can help with translating
    •  
How to check (and act) if dialog is ongoing?
« on: 21 Jun 2013, 01:39 »
Hello hello!

In my never-ending quest to iterate through everything, I've reached dialogs now. The problem is, I can't seem to find a way to check if a dialog (any and every dialog) is running. I'm not using any custom dialog system, and I'd prefer not to. Still, I am displaying the dialog in a custom textwindow gui instead of the normal way.

Since I was doing that, I figured I'd simply check if gDialogs.Visible is true. However, I believe that no scripts are run and nothing is checked while dialogs are ongoing? For my check I tried using both the on_key_press function (by adding a "&& (!gDialogs.Visible)" condition to "if (IsGamePaused() keycode = 0", and then adding a check with a keypress to display a message or to move the mouse or SOMETHING to indicate that code is running), and with repeatedly_execute (again with a relevant condition) and even repeatedly_execute_always. None of these had any effect.
So...any ideas? Heck, is it even possible to run any sort of code at all while a dialog is active?

To give some context, once I can check if there is a dialog ongoing, I'd give an ability to iterate through all the options if the player pressed a button.

Also, a second issue, there some way to make visible through script a GUI set with the "Mouse YPos" setting? According to the manual, .Visible doesn't work like that for Mouse YPos GUIs. If I Mouse.SetPosition to the top within its PopupYPos value, it shows, but if I Mouse.SetPosition immediately after that again (even if it is to on top of a button on that same GUI) it doesn't show. Perhaps some issue with it not having enough time to register that the mouse was there?

EDIT: Just after I've posted, I see the thread for Phemar/Zor's dialog module :D. Still, I'd prefer, if possible to just use the normal dialog system, and not have to rely on some other module. Is dialog truly and completely blocking?
« Last Edit: 21 Jun 2013, 01:47 by Babar »
The ultimate Professional Amateur

Now, with his very own game: Alien Time Zone

Khris

  • having to deal with what games are going through
    • Lifetime Achievement Award Winner
    •  
    • I can help with play testing
    •  
    • I can help with scripting
    •  
    • I can help with translating
    •  
    • Khris worked on a game that was nominated for an AGS Award!
Re: How to check (and act) if dialog is ongoing?
« Reply #1 on: 21 Jun 2013, 03:03 »
In General settings -> Dialog is an option called "Run game loops while dialog options are displayed". It should allow you to at least use rep_ex_always.

As for the YPos GUI, you can easily script its behavior yourself using a "Normal" GUI and mouse coordinate checking in rep_ex. That way you can use .Visible just fine.

monkey0506

  • AGS Project Tracker Admins
  • SEND PIZZA.
    • Best Innovation Award Winner 2017, for his work to help AGS games reach the widest possible audience - through popular distribution platforms (Steam, Galaxy) as well as other operating systems (Android, Linux)
    •  
Re: How to check (and act) if dialog is ongoing?
« Reply #2 on: 22 Jun 2013, 01:53 »
For your purposes, you're probably best off using rep_ex_always, but I will point out that if you use the custom dialog options rendering methods, that dialog_options_get_dimensions could effectively be used for indicating that a dialog has started. You could then check in rep_ex_always (with the "Run game loops" option turned off) to indicate that the dialog has ended (or, use rep_ex and the effect will just be delayed by any blocking scripts at the point the dialog ended).

Doing this of course requires you to then manage the dialog option rendering yourself.

Babar

  • Creator, Mutator and Defecator
    • I can help with proof reading
    •  
    • I can help with scripting
    •  
    • I can help with story design
    •  
    • I can help with translating
    •  
Re: How to check (and act) if dialog is ongoing?
« Reply #3 on: 23 Jun 2013, 00:13 »
As I said, I'd rather not do it if I have a way not to.
I set "Run game loops while dialog options are displayed" to true, but it doesn't seem to have changed anything. It still doesn't pick up "if (gDialogs.Visible) ...;". :(
The ultimate Professional Amateur

Now, with his very own game: Alien Time Zone

monkey0506

  • AGS Project Tracker Admins
  • SEND PIZZA.
    • Best Innovation Award Winner 2017, for his work to help AGS games reach the widest possible audience - through popular distribution platforms (Steam, Galaxy) as well as other operating systems (Android, Linux)
    •  
Re: How to check (and act) if dialog is ongoing?
« Reply #4 on: 24 Jun 2013, 19:21 »
I've never used a text window GUI, so I don't know if there's any special rules relating to how AGS treats those when displaying dialog options. Based on what you're describing, it sounds like the GUI isn't being set to visible (obviously).

In the worst case scenario, the custom dialog rendering options aren't that bad. You could create a simple script for rendering with probably no more than a couple hundred lines of code. Not trying to force your hand, but like I said, I don't know if/why the GUI wouldn't be getting set as visible.