Chewbalka
New Member
- Reaction score
- 14
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)
- Loop - Actions
- 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
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Loop - Actions
- For each (Integer A) from 1 to DioButtonCount, do (Actions)
- Events
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
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
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
- If - Conditions
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
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions