• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

how to check a custom dialog result?

Status
Not open for further replies.
Level 6
Joined
Sep 28, 2009
Messages
222
hi guys

i am to dump to check the dialog result of a custom dialog.
my test trigger:

  • custom dialog test
    • Events
      • Timer - Elapsed time is 0.0 Game Time seconds
    • Local Variables
    • Conditions
    • Actions
      • UI - Display a Query custom dialog with Title No Text and Text No Text for (All players) (Pause game)
      • General - If (Conditions) then do (Actions) else do (Actions)
        • If
          • (Custom dialog result) == Yes
        • Then
          • UI - Display "yes" for (All players) to Subtitle area
        • Else
          • UI - Display "no" for (All players) to Subtitle area
"no" is already displayed when the dialog shows up.
anyone has an idea how to check it? its quite usefull because then you dont have to create a new dialog for simple yes/no decisions.
 
Level 9
Joined
Jun 7, 2007
Messages
195
You can use Dialog Items, unless it's just the Title you want changed.

Dialog Title
  • Dialog - Set title of (Last created dialog) to "Yes/No"
Dialog Items
  • Untitled Trigger 001
    • Events
      • Timer - Elapsed time is 0.0 Game Time seconds
    • Local Variables
    • Conditions
    • Actions
      • Dialog - Create a Modal dialog of size (500, 400) at (0, 0) relative to Center of screen
      • Variable - Set Dialog001 = (Last created dialog)
      • Dialog - Create a Label for Dialog Dialog with the dimensions (200, 50) anchored to Top Left with an offset of (50, 50) with the text "" color set to White text writeout set to false with a writeout duration of 2.0
      • Variable - Set DialogItem001 2 = (Last created dialog item)
      • ------- You MUST have the dialog Shown to make it visible!
      • Dialog - Show Dialog001 for (All players)
      • ------- Simply use these to change the text from anywhere.
      • ------- You must use a variable to refer to the correct Dialog Item, unless you're doing
      • ------- initialization where it's possible to use Last Created Dialog Item, which I didn't use.
      • Dialog - Set DialogItem001 2 text to "Yes" for (All players)
      • General - Wait 5.0 Game Time seconds
      • Dialog - Set DialogItem001 2 text to "No" for (All players)
 
Level 6
Joined
Sep 28, 2009
Messages
222
yes sure i could do that, but thats more work :D i mean why this function exists if you cant use it? if there is a custom dialog that can be easily used, and if there is a function thats called "dialog result" there must be a way to do it.
 
Level 9
Joined
Jun 7, 2007
Messages
195
Ok, how about this:

  • Create Query Dialog
    • Events
      • Timer - Elapsed time is 0.0 Game Time seconds
    • Local Variables
    • Conditions
    • Actions
      • UI - Display a Query custom dialog with Title No Text and Text No Text for (All players) (Pause game)
  • Query Dialog Answer
    • Events
      • UI - Player Any Player dismissed the custom dialog with result Any
    • Local Variables
    • Conditions
    • Actions
      • General - If (Conditions) then do multiple (Actions)
        • If Then Else
          • General - Else if (Conditions) then do (Actions)
            • Else If
              • (Custom dialog result) == Yes
            • Then
              • UI - Display ((Name of player (Triggering player)) + " selected Yes.") for (All players) to Subtitle area
          • General - Else if (Conditions) then do (Actions)
            • Else If
              • (Custom dialog result) == No
            • Then
              • UI - Display ((Name of player (Triggering player)) + " selected No.") for (All players) to Subtitle area
 
Level 6
Joined
Sep 28, 2009
Messages
222
hm ok well i understand, but how does he know which custom dialog i mean?

for example if i have 3 custom dialogs with different functions, he doesnt know which one was clicked. the event just says that ANY custom dialog was used, and in the conditions u also cant check it because the custom dialog isnt saved in any variable (even if it would be it wouldnt make any difference because there is no "used dialog" function, only "used dialog item"). you also cant check title or text. so how to identify the custom dialog?

+rep for help anyways! :)
 
Level 9
Joined
Jun 7, 2007
Messages
195
Well, each player can only view one Custom Dialog at a time so you could keep track of the players who are viewing dialogs.

Example.
- When you show Dialog A to Player 1, set PlayerIsViewingDialog[1][0] = true

- When Player dismisses an Custom Dialog check which Dialog the Triggering Player is currently viewing and do actions accordingly.

- Optionally when you're about to display a Custom Dialog to a Player you could check if the Player is already viewing any other Custom Dialog, if so, don't show the new Custom Dialog yet.
 
Status
Not open for further replies.
Top