Dialog buttons "need help!"

Muddis

New Member
Reaction score
0
I been trying to create a trigger that when i press a dialog button it will add a new button but for every time i press the button it will create a new button at another spot up to like 4 buttons.

Ok so far i got this going:

Code:
   Test 1
    Events
        Dialog - Any Dialog Item is Clicked by Player Any Player
    Local Variables
    Conditions
    Actions
        General - If (Conditions) then do (Actions) else do (Actions)
            If
                Dialog Button[Test] == Dialog Button[0]
            Then
                Dialog - Create a Button for Dialog Main Dialog with the dimensions (200, 50) anchored to Top Left with an offset of (50, 50) setting the tooltip to "" with button text "Test 1" and the hover image set to ""
                Variable - Modify Test: + 1
                Variable - Set Dialog Button[Test] = (Last created dialog item)
            Else
                General - If (Conditions) then do (Actions) else do (Actions)
                    If
                        Dialog Button[Test] == Dialog Button[1]
                    Then
                        Dialog - Create a Button for Dialog Main Dialog with the dimensions (200, 50) anchored to Bottom Right with an offset of (50, 50) setting the tooltip to "" with button text "Test 2" and the hover image set to ""
                        Variable - Modify Test: + 1
                        Variable - Set Dialog Button[Test] = (Last created dialog item)
                    Else
                        General - If (Conditions) then do (Actions) else do (Actions)
                            If
                                Dialog Button[Test] == Dialog Button[2]
                            Then
                                Dialog - Create a Button for Dialog Main Dialog with the dimensions (200, 50) anchored to Top Right with an offset of (50, 50) setting the tooltip to "" with button text "Test 3" and the hover image set to ""
                                Variable - Modify Test: + 1
                                Variable - Set Dialog Button[Test] = (Last created dialog item)
                            Else
                                General - If (Conditions) then do (Actions) else do (Actions)
                                    If
                                        Dialog Button[Test] == Dialog Button[3]
                                    Then
                                        Dialog - Create a Button for Dialog Main Dialog with the dimensions (200, 50) anchored to Right with an offset of (50, 50) setting the tooltip to "" with button text "Test 4" and the hover image set to ""
                                        Variable - Modify Test: + 1
                                        Variable - Set Dialog Button[Test] = (Last created dialog item)
                                    Else

Test 2
    Events
        Dialog - Any Dialog Item is Clicked by Player Any Player
    Local Variables
    Conditions
    Actions
        General - If (Conditions) then do (Actions) else do (Actions)
            If
                (Used dialog item) == Dialog Button[1]
            Then
                Dialog - Destroy Dialog Button[1]
            Else
        General - If (Conditions) then do (Actions) else do (Actions)
            If
                (Used dialog item) == Dialog Button[2]
            Then
                Dialog - Destroy Dialog Button[2]
            Else
        General - If (Conditions) then do (Actions) else do (Actions)
            If
                (Used dialog item) == Dialog Button[3]
            Then
                Dialog - Destroy Dialog Button[3]
            Else
        General - If (Conditions) then do (Actions) else do (Actions)
            If
                (Used dialog item) == Dialog Button[4]
            Then
                Dialog - Destroy Dialog Button[4]
            Else

so i got the press more then one time to create a button at another place going, but i dont know how to set it so when i destroy a button it will place the new button at that spot.
 

bobby5589

Member
Reaction score
15
How about you post the triggers you have so we can say what your doing wrong? It'll be better then someone writting up something new for ya.
 

SerraAvenger

Cuz I can
Reaction score
234
Here's a code example from my TeamLib library:
JASS:
int[31] libsatm_gv_FreeTeamIds;
bool[31] libsatm_gv_TeamActive;
int libsatm_gv_TeamsTotal;
int libsatm_gv_NextFreeTeam;

int libsatm_gf_TeamCreate () {
    // Variable Declarations
    int lv_team;

    // Variable Initialization
    lv_team = 0;

    // Implementation
    if (libsatm_gv_NextFreeTeam==-1) {
        libsatm_gv_TeamsTotal += 1;
        lv_team = libsatm_gv_TeamsTotal;
    }
    else{
        lv_team = libsatm_gv_FreeTeamIds[libsatm_gv_NextFreeTeam];
        libsatm_gv_NextFreeTeam -= 1;
    }
    libsatm_gv_TeamActive[lv_team]=true;
    return lv_team;
}


void libsatm_gf_DestroyTeam (int lp_team) {
    // Variable Declarations
    playergroup lv_group;

    // Variable Initialization
    lv_group = libsatm_gv_TeamPlayers[lp_team];

    // Implementation
    if (libsatm_gv_TeamActive[lp_team]) {
        libsatm_gv_TeamActive[lp_team] = false;
        libsatm_gv_NextFreeTeam += 1;
        libsatm_gv_FreeTeamIds[libsatm_gv_NextFreeTeam] = lp_team;
    }
}


Yeah, this doesn't create any dialogs, but it shows how to recycle array positions.
 

Muddis

