• 🏆 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!

[General] Dialog Boxes

Status
Not open for further replies.
Level 3
Joined
May 16, 2011
Messages
57
Hello again...I'm sure with the amount of queries you'll find me posting up here, some people are going to be real tired of me fast -_-

However, I am still toying around and trying to get my idea working. One such thought was a Dialog Box as a Charecter Select. Fine on paper, as some people have done a similair thing, but in practice...well...

Here's the code:
  • Hero Picking
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked player) slot status) Equal to Is playing
              • ((Picked player) controller) Equal to User
            • Then - Actions
              • Hashtable - Create a hashtable
              • Dialog - Show HeroSelect for (Picked player)
              • Dialog - Change the title of HeroSelect to Hero Select
              • Dialog - Create a dialog button for HeroSelect labelled Chaingunner
              • Hashtable - Save Handle OfHeroSelect as 1 of 1 in (Last created hashtable)
            • Else - Actions
              • Do nothing
So it's based on the Hive "Wisp Select" tutorial, only we use a dialog box instead. I've even tried using a Hashtable, but the box isn't showing up for me when I load up the map in tests. I'm not sure what's wrong, or even if it's the code that's the problem.

Anyone have any idea how I've screwed up this time?
 
Last edited by a moderator:
Level 28
Joined
Jan 26, 2007
Messages
4,789
Woah, why the hashtable? That's not needed at all... just use a regular variable.

Dialogs cannot be shown on map init, it specifically says that when you create the action.
Perhaps you should read those texts as well, they can really provide some useful info.

The title and buttons should also be set up BEFORE you show the dialog, and they should be outside the player group.

Here's what it should look like:

  • Init
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Dialog - Change the title of heroDialog to Select a Hero
      • Dialog - Create a dialog button for heroDialog labelled Paladin
      • Set dialogButton[1] = (Last created dialog Button)
      • Dialog - Create a dialog button for heroDialog labelled Archmage
      • Set dialogButton[2] = (Last created dialog Button)
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked player) controller) Equal to User
              • ((Picked player) slot status) Equal to Is playing
            • Then - Actions
              • Dialog - Show heroDialog for (Picked player)
            • Else - Actions

(To show a trigger like this, just change your "[quote][/quote]" with "[trigger][/trigger]", I highly suggest it).
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,201
Do not use hashtables for tasks which have a finite scope. Arrays are supperiour in both memory requirements and performance for that sort of task. If only 1 instance is needed then a normal variable would suffice and is even faster. Additional functionality usually comes at a cost.

Hashtables are useful when the scope of the problem is very large (such as storing data to object types or creating some forms of complex data structure).
 
Level 3
Joined
May 16, 2011
Messages
57
Woah, why the hashtable? That's not needed at all... just use a regular variable.

It's a carry over from my last attempt to get it to work. That is, my last attempt to get the Dialog Box to display.

Dialogs cannot be shown on map init, it specifically says that when you create the action.
Perhaps you should read those texts as well, they can really provide some useful info.

The title and buttons should also be set up BEFORE you show the dialog, and they should be outside the player group.

Here's what it should look like:

  • Init
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Dialog - Change the title of heroDialog to Select a Hero
      • Dialog - Create a dialog button for heroDialog labelled Paladin
      • Set dialogButton[1] = (Last created dialog Button)
      • Dialog - Create a dialog button for heroDialog labelled Archmage
      • Set dialogButton[2] = (Last created dialog Button)
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked player) controller) Equal to User
              • ((Picked player) slot status) Equal to Is playing
            • Then - Actions
              • Dialog - Show heroDialog for (Picked player)
            • Else - Actions

Fixes work. Cheers for the tip ^.^

Do not use hashtables for tasks which have a finite scope. Arrays are supperiour in both memory requirements and performance for that sort of task. If only 1 instance is needed then a normal variable would suffice and is even faster. Additional functionality usually comes at a cost.

Hashtables are useful when the scope of the problem is very large (such as storing data to object types or creating some forms of complex data structure).

So a Hastable is best for (for example) handling the AI?
 
Level 3
Joined
May 16, 2011
Messages
57
That's a possibility, I suppose. But mostly it is for things you will store at one time and retrieve later. (for example, a periodic spell or a spell that lasts a few seconds... or a database... etc.) ;)

I see. I'll bear that in mind while I fix this up. She's coming along well enough without one for the moment.
 
Status
Not open for further replies.
Top