System Easy GUI Dialog

Discussion in 'Tutorials and Resources' started by Chewbalka, Mar 11, 2012.

  1. Chewbalka New Member

    Easy GUI Dialog
    I'm making a map where there are tones of dialog mostly yes/no but more complicated ones as well. So i made this to handle them all. I won't be making this into jass, there is already 2 jass dialog system that I found, I'm posting this becasue its both for GUI users and very easy to use (much easier then the ones I found anyway) as i can create any kind of dialog in 1 trigger.

    Variables's: (Array sizes do not matter, i put 100 but any amount works)
    DioAnswers - integer (Def: 0)
    DioButtonCount - Integer (Def: 0)
    DioButtonNames - String Array
    DioButtons - Dialog Button Array
    DioClick - Boolean (Def: False)
    DioDio - Dialog
    DioStarter - Trigger
    DioTitle - String

    These two do not need to be edited
    Codes: Attached map file below.
    Trigger:
    • DioMain
      • Events
      • Conditions
      • Actions
        • Dialog - Change the title of DioDio to DioTitle
        • For each (Integer A) from 1 to DioButtonCount, do (Actions)
          • Loop - Actions
            • Dialog - Create a dialog button for DioDio labelled DioButtonNames[(Integer A)]
            • Set DioButtons[(Integer A)] = (Last created dialog Button)
        • Dialog - Show DioDio for Player 1 (Red)

    Trigger:
    • DioOptions
      • Events
        • Dialog - A dialog button is clicked for DioDio
      • Conditions
      • Actions
        • For each (Integer A) from 1 to DioButtonCount, do (Actions)
          • Loop - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Clicked dialog button) Equal to DioButtons[(Integer A)]
              • Then - Actions
                • Set DioClick = True
                • Set DioAnswer = (Integer A)
                • Trigger - Run DioStarter (checking conditions)
                • Dialog - Hide DioDio for Player 1 (Red)
                • Dialog - Clear DioDio
              • Else - Actions


    This one does, its basically everything.
    Trigger:
    • DioExample
      • Events
      • Conditions
      • Actions
        • Dialog - Clear DioDio
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • DioClick Equal to False
          • Then - Actions
            • Set DioTitle = Title
            • Set DioButtonCount = 2
            • Set DioButtonNames[1] = Yes
            • Set DioButtonNames[2] = No
            • Set DioStarter = (This trigger)
            • Trigger - Run DioMain <gen> (checking conditions)
          • Else - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • DioAnswer Equal to 1
              • Then - Actions
                • -------- If yes was clicked, Usually refrence to another trigger. --------
                • Set DioClick = False
              • Else - Actions
                • Set DioClick = False
                • Do nothing







    Editing:
    Remember to set an event or call to the trigger, or there will be no way for the dialog to run.

    This section is pretty self explanitory, If you want more buttons just increase button count and continue setting values DioButtonNames[3,4,5...]
    Set DioTitle = Title
    Set DioButtonCount = 2
    Set DioButtonNames[1] = Yes
    Set DioButtonNames[2] = No

    Dont edit this:
    Set DioStarter = (This trigger)
    Trigger - Run DioMain <gen> (checking conditions)

    Edit this following the comments.
    Trigger:
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • DioAnswer Equal to 1
      • Then - Actions
        • -------- If Button 1 was clicked, Do these actions --------
        • Set DioClick = False
      • Else - Actions
        • -------- If Button 2 was clicked, Do these actions --------
        • -------- Because this one only has 2 buttons there is no need for another IF --------
        • -------- Set DioClick = False Is always necessary because it says the dialog is over --------
        • Set DioClick = False
        • Do nothing

    Say you have 4 buttons.
    Trigger:
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • DioAnswer Equal to 1
      • Then - Actions
        • -------- 1 clicked --------
        • Set DioClick = False
      • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • DioAnswer Equal to 2
          • Then - Actions
            • -------- 2 clicked --------
            • Set DioClick = False
          • Else - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • DioAnswer Equal to 3
              • Then - Actions
                • -------- 3 clicked --------
                • Set DioClick = False
              • Else - Actions
                • -------- 4 Clicked --------
                • Set DioClick = False

    Attached Files:

  2. Inflicted lolz wut :o

    Text like:
    Is very irritating to read.

    Please reduce the sizes to an appropriate amount.

    My questions are these:
    How is this an "Easy" dialog?
    Do we need this?
    Do people have a need for Dialog Boxes/Button's anymore?
    Will people benefit from this 'Tutorial'/'System' ?
    How much time did you put into this?
  3. Chewbalka New Member

    1. How is this an "Easy" dialog?
    2. Do we need this?
    3. Do people have a need for Dialog Boxes/Button's anymore?
    4. Will people benefit from this 'Tutorial'/'System' ?
    5. How much time did you put into this?

    1. A Title and not grammatically correct, i call it easy because you only simply need to configure the buttons, title and the functions of the dialog in a amount of triggers minimized to one. I don't see any way a dialog can get easier for GUI with broad use.

    2. When it comes to anything variety it is logically best to have available. Besides no one needs any of these systems as this is just a game and a depreciating one at it.

    3. So long as dialog boxes are part of the game which is a permanent function actually, they will be used. Both A because they are simple (simpler when this is used) and B because they are a default function of the game and are therfore most probable to be used.

    4. Access to use of anothers functions or snippets is useful and beneficial to any body using any language of programming, script and so forth. I'm quite happy when i can Google a script and find just what I need to save time especially when said script, like in this case, can save more time just by its function(s).

    5. I'm unsure. Its about a month old but simple, I would predict 5-10 minutes with the time it took to load the game to test it. I don't understand the relevance, Are any of the data types or functions used here leaking?

Share This Page