New Member
Reaction score
0
i understand like 0% of that xD

I only got understanding of Triggering with Arry and no custom or prefix or what it's called
 

bobby5589

Member
Reaction score
15
Well, your issue is that once you creat the 4th button "test" = 4. So, when you go and create another button it won't create one because it's running through your first trigger looking for {Dialog Button[Test]} or {Dialog Button[4]} which you don't handle.

So, basicly, the button you deleted won't be replaced becuase you've already set "test" for the next button and after the fourth no more can be created becuase "test" is higher then the first trigger is looking for (ie it goes through all the if statements and nothing happens).
 

bobby5589

Member
Reaction score
15
I assume you want it to fill in, but not replace so a quick fix would be..

1. to set "test" to the lowest missing button when deleting. (ex. set test to 3 if test is > 3 )
2. when creating a button, first check if the button exists and if so increment test (a loop would clean up those ifs some)

If you have trouble doing that, I'll write it out for ya.
 

Muddis

New Member
Reaction score
0
This is what i got.

Code:
   Test 1
    Events
        Dialog - Any Dialog Item is Clicked by Player Any Player
    Local Variables
    Conditions
        (Used dialog item) == Dialog Button[0]
    Actions
        General - If (Conditions) then do (Actions) else do (Actions)
            If
                Dialog Button[Test] == Dialog Button[3]
            Then
                Dialog - Create a Button for Dialog Main Dialog with the dimensions (200, 50) anchored to Left with an offset of (0, 50) setting the tooltip to "" with button text "Test 4" and the hover image set to ""
                Variable - Modify Test: + 1
                Variable - Set Dialog Button[Test] = (Last created dialog item)
            Else
        General - If (Conditions) then do (Actions) else do (Actions)
            If
                Dialog Button[Test] == Dialog Button[2]
            Then
                Dialog - Create a Button for Dialog Main Dialog with the dimensions (200, 50) anchored to Top Right with an offset of (50, 50) setting the tooltip to "" with button text "Test 3" and the hover image set to ""
                Variable - Modify Test: + 1
                Variable - Set Dialog Button[Test] = (Last created dialog item)
            Else
        General - If (Conditions) then do (Actions) else do (Actions)
            If
                Dialog Button[Test] == Dialog Button[1]
            Then
                Dialog - Create a Button for Dialog Main Dialog with the dimensions (200, 50) anchored to Bottom Right with an offset of (50, 50) setting the tooltip to "" with button text "Test 2" and the hover image set to ""
                Variable - Modify Test: + 1
                Variable - Set Dialog Button[Test] = (Last created dialog item)
            Else
        General - If (Conditions) then do (Actions) else do (Actions)
            If
                Dialog Button[Test] == Dialog Button[0]
            Then
                Dialog - Create a Button for Dialog Main Dialog with the dimensions (200, 50) anchored to Top Left with an offset of (50, 50) setting the tooltip to "" with button text "Test 1" and the hover image set to ""
                Variable - Modify Test: + 1
                Variable - Set Dialog Button[Test] = (Last created dialog item)
            Else

   Test 2
       Events
        Dialog - Any Dialog Item is Clicked by Player Any Player
    Local Variables
    Conditions
        (Used dialog item) != Dialog Button[0]
        (Used dialog item) != Show/hide UI
    Actions
        General - If (Conditions) then do (Actions) else do (Actions)
            If
                (Used dialog item) == Dialog Button[1]
            Then
                Variable - Set Test = 0
            Else
        General - If (Conditions) then do (Actions) else do (Actions)
            If
                (Used dialog item) == Dialog Button[2]
            Then
                Variable - Set Test = 1
            Else
        General - If (Conditions) then do (Actions) else do (Actions)
            If
                (Used dialog item) == Dialog Button[3]
            Then
                Variable - Set Test = 2
            Else
        General - If (Conditions) then do (Actions) else do (Actions)
            If
                (Used dialog item) == Dialog Button[4]
            Then
                Variable - Set Test = 3
            Else
        Dialog - Destroy (Used dialog item)

The new problem is if i click Test 1 and 4 it will only redo the last button :S any way around that? and if you would like, i would love a example of Loops and if you do it with my trigger i would be endlessly grateful :D
 

bobby5589

Member
Reaction score
15
I'll go ahead and write it up for ya to see 'cause that's starting to look a bit messy. Give me a few mins to type and I'll edit this post. :D

[edit] I take back what I said 'bout the loop. Try this, it should do what you want and it's more like what you were trying to do first.

