Online Players Dialog

futeki

Active Member
Reaction score
4
Considering my other post was misunderstood awhile ago, I'm re-addressing this issue. I want the triggering player to be able to pick from a list of the online players (excluding themselves) and have that choice show.

This trigger works fine the first time it's launched, but for some reason, it shows 2 messages the second time, 3 the third. Perhaps I'm going about this the wrong way?

Trigger:
  • Dialog
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Rod Stewart's Hair Piece
    • Actions
      • Set OnlinePlayers = (All players matching (((Matching player) slot status) Equal to Is playing))
      • Set PlayersUser = (All players controlled by a User player)
      • Dialog - Clear PlayerDialog
      • Dialog - Change the title of PlayerDialog to Players
      • Player Group - Pick every player in OnlinePlayers and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked player) is in OnlinePlayers) Equal to True
              • ((Picked player) is in PlayersUser) Equal to True
              • (Picked player) Not equal to (Triggering player)
            • Then - Actions
              • Dialog - Create a dialog button for PlayerDialog labelled (Name of (Picked player))
              • Set PlayerDialogButton[(Player number of (Picked player))] = (Last created dialog Button)
            • Else - Actions
              • Do nothing
      • Dialog - Create a dialog button for PlayerDialog labelled Cancel
      • Dialog - Show PlayerDialog for (Triggering player)
      • Trigger - Add to Clicked <gen> the event (Dialog - A dialog button is clicked for PlayerDialog)
      • Item - Remove (Item being manipulated)

