HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Auto Choose a Dialog Button?

01-11-2006, 10:04 AM#1
StRoNgFoE_2000
Hello again everyone. I am faced with my last problem and that is to auto choose a dialog setting after lets say, 10 seconds. What makes it tricky is that when one selection is made, it goes to the next dialog window, and then the next. So the first menu pops up, after 10 seconds it chooses a selection, next window pops up, after 10 seconds chooses a selection. I have been monkeying around with it and I can't seem to find a solution. Any ideas? Here are my triggers (very long, sorry)


Trigger:
Events:
Time - Elapsed game time is 0.40 seconds
Actions:
Dialog - Change the title of SetupDialog to How many lives shal...
Dialog - Change the title of SetupDialog2 to Player 1 is picking...
Dialog - Create a dialog button for SetupDialog labelled 15 Lives
Set DialogEntry[1] = (Last created dialog Button)
Dialog - Create a dialog button for SetupDialog labelled 25 Lives
Set DialogEntry[2] = (Last created dialog Button)
Dialog - Create a dialog button for SetupDialog labelled 35 Lives
Set DialogEntry[3] = (Last created dialog Button)
Dialog - Create a dialog button for SetupDialog labelled 45 Lives
Set DialogEntry[4] = (Last created dialog Button)
Set SetupStep = 2
Player Group - Pick every player in PlayerStartups1 and do (Dialog - Show SetupDialog for (Picked player))
Player Group - Pick every player in PlayerStartups2 and do (Dialog - Show SetupDialog2 for (Picked player))

>>>In the above trigger PlayerStartups is a player group for the first available player from team 1, in which I didn't post that trigger because it is irrelevant to my problem. PlayerStartups2 is a player group for everyone else in the game, so a buttonless dialogue will pop up for them saying that player X is picking the settings, and player X gets the button choosing one. I left some of the actions not relating to the dialoge out of the triggers below (dont worry, they don't affect the dialogs).

Trigger:
Events:
Dialog - A dialog button is clicked for SetupDialog
Conditions:
SetupStep Equal to 2
Actions:
If ((Clicked dialog button) Equal to DialogEntry[1]) then do (Set Lives = 15) else do (Do nothing)
If ((Clicked dialog button) Equal to DialogEntry[2]) then do (Set Lives = 25) else do (Do nothing)
If ((Clicked dialog button) Equal to DialogEntry[3]) then do (Set Lives = 35) else do (Do nothing)
If ((Clicked dialog button) Equal to DialogEntry[4]) then do (Set Lives = 45) else do (Do nothing)
Trigger - Run Game Chooser <gen> (checking conditions)
>>>In the above trigger: These of course, are (one of) the actions I want to perform automatically after like 10 seconds.

Trigger:
Game Chooser
Actions:
Dialog - Clear SetupDialog
Dialog - Change the title of SetupDialog to Choose the mode of ...
Dialog - Create a dialog button for SetupDialog labelled Classic Mode
Set DialogEntry[1] = (Last created dialog Button)
Dialog - Create a dialog button for SetupDialog labelled Lifesteal Mode
Set DialogEntry[2] = (Last created dialog Button)
Dialog - Create a dialog button for SetupDialog labelled Penalty Mode
Set DialogEntry[3] = (Last created dialog Button)
And some more choices....
Set SetupStep = 3
Player Group - Pick every player in PlayerStartups1 and do (Dialog - Show SetupDialog for (Picked player))
>>>In the above trigger: Now this is the tricky part. I want the next part of the dialog to pop up after the selection is automatically made.

Trigger:
Events:
Dialog - A dialog button is clicked for SetupDialog
Conditions:
SetupStep Equal to 3
Actions:
If ((Clicked dialog button) Equal to DialogEntry[1]) then do (Trigger - Run ClassicModeSet <gen> (ignoring conditions)) else do (Do nothing)
>>>In the above trigger: And a couple more of the above actions for each game mode to run the appropriate trigger.


