Tutorial Dialog Boxes (In-Depth)

tooltiperror

Super Moderator
Reaction score
231
ToolTipError Dialog Tutorial

Author: ToolTipError (also known as Tool.Tip.Error)
Contact: Private Message or Fantasy Life Forum
Battle.net Name: Tool.Tip.Error (USEast)​

----

- Reason for this Tutorial:
٭ I fealt that the World Edit Tutorial website was not indepth enough for beginners, so I created this in hopes of helping those new to Dialog's.

٭ A, "Hello" Move, this is my first forum post.

٭ I was bored and wanted a way to do something.

===


- Why Use a Dialog Box? (And what is it?)
Dialog Boxes are the menu boxes within Warcraft III, and they are extremely customizable in triggers and customizing your game. Because Dialog Boxes are not as commonly used as string based commands (i.e. (-ar)), they provide a splash of fresh water in many games.​

- Creating your First Dialog Box

So you want a Dialog Box? This here little guide should help you quite nicely.

Even though Camera Angle isn't a good example to start the tutorial off with, it will show you how to do a basic Dialog Box.

Although Dialog Boxes are easy to create, you need to follow this order of actions.

Trigger:
  • Dialog
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Dialog - Clear (Dialog)
      • -------- Clear has to be First --------
      • Dialog - Create a dialog button for (Dialog) labelled Text
      • -------- Show has to be Last --------
      • Dialog - Show (Dialog) for Player 1 (Red)


You see from above that the dialog box has three required functions for it to work properly.
  • Trigger:
    • Dialog - Clear (Dialog)

    This removes all left over functions from the last trigger.

  • Trigger:
    • Dialog - Create a dialog button for (Dialog) labelled Button Name

    This actually creates the Dialog button. The button can have any name, and color codes can be used. "Button Name" should be replaced with what you want players to see.

  • Trigger:
    • Dialog - Show (Dialog) for Player 1 (Red)

    This shows the finished Dialog to the player. Player 1 (Red) can be replaced by other players, or more usually, Triggering Player. There are also many other thing to replace Player 1 (Red). This must always be last, unless advanced triggering says differently, but I have never done that.

    You might also use:

  • Trigger:
    • Dialog - Change the title of (Clicked dialog) to Your Title
    This gives your Dialog a title.

You also need variables to do all of these things. Dialog Buttons and the Dialog must all be Variables. Here is a list of variables you need:

  • [Variable Type: Dialog] Name_Of_Your_Dialog

  • [Variable Type: Dialog Button] Generic_Button_Name

Now, when you want to give a button meaning, use a set variable action.
Trigger:
  • Actions
    • Set Dialog_Button_Enable_Camera = (Last created dialog Button)


Just position that below the dialog button you want it to be. For example:
Trigger:
  • Actions
    • Dialog - Create a dialog button for (Camera_Dialog) labelled Enable Camera
    • Set Dialog_Button_Enable_Camera = (Last created dialog Button)


Now, the dialog button needs meaning. So this kind of trigger would work.
Trigger:
  • Camera Enabled
    • Events
      • Dialog - A dialog button is clicked for Camera Dialog
    • Conditions
      • (Clicked dialog button) Equal to Dialog_Button_Enable_Camera
    • Actions
      • Camera - Lock camera target for Player 1 (Red) to (Your Unit), offset by (0.00, 0.00) using Default rotation

- Arrays!

You can use arrays in all different ways, with buttons or Dialogs. This section will cover how to use them and give some helpful hints, and when to use them.​

- Dialog Arrays

Dialog Arrays are mostly used for grouping dialogs or many dialogs at once. I, personally, never use them.​

- Dialog Button Arrays

