HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Dialog button event

08-22-2003, 06:29 AM#1
Jatz
I'm creating a voting system that uses a dialog. However, I've encounted a problem with a dialog button setting off multiple triggers.

The first trigger is run when a player types a command. It creates the dialog and all the buttons, and assigns the button array to the buttons.

Create Dialog Trigger
Code:
Set bootVotePlayer = (Triggering player)
Dialog - Clear bootDialog
Dialog - Change the title of bootDialog to Select The Player To Boot
If ((Player 1 (Red) is in defenders) Equal to True) then do (Dialog - Create a dialog button for bootDialog labelled (Red -  + (Name of Player 1 (Red)))) else do (Do nothing)
Set bootBtn[1] = (Last created dialog Button)
If ((Player 2 (Blue) is in defenders) Equal to True) then do (Dialog - Create a dialog button for bootDialog labelled (Blue -  + (Name of Player 2 (Blue)))) else do (Do nothing)
Set bootBtn[2] = (Last created dialog Button)
.
.
.
and so on for all players

So for each player I have a trigger which records the vote to an array.

Boot Red Trigger
Code:
Events:
Dialog - A dialog button is clicked for bootDialog
Conditions:
(Clicked dialog button) Equal to bootBtn[1]
Action:
Set bootPref[(Player number of bootVotePlayer)] = 1
Trigger - Run Check Boot <gen> (ignoring conditions)

Boot Blue Trigger
Code:
Events:
Dialog - A dialog button is clicked for bootDialog
Conditions:
(Clicked dialog button) Equal to bootBtn[2]
Action:
Set bootPref[(Player number of bootVotePlayer)] = 2
Trigger - Run Check Boot <gen> (ignoring conditions)

My Check Boot Trigger simply does some counting to find the highest vote and removes the player.

However, for some reason, when I click on a dialog button to vote out the player, it seems cause more than one trigger to run. For instance, if I click on the Green button, it will run the Boot Green, Boot Pink, Boot Gray triggers. I only want it to run the Boot Green trigger. Strangely, if I click on Red, it seems to work fine.

I've tried turning off the other triggers, but it doesn't work - that is, other triggers still run.
08-22-2003, 06:44 AM#2
Jatz
Sorry guys, I figured it out. The Set bootBtn[x] commands should have been in the If statement as well.