Tutorial Voting with Dialog Boxes - GUI

NullCurrent

( ゚ε ゚)
Reaction score
110
IF ANY MOD OR ADMIN FINDS THIS THREAD, DELETE IT, THERE IS BROKEN IMAGES THAT I CAN NOT GET BACK. THANK YOU.


A Tutorial by Fabioz

Dialog Boxes in GUI
with voting

Contents:

I. Background Information
A. What are dialog boxes?​
B. Where is one usually used?​

II. Basic Dialog Box
A. Creating the Variables​
B. Creating the Dialog Box​
C. Adding a Response​

III. Voting with Dialog Boxes
A. Creating the Variables​
B. Creating the Dialog Box​
C. The Reaction​



I. Background Information


What is a dialog box?
A dialog box is a box that comes up asking a question, or stating something. It also asks for a response.​

Where is one usually used?
One is usually used when the computer is asking for a difficulty level, Mode style, etc.​

Screenshot of a typical dialog box

Screenshot.jpg





II. Basic Dialog Box


This dialog box is the most basic one can get.


A. Creating the Variables

1. Open World Editor.
2. Go into the variable editor (little x button on top toolbar.)
3. The first variable is going to be the variable for the actual box. So, make a Dialog type variable called, "DialogBox".​

DialogBox.jpg


4. The second variable is going to be the variable for the buttons. There are going to be 2 buttons, so the variable is a dialog Button Type, called "DialogButton".​

BasicDialogBox2.jpg



B. Creating the Dialog Box

Here you are going to create the trigger for the box, when, where, asking what, answers, all that.​

1. My event is going to be 5 seconds has elapsed.
2. I will not have any conditions
3. My actions are going to be:​
  • Clear the dialog box, "DialogBox".(This is if you are using the dialog box more than once; its a good habit to get into)
  • Change the title to what ever you want it to be named.
  • Create a dialog button named what ever you want it to say.
  • Create a dialog button named what ever you want it to say.

But, this is not going to do anything when you choose one.
So we go on to making a response.


C. Adding a Response

Here is where you will use a new variable, and add some triggers on to the first one.​

1. Create a variable called “DialogButtons", with the type of Dialog Button, and an array of 2. (looks like this "DialogButtons[1]" etc.)​

2. Create new triggers for the trigger "Basic Dialog Box"
Add the triggers right after you create the new dialog button. Set the Newly created dialog button equal to "DialogButton[1] or [2]. ([1]=Yes, [2]= No)​

It should look like this:​

alltriggers.jpg


3. Create 2 new Triggers:​
Yes:​
  • Event: Dialog button clicked.
  • Condition: Dialog button clicked equals dialog button "DialogButton[1]"
  • Trigger: Show Text: I am glad you think so!

Like this:​

Yes.jpg


No: Should look almost the same but different array and different text, like this:​

No.jpg
[/list][/list][/list]




III. Voting with Dialog Boxes


I used the question "What would you rate my tutorial?" and I used 2 new variables.


A. Two new variables:

1. "VoteDialogButton" Dialog Button type, with an array of 5.​

VoteDialogButton.jpg


2. "Votes" Integer type, with an array of 5(to keep track of the votes).​

Votes.jpg



B. Creating the Dialog Box

The voting dialog box is simular to the basic one, but, there are a lot more dialog buttons.

Since, you already know how to do it, I will just show the screenshot.​

VotingDialogBox.jpg




C. The Reaction

1. We will also need to make ten more triggers(for the five ratings, and the five responses.)
They will all look mostly the same:​
  • Event: Dialog Button clicked
  • Condition: Dialog Button clicked = VoteDialogButton[1-5]
  • Action: Set VoteDialogButton[1-5] = VoteDialogButton[1-5] + 1
Do this for each one. Like this:​

Votingexample.jpg



2. We will now create the trigger to specify wich rating won.
All of them will more or less look like this:​
  • Event: 15 seconds have elasped
  • Conditions: VoteDialogButton[1] is greater than VoteDialog Button[2]-[5]
  • Action: The vote of "1" won! (you can place many different actions than this though, like a mode style, etc.)

You will have to change each one, EXP: Votes[2] is greater than Votes[1], [3]-[5], etc.​

Screenshot:

Votewon.jpg





There you have it!

Questions? Comments? Please Post!​

Hints:
-When making a long text use "|n" to break the line and bring it down one line.
-Keep your variables as simple names. This way it is easiest to refer back to them.
 

ReVolver

Mega Super Ultra Cool Member
Reaction score
608
We already have 2 Dialog tutorials: Mine and Acehart's

but you did a good job on explaining the voting part.
 

esb

Because none of us are as cruel as all of us.
Reaction score
329
A sample map would be nice.

I think there's an easier way (Using one trigger) for checking which vote is the greatest, using If/Then/Else.
 

PurgeandFire

zxcvmkgdfg
Reaction score
509
I think the only way to detect if a dialog is clicked is via events, so it requires multiple triggers.

If you were using JASS, though, that's a different story. A whole map can be in one trigger if coded in JASS! But that doesn't mean that JASS can do everything, but it can do everything GUI can, but in a more optimized way and it has some more features.
 

NullCurrent

( ゚ε ゚)
Reaction score
110
Yeah I suck at Jass... learning though.
I also had a sample map waiting, forgot to put it in.
(I made this tut for my clan, decided to put on here)
 

hell_knight

Playing WoW
Reaction score
126
If/Then/Else is bugging with dialogs?

For my game I was mkaing I used 32 If/Then/Else in one trigger , but its really buggy as any button would return all 32 being clicked even tho thats false as you cannot click DialogButton[1-32] at one time -_-
 

esb

Because none of us are as cruel as all of us.
Reaction score
329
You probably did a mistake... Post the trigger(s)?
 

Mr.Tutorial

Hard in the Paint.
Reaction score
42
The tutorial looks great, though I haven't read it, I think it would be useful to many people, including me, I never knew the vote stuff :eek:
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top