Now, Dialog Button Arrays (Which will be known as DBA's for the time being) are more useful in my opinion. What you could do is to use it for categories, or for double pages. Let me explain.

Let's pretend I have two DBA's, one named PageOne, and the other, PageTwo. Both are four slots. Here are two triggers I could use.

Trigger:
  • Actions
    • Dialog - Create a dialog button for (SelectUnits) labelled Peasant
      • Set PageOne[1] = (Last created dialog Button)
    • Dialog - Create a dialog button for (SelectUnits) labelled Peon
      • Set PageOne[2] = (Last created dialog Button)
    • Dialog - Create a dialog button for (SelectUnits) labelled Wisp
      • Set PageOne[3] = (Last created dialog Button)
    • Dialog - Create a dialog button for (SelectUnits) labelled Next Page
      • Set PageOne[4] = (Last created dialog Button)
      • -------- ------------- --------
      • Set PageTwo[1] = (Last created dialog Button)
      • Set PageTwo[2] = (Last created dialog Button)
      • Set PageTwo[3] = (Last created dialog Button)
      • Set PageTwo[4] = (Last created dialog Button)


This means you don't have to make a billion variables, and you can manage it all easier.



- Common Errors

Here's an FAQ for common errors and glitches with Dialog Boxes, also some tips.​

Q: My Dialog Box has extra buttons that compile!
A: Make sure that the first action in your trigger is:
Trigger:
  • Dialog - Clear (Dialog)

If it is not, add it in and try again. It should fix the error.
Why: When you do "Add a Button", it adds that button onto the Dialog. Unless you clear it, it remains there.
So when you don't clear it, it adds a second, or possibly more depending on how big the Dialog is,




Q: How do I make a Cancel Button?
A:Creating a Cancel Button is easy! Just use the following action.
Trigger:
  • Dialog - Create a dialog button for (Dialog) labelled Cancel

Why: The Button has no value or Variable for it, so no event happens when it is clicked. I recommend you place it last and use the following action.
Trigger:
  • Dialog - Create a dialog button for (Dialog) labelled |CFFFAEBDCancel|R

This makes the cancel button white. Just a personal preference.



Q: How can I completely remove Dialogs to help Lag?
A: Just remove the trigger! Use the following action.
Trigger:
  • Custom script: call DestroyTrigger(gg_trg_GUI_NAME_OF_TRIGGER)

Replace spaces with Underscores.
Why: This stops all future runs of the trigger, and it also removes lag.


- Picture Gallery

Here are a few pictures to show you examples of Dialogs and their Buttons.​

> I think you should add pics of dialogs, too. Most newbies searching for how to create dialogs don't know what they are called, they just know what they look like. - Artificial

Upon the above request, I have included a small picture gallery here.​

2e2m911.jpg

opfk5.jpg
Please, Feedback.

I know this isn't an A+ tutorial, but it is my first one, so please provide good feedback.​
 

Dest

New Member
Reaction score
26
[*]
Trigger:
  • Dialog - Create a dialog button for (Dialog) labelled Text

This actually creates the Dialog button. The button can have any name, and color codes can be used.

Labelled = Labeled

That's all :p Great tutorial.
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Maybe you could try to give a more complex example too, like picking a Hero with a Dialog, or something like that :D

Anyways... Good, though small, tutorial ;)
I really like your formatting :thup:

+Rep ;)
 

tooltiperror

Super Moderator
Reaction score
231
Wow, thanks so much for the in-put, Dest and Komaq!

+Rep for the help, that was seriously very nice of you.



Anyway, I think I will add in a mode's part and add in an example map.
 

tooltiperror

Super Moderator
Reaction score
231
Updated the general flow and grammar, then added FAQ and formatted it into spoilers.

EDIT: Can this be moved to tutorials, or does it need some more?
 

tooltiperror

Super Moderator
Reaction score
231
Could I get a Mod to tell me what's needed or to approve / move this?
 

Lyerae

I keep popping up on this site from time to time.
Reaction score
105
You can use button arrays. Didn't see that anywhere.
 

Lyerae

I keep popping up on this site from time to time.
Reaction score
105
Multiple buttons?
Instead of creating a new variable for each button, just use an array.
 

tooltiperror

Super Moderator
Reaction score
231
Multiple buttons?
Instead of creating a new variable for each button, just use an array.
Good Thought.

I rarely use many dialog buttons, or any more than three or two, so thanks for the idea.


I will add it in soon.
 

Dest

New Member
Reaction score
26
Mind proving a bit more in-depth for array part? I don't understand it much. :(
 

Lyerae

I keep popping up on this site from time to time.
Reaction score
105
It's the same concept as before. You just specify an array variable when creating the variable, and an array index when setting the variable.
This increases the amount of buttons you can have (because you don't need a million variables. One array supports 8192-ish (I might have the exact number wrong) buttons), while decreasing the amount of variables needed.
 

tooltiperror

Super Moderator
Reaction score
231
It's the same concept as before. You just specify an array variable when creating the variable, and an array index when setting the variable.
This increases the amount of buttons you can have (because you don't need a million variables. One array supports 8192-ish (I might have the exact number wrong) buttons), while decreasing the amount of variables needed.​

Noted and Added.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top