Second Trigger:
Trigger:
  • Clicked
    • Events
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Clicked dialog button) Equal to PlayerDialogButton[(Integer A)]
            • Then - Actions
              • Game - Display to (All players) the text: (You've chosen: + (Name of (Player((Integer A)))))
            • Else - Actions
 

Tyman2007

Ya Rly >.
Reaction score
74
Second Trigger:
Trigger:
  • Clicked
    • Events
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Clicked dialog button) Equal to PlayerDialogButton[(Integer A)]
            • Then - Actions
              • Game - Display to (All players) the text: (You've chosen: + (Name of (Player((Integer A)))))
            • Else - Actions

The problem lies in this trigger.

You see, every time this trigger is ran, it adds in a new event to a trigger. For every event that's ran, the actions will be ran.

So, if you have 5 of the same events, it will run the actions 5 times if the event has happened and the condition is met.

Unfortunately, WC3's limitation is that you cannot remove events. T.T
 

futeki

Active Member
Reaction score
4
The problem lies in this trigger.

You see, every time this trigger is ran, it adds in a new event to a trigger. For every event that's ran, the actions will be ran.

So, if you have 5 of the same events, it will run the actions 5 times if the event has happened and the condition is met.

Unfortunately, WC3's limitation is that you cannot remove events. T.T

So what's a solution? Should I be doing this differently?
 

Moridin

Snow Leopard
Reaction score
144
One way you could do it is, use a boolean condition to make sure that the event is only added once?

Replace this line:

Trigger - Add to Clicked <gen> the event (Dialog - A dialog button is clicked for PlayerDialog)

with this:

Code:
If (All conditions are true) then do (then actions) else do (else actions)
   If - Conditions
        Boolean_Event Equal to False
   then - actions
        Trigger - Add to Clicked <gen> the event (Dialog - A dialog button is clicked for PlayerDialog)
        Set Boolean_Event = True
   else - actions

You have to make sure that boolean variable is not used anywhere else.
 

futeki

Active Member
Reaction score
4
One way you could do it is, use a boolean condition to make sure that the event is only added once?
I wanted to make sure this was the best way possible to find the player clicked:
Trigger:
  • Clicked
    • Events
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Clicked dialog button) Equal to PlayerDialogButton[(Integer A)]
            • Then - Actions
              • Game - Display to (All players) the text: (You&#039;ve chosen: + (Name of (Player((Integer A)))))
            • Else - Actions

Using a conditional statement makes it unusable to another player down the road. This is a trigger that might be run 40-50 times during a game.
 

Moridin

Snow Leopard
Reaction score
144
Well, your current triggers should work fine :S. It should be able to run as many times as you want, as long as you use the same dialog variable.

The conditional statement won't make it unusable. It will only limit the number of events created. Because your event is a generic "A dialog button is clicked for PlayerDialog", as long as you keep using "PlayerDialog" it'll work fine.

Edit: Does it not work for some reason? :S

Also, yes that is the best way to find the dialog button clicked.
 

futeki

Active Member
Reaction score
4
Upon [expletive] around with it more, the solution was rather simple. Remove the manner in which the second trigger was fired.

Remove this in the Dialog trigger:
Trigger:
  • Trigger - Add to Clicked &lt;gen&gt; the event (Dialog - A dialog button is clicked for PlayerDialog)


Replace with this in the Clicked trigger:
Trigger:
  • Events
    • Dialog - A dialog button is clicked for PlayerDialog

Fires only once, no more double or triple firing, and now I can sleep peacefully tonight.

EDIT: type-toes
 

futeki

Active Member
Reaction score
4
What's a good way to use the dialog for other triggers?

I notice there's really no way to pass multiple variables through a single click, or is there that I'm missing?
 

Moridin

Snow Leopard
Reaction score
144
What's a good way to use the dialog for other triggers?
Could you elaborate? I don't exactly understand what you mean by this. What do you want to achieve?

I notice there's really no way to pass multiple variables through a single click, or is there that I'm missing?
Again, I don't know what you mean by 'passing multiple variables'.
 

futeki

Active Member
Reaction score
4
Could you elaborate? I don't exactly understand what you mean by this. What do you want to achieve?
For instance, say I want to reuse the Dialog of all online players for another trigger so I need to differentiate between the Clicked trigger and another trigger, say, Clicked 2 so that it doesn't fire off Clicked along with Clicked 2.

By what they're choosing here:
Trigger:
  • Then - Actions
    • Dialog - Create a dialog button for PlayerDialog labelled (Name of (Picked player))
    • Set PlayerDialogButton[(Player number of (Picked player))] = (Last created dialog Button)

It's passing the variable (Player Number) of that dialog button to the Clicked trigger. What if I want to use the dialog again for an entirely separate trigger? Make sense?
 

GenDeath

New Member
Reaction score
6
What's a good way to use the dialog for other triggers?
Assuming I understood what you meant.
I think dialog menus are good for "settings" I also find it a convenient route for managing alliances especially in a map with unique alliance settings.
 

futeki

Active Member
Reaction score
4
Assuming I understood what you meant.
I think dialog menus are good for "settings" i also find it a convenient route for managing alliances especially in a map with unique alliances
I meant to say "What's a good way to reuse the dialog for other triggers?"

But needless to say, I think it seems smarter to simply create new dialog variables rather than try reusing those dialog variables.
 

Moridin

Snow Leopard
Reaction score
144
It's passing the variable (Player Number) of that dialog button to the Clicked trigger. What if I want to use the dialog again for an entirely separate trigger? Make sense?
Yeah I get what you mean. You could switch off Clicked and switch on Clicked 2? There must be some condition which you can use to differentiate between using Clicked and Clicked 2...?
 

GenDeath

New Member
Reaction score
6
I didnt see the post between mine and moridin.
I believe the concept you were talking about will work. GL with your map.
 

futeki

Active Member
Reaction score
4
Yeah I get what you mean. You could switch off Clicked and switch on Clicked 2? There must be some condition which you can use to differentiate between using Clicked and Clicked 2...?
The turning off isn't going to work.

I've been trying to think of a way to set a condition, but that's where I'm drawing blanks. My first idea was to create another dialog button variable, set that to 1 and then look for that in the Clicked trigger, but there's obviously a big issue, the loop. It would reset the variable for each player as it goes through all of the players, making it a waste of time.

The other ideas I had would involve more variables than the 2 it takes every time I create another online players dialog, and considering I would at most use the dialog 3-4 more times it just doesn't seem worth it.
 

Moridin

Snow Leopard
Reaction score
144
You could create another dialog variable while using the same dialog buttons? That way you have seperate events?
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top