Create Dialog Button creates a button at the first DialogButton[#] that isn't assigned a button.

Delete Dialog Button deletes the button you press and sets DialogButton[#] equal to no button so if Create Dialog Button is run, that button will get created in the correct order if its empty.


Trigger:
  • DialogButton = No Dialog Item <Dialog Item[4]>



Trigger:
  • Create Dialog Button
    • Events
      • Dialog - Any Dialog Item is Clicked by Player Any Player
    • Actions
      • General - If (Conditions) then do (Actions) else do (Actions)
        • If
          • DialogButton[0] == No Dialog Item
        • Then
          • Dialog - Create a Button for Dialog ....
          • Variable - Set Dialog Button[0] = (Last created dialog item)
        • Else
          • General - If (Conditions) then do (Actions) else do (Actions)
            • If
              • DialogButton[1] == No Dialog Item
            • Then
              • Dialog - Create a Button for Dialog ....
              • Variable - Set Dialog Button[1] = (Last created dialog item)
            • Else
              • General - If (Conditions) then do (Actions) else do (Actions)
                • If
                  • DialogButton[2] == No Dialog Item
                • Then
                  • Dialog - Create a Button for Dialog ....
                  • Variable - Set Dialog Button[2] = (Last created dialog item)
                • Else
                  • General - If (Conditions) then do (Actions) else do (Actions)
                    • If
                      • DialogButton[3] == No Dialog Item
                    • Then
                      • Dialog - Create a Button for Dialog ....
                      • Variable - Set Dialog Button[3] = (Last created dialog item)
                      • Else




Trigger:
  • Delete Dialog Button
    • Events
      • Dialog - Any Dialog Item is Clicked by Player Any Player
    • Actions
      • General - If (Conditions) then do (Actions) else do (Actions)
        • If
          • (Used dialog item) == DialogButton[0]
        • Then
          • Dialog - Destroy (Used dialog item)
          • Variable - Set Dialog Button[0] = No Dialog Item
        • Else
          • General - If (Conditions) then do (Actions) else do (Actions)
            • If
              • (Used dialog item) == DialogButton[1]
            • Then
              • Dialog - Destroy (Used dialog item)
              • Variable - Set Dialog Button[1] = No Dialog Item
            • Else
              • General - If (Conditions) then do (Actions) else do (Actions)
                • If
                  • (Used dialog item) == DialogButton[2]
                • Then
                  • Dialog - Destroy (Used dialog item)
                  • Variable - Set Dialog Button[2] = No Dialog Item
                • Else
                  • General - If (Conditions) then do (Actions) else do (Actions)
                    • If
                      • (Used dialog item) == DialogButton[3]
                    • Then
                      • Dialog - Destroy (Used dialog item)
                      • Variable - Set Dialog Button[3] = No Dialog Item
                      • Else
 

Muddis

New Member
Reaction score
0
oh yeah. will this work with 2 players?

or do i need to do two dialogs? and only show them for player 1 - 2

Is there a way to make the button created to be random between like 10 diffrent buttons?
 

bobby5589

Member
Reaction score
15
You'll need the 2 dialogs and 2 "DialogButton = No Dialog Item <Dialog Item[4]>" or you can make it a 2D array (the next box under where you set it to 4), "DialogButton = No Dialog Item <Dialog Item[4][2]>

You should be able to it with just these 2 triggers, just check the player first if you do 2 DialogButtons or if you do the 2D array modify to the code to be something like " (Used dialog item) == DialogButton[0][((Triggering player) - 1]" and do that the whole way through. {I think Neutral is 0 and Player 1 is actually 1, not sure so you'll have to test it.}

[edit] If you wanted that their actions affect each other you only need one dialog. I assumed you wanted separate for each.
 

Muddis

New Member
Reaction score
0
yeah i was almost sure i neede two dialogs buy anyway. any way to make the button random? say i have Spawn Zealot and a Spawn Stalker. i dont want you to get the Spawn Zealot button all the time.

I'm making a map where you "draw" a Unit that you can play out on the battle field so i might have 30+ units and i want it to random between them.
 

bobby5589

Member
Reaction score
15
That would be so easy if you could convert Text to String, but you can't. :(

I can think of two ways to do it, 1. by getting the unit type from the dialog button image path and 2. by making a 2D/3D integer variable storing the dialogbutton/player and the unit type as an integer. As you can see, both are a bit complicated.

Which would you prefer? 1. Is more messy, but 2. (I'm pretty sure) takes up more file space allocated to code.

Either way, for the random button change "Dialog - Create a Button for Dialog ...." to create a different button based on a random integer. Something like "RandomInt = Math - Random int 0 to 30" followed up with yet more if statements. XP {It's messy in GUI, there's no IfElse in GUI that I know of}
 

Muddis

New Member
Reaction score
0
hmm... would it be much more easy if i would use a unit and add Abilitys to him and just forget the dialog idea? i just wanted the dialog to make it look nice :p
 

bobby5589

Member
Reaction score
15
I can't say, haven't done much with the data editor.

I can continue to help with the UI if you want. Hopefully Blizz. will add more supported things later, eh?
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/
  • The Helper The Helper:
    Decided to put up a healthier type recipe to mix it up - Honey Garlic Shrimp Stir-Fry https://www.thehelper.net/threads/recipe-honey-garlic-shrimp-stir-fry.193595/
  • The Helper The Helper:
    Here is another comfort food favorite - Million Dollar Casserole - https://www.thehelper.net/threads/recipe-million-dollar-casserole.193614/

      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