So the below trigger is assuming "classic mode" was selected:
Trigger:
Actions:
Set Classic = True
Game - Display to (All players) the text: |c0000ff00Classic M...
Player Group - Pick every player in PlayerStartups2 and do (Dialog - Hide SetupDialog2 for (Picked player))
Dialog - Clear SetupDialog
Dialog - Clear SetupDialog2
Custom script: call DestroyForce( udg_PlayerStartups1 )
Custom script: call DestroyForce( udg_PlayerStartups2 )
Trigger - Destroy (This trigger)
>>>In the above trigger: And this would be the final part of the trigger to run, or at least some of the actions from it such as to destroy the player groups and to hide the dialog, especially for PlayerStartups2.


The main problem is I want the guy from PlayerStartups1 to auto-pick the options automatically if he is AFK. This way the game gets to go and everyone doesn't have to hit Alt+F4 to leave the game because the dialog box for PlayerStartups2 doesn't disappear until the selections are made.

I don't want to use pause the game instead of the second dialog because I want stuff to happen while Player X is choosing, and it adds a little class of not seeing the game paused everytime you play. Also, I want the second dialog to pop up because I don't want any of the other players doing anything until all of the options are made. Any help will be greatly appreciated!

Edit: Also, just out of curiosity.. Is there a tag or whatever you call it to center text? Such as how |n is used as a line break and |c is used as color .
01-11-2006, 04:02 PM#2
HEZZA
You dont need to have an auto choose dialog button tbh. If no option is clicked and the 30 seconds up, use triggers to determain the choice, but have your "dialog button is pressed" triggers in the ready, and turn them off at the cut off time.
01-11-2006, 10:44 PM#3
StRoNgFoE_2000
This is what I ended up doing and it works flawlessly so far. Is there any problem with the way I set this up? I posted my entire triggers this time. I just used a global boolean variable to run the rest of a trigger if a button does not set it true.

Trigger:
Lives Chooser
Collapse Events
Time - Elapsed game time is 0.40 seconds
Conditions
Collapse Actions
Dialog - Change the title of SetupDialog to How many lives shal...
If ((Random player from PlayerStartups1) Equal to Player 1 (Red)) then do (Dialog - Change the title of SetupDialog2 to ( Player: |c00ff0000 + ((Name of (Random player from PlayerStartups1)) + (|r + |n|nWill choose the game settings.)))) else do (If ((Random player from PlayerStartups1) Equal to Player 2 (Blue)) then do (Dialog - Change the title of SetupDialog2 to ( Player: |c000000ff + ((Name of (Random player from PlayerStartups1)) + (|r + |n|nWill choose the game settings.)))) else do (If ((Ra
Dialog - Create a dialog button for SetupDialog labelled 15 Lives
Set SetupDialogEntries[1] = (Last created dialog Button)
Dialog - Create a dialog button for SetupDialog labelled 25 Lives
Set SetupDialogEntries[2] = (Last created dialog Button)
Dialog - Create a dialog button for SetupDialog labelled 35 Lives
Set SetupDialogEntries[3] = (Last created dialog Button)
Dialog - Create a dialog button for SetupDialog labelled 45 Lives
Set SetupDialogEntries[4] = (Last created dialog Button)
Set SetupStep = 2
Player Group - Pick every player in PlayerStartups1 and do (Dialog - Show SetupDialog for (Picked player))
Player Group - Pick every player in PlayerStartups2 and do (Dialog - Show SetupDialog2 for (Picked player))
If ((Player 1 (Red) slot status) Equal to Is playing) then do (Set Income[1] = 30) else do (Do nothing)
If ((Player 2 (Blue) slot status) Equal to Is playing) then do (Set Income[2] = 30) else do (Do nothing)
If ((Player 3 (Teal) slot status) Equal to Is playing) then do (Set Income[3] = 30) else do (Do nothing)
If ((Player 4 (Purple) slot status) Equal to Is playing) then do (Set Income[4] = 30) else do (Do nothing)
If ((Player 5 (Yellow) slot status) Equal to Is playing) then do (Set Income[5] = 30) else do (Do nothing)
If ((Player 6 (Orange) slot status) Equal to Is playing) then do (Set Income[6] = 30) else do (Do nothing)
Set TotalIncome1 = (Income[1] + (Income[2] + Income[3]))
Set TotalIncome2 = (Income[4] + (Income[5] + Income[6]))
Leaderboard - Change the value for Player 2 (Blue) in (Last created leaderboard) to TotalIncome1
Leaderboard - Change the value for Player 8 (Pink) in (Last created leaderboard) to TotalIncome2
Wait 11.00 seconds
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
GameSet[1] Equal to True
Collapse Then - Actions
Do nothing
Collapse Else - Actions
Set LivesF1 = 35
Set LivesF2 = 35
Leaderboard - Change the value for Player 11 (Dark Green) in (Last created leaderboard) to LivesF1
Leaderboard - Change the value for Player 12 (Brown) in (Last created leaderboard) to LivesF2
Game - Display to (All players) the text: Both teams will sta...
Trigger - Run Game Chooser <gen> (checking conditions)
Trigger - Destroy Initiation <gen>
Trigger:
Lives Set
Collapse Events
Dialog - A dialog button is clicked for SetupDialog
Collapse Conditions
SetupStep Equal to 2
Collapse Actions
If ((Clicked dialog button) Equal to SetupDialogEntries[1]) then do (Set LivesF1 = 15) else do (Do nothing)
If ((Clicked dialog button) Equal to SetupDialogEntries[1]) then do (Set LivesF2 = 15) else do (Do nothing)
If ((Clicked dialog button) Equal to SetupDialogEntries[1]) then do (Game - Display to (All players) for 4.00 seconds the text: Both teams will sta...) else do (Do nothing)
If ((Clicked dialog button) Equal to SetupDialogEntries[2]) then do (Set LivesF1 = 25) else do (Do nothing)
If ((Clicked dialog button) Equal to SetupDialogEntries[2]) then do (Set LivesF2 = 25) else do (Do nothing)
If ((Clicked dialog button) Equal to SetupDialogEntries[2]) then do (Game - Display to (All players) for 4.00 seconds the text: Both teams will sta...) else do (Do nothing)
If ((Clicked dialog button) Equal to SetupDialogEntries[3]) then do (Set LivesF1 = 35) else do (Do nothing)
If ((Clicked dialog button) Equal to SetupDialogEntries[3]) then do (Set LivesF2 = 35) else do (Do nothing)
If ((Clicked dialog button) Equal to SetupDialogEntries[3]) then do (Game - Display to (All players) for 4.00 seconds the text: Both teams will sta...) else do (Do nothing)
If ((Clicked dialog button) Equal to SetupDialogEntries[4]) then do (Set LivesF1 = 45) else do (Do nothing)
If ((Clicked dialog button) Equal to SetupDialogEntries[4]) then do (Set LivesF2 = 45) else do (Do nothing)
If ((Clicked dialog button) Equal to SetupDialogEntries[4]) then do (Game - Display to (All players) for 4.00 seconds the text: Both teams will sta...) else do (Do nothing)
Leaderboard - Change the value for Player 11 (Dark Green) in (Last created leaderboard) to LivesF1
Leaderboard - Change the value for Player 12 (Brown) in (Last created leaderboard) to LivesF2
Trigger - Run Game Chooser <gen> (checking conditions)
Set GameSet[1] = True
Trigger - Destroy Lives Chooser <gen>
Trigger:
Game Chooser
Events
Conditions
Collapse Actions
Dialog - Clear SetupDialog
Dialog - Change the title of SetupDialog to Choose the mode of ...
Dialog - Create a dialog button for SetupDialog labelled Classic Mode
Set SetupDialogEntries[1] = (Last created dialog Button)
Dialog - Create a dialog button for SetupDialog labelled Lifesteal Mode
Set SetupDialogEntries[2] = (Last created dialog Button)
Dialog - Create a dialog button for SetupDialog labelled Penalty Mode
Set SetupDialogEntries[3] = (Last created dialog Button)
Dialog - Create a dialog button for SetupDialog labelled HyperSpeed Mode
Set SetupDialogEntries[4] = (Last created dialog Button)
Dialog - Create a dialog button for SetupDialog labelled Greed Mode
Set SetupDialogEntries[5] = (Last created dialog Button)
Dialog - Create a dialog button for SetupDialog labelled Double Mayhem
Set SetupDialogEntries[6] = (Last created dialog Button)
Dialog - Create a dialog button for SetupDialog labelled Total Chaos
Set SetupDialogEntries[7] = (Last created dialog Button)
Set SetupStep = 3
Player Group - Pick every player in PlayerStartups1 and do (Dialog - Show SetupDialog for (Picked player))
Wait 11.00 seconds
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
GameSet[2] Equal to True
Collapse Then - Actions
Do nothing
Collapse Else - Actions
Trigger - Run ClassicModeSet <gen> (ignoring conditions)
Player Group - Pick every player in PlayerStartups1 and do (Dialog - Hide SetupDialog for (Picked player))
Game - Display to (All players) the text: (|c00ff0000 + ((Name of (Random player from PlayerStartups1)) + (|r + was AFK so these settings were automatically chosen.)))
Trigger - Destroy Lives Set <gen>
Trigger:
Game Set
Collapse Events
Dialog - A dialog button is clicked for SetupDialog
Collapse Conditions
SetupStep Equal to 3
Collapse Actions
If ((Clicked dialog button) Equal to SetupDialogEntries[1]) then do (Trigger - Run ClassicModeSet <gen> (ignoring conditions)) else do (Do nothing)
If ((Clicked dialog button) Equal to SetupDialogEntries[2]) then do (Trigger - Run LifestealModeSet <gen> (ignoring conditions)) else do (Do nothing)
If ((Clicked dialog button) Equal to SetupDialogEntries[3]) then do (Trigger - Run PenaltyModeSet <gen> (ignoring conditions)) else do (Do nothing)
If ((Clicked dialog button) Equal to SetupDialogEntries[4]) then do (Trigger - Run HyperSpeedModeSet <gen> (ignoring conditions)) else do (Do nothing)
If ((Clicked dialog button) Equal to SetupDialogEntries[5]) then do (Trigger - Run GreedyModeSet <gen> (ignoring conditions)) else do (Do nothing)
If ((Clicked dialog button) Equal to SetupDialogEntries[6]) then do (Trigger - Run DoubleMayhemSet <gen> (ignoring conditions)) else do (Do nothing)
If ((Clicked dialog button) Equal to SetupDialogEntries[7]) then do (Trigger - Run Total Choas Chooser <gen> (ignoring conditions)) else do (Do nothing)
Set GameSet[2] = True
Trigger - Destroy Game Chooser <gen>
Trigger:
ClassicModeSet
Events
Conditions
Collapse Actions
Game - Display to (All players) the text: |c0000ff00Classic M...
Player Group - Pick every player in PlayerStartups2 and do (Dialog - Hide SetupDialog2 for (Picked player))
Dialog - Clear SetupDialog
Dialog - Clear SetupDialog2
Leaderboard - Change the label for Player 4 (Purple) in (Last created leaderboard) to |c0000ff00Classic...
Leaderboard - Change the display style for Player 4 (Purple) in (Last created leaderboard) to Show the label, Hide the value, and Hide the icon
Trigger - Run Game Start <gen> (ignoring conditions)
Wait 0.30 seconds
Trigger - Run Units Update<gen> (ignoring conditions)
Wait 0.30 seconds
Trigger - Run Quest Log <gen> (ignoring conditions)
Custom script: call DestroyForce( udg_PlayerStartups1 )
Custom script: call DestroyForce( udg_PlayerStartups2 )
Trigger - Destroy Game Set <gen>
Trigger - Destroy (This trigger)
01-12-2006, 07:32 PM#4
johnfn
It's very difficult to figure out bugs just by looking at code (imagine how good we'd all be at it if we could do THAT) but if you encounter any I'd be glad to help ^^