So I have a Dialog that has a button within it and my goal is to make it so that when I hit this button it hides the Dialog. No matter what I try this does not work. I know the Triggers are firing correctly because I have tried adding other actions both before and after the Hide statement and both work. Is it not possible to close a Dialog from "within" said Dialog? Does anyone have any advice they can give?
First, use a Set Variable action after the action that you used to create the dialog. Set it to a Dialog Variable. Then, when you want to hide it, use the Hide Dialog trigger and select the dialog variable.
If you've ever done that, upload the map so we can check for errors.
Yea I've done that a million times. I don't want to upload the map because there is a whole lot going on that might not make sense to others so ti would be hard to follow but here is the trigger so you can see what is happening
The Move statement is there as a debug statement to make sure I am referring to the correct Dialog and that the Trigger is firing correctly. It is working perfectly on both accounts so I have no idea why the Dialog will not hide itself.
I tested another scenario or two and it seems to me like it is not possible to close a dialog with a trigger that is activated by an item within said dialog. If anyone has any other information it would be greatly appreciated,
Dialog-CreateaModaldialogofsize(300,350)at(250,0)relativetoRightofscreenVariable-SetDevCardChoiceWindow=(Lastcreateddialog)Dialog-CreateabuttonfordialogDevCardChoiceWindowwiththedimensions(200,50)anchoredtoTopLeftwithanoffsetof(50,50)settingthetooltipto"Knight/Soldier - When played you mu..."withbuttontext"Knight"andthehoverimagesetto""Variable-SetDevCardChoices[0]=(Lastcreateddialogitem)Dialog-CreateabuttonfordialogDevCardChoiceWindowwiththedimensions(200,50)anchoredtoTopLeftwithanoffsetof(50,100)settingthetooltipto"Road Building - When you play this ..."withbuttontext"Road Building"andthehoverimagesetto""Variable-SetDevCardChoices[1]=(Lastcreateddialogitem)Dialog-CreateabuttonfordialogDevCardChoiceWindowwiththedimensions(200,50)anchoredtoTopLeftwithanoffsetof(50,150)settingthetooltipto"Year of Plenty - If you play this c..."withbuttontext"Year of Plenty"andthehoverimagesetto""Variable-SetDevCardChoices[2]=(Lastcreateddialogitem)Dialog-CreateabuttonfordialogDevCardChoiceWindowwiththedimensions(200,50)anchoredtoTopLeftwithanoffsetof(50,200)settingthetooltipto"Monopoly - If you play this card yo..."withbuttontext"Monopoly"andthehoverimagesetto""Variable-SetDevCardChoices[3]=(Lastcreateddialogitem)Dialog-CreateabuttonfordialogDevCardChoiceWindowwiththedimensions(200,50)anchoredtoTopLeftwithanoffsetof(50,250)settingthetooltipto"Victory Point - This card gives you..."withbuttontext"Victory Point"andthehoverimagesetto""Variable-SetDevCardChoices[4]=(Lastcreateddialogitem)Dialog-CreateabuttonfordialogDevCardChoiceWindowwiththedimensions(200,50)anchoredtoTopLeftwithanoffsetof(50,300)settingthetooltipto"Press this is if you do not want to..."withbuttontext"Cancel"andthehoverimagesetto""Variable-SetDevCardChoices[5]=(Lastcreateddialogitem)
I know I'm creating the button correctly because, as I said earlier, the other actions within the else if are firing correctly. It seems to me that it is just not possible to hide a dialog in Starcarft 2 with a Trigger activated by an item contained within that Dialog.
It seems to me that it is just not possible to hide a dialog in Starcarft 2 with a Trigger activated by an item contained within that Dialog.
It definitely is. Maybe the moving shows the dialog again? Try to move the hide to the bottom. However, you most likely tested without the move before, didn't you?
Otherwise add debug messages printing the variables (even though the working move suggests, there is nothing wrong with those). Uploading the map might help as well.
Else:
Are you sure that you aren't creating multiple instances of that dialog accidentally? So maybe one closes and you got a second one behind that does nothing because the button and dialog references were overwritten.
Thank you everyone for attempting to help. I don't know why, but it just started working. I haven't even made any major changes to how it worked. In any case, as long as its working I'm happy. Thanks again for the help and have a good one.
Just small note. in scenario like this as condition you can use "Dialog containing (used dialog item) == Dev Card Choice Window"
Also you can safely use "create button for last created dialog" unless you run multiple creation actions in own threads. Even then chance of overwriting 'last created' is minimal
You either create multiple of those windows or you have some trigger which Shows it again. There's no other option as Hide works with no issues. I use it all the time for 'X' close window buttons.
Also you can safely use "create button for last created dialog" unless you run multiple creation actions in own threads. Even then chance of overwriting 'last created' is minimal
Last Created functions in SC2 are local, no other thread has any influence on them
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
So I have a Dialog that has a button within it and my goal is to make it so that when I hit this button it hides the Dialog. No matter what I try this does not work. I know the Triggers are firing correctly because I have tried adding other actions both before and after the Hide statement and both work. Is it not possible to close a Dialog from "within" said Dialog? Does anyone have any advice they can give?
First, use a Set Variable action after the action that you used to create the dialog. Set it to a Dialog Variable. Then, when you want to hide it, use the Hide Dialog trigger and select the dialog variable.
If you've ever done that, upload the map so we can check for errors.
Post the code.
Yea I've done that a million times. I don't want to upload the map because there is a whole lot going on that might not make sense to others so ti would be hard to follow but here is the trigger so you can see what is happening
The Move statement is there as a debug statement to make sure I am referring to the correct Dialog and that the Trigger is firing correctly. It is working perfectly on both accounts so I have no idea why the Dialog will not hide itself.
I tested another scenario or two and it seems to me like it is not possible to close a dialog with a trigger that is activated by an item within said dialog. If anyone has any other information it would be greatly appreciated,
That trigger looks fine to me.
Can you show us the dialog's creation actions?
Maybe you only forgot to reference the 6th button.
This is the creation code...
I know I'm creating the button correctly because, as I said earlier, the other actions within the else if are firing correctly. It seems to me that it is just not possible to hide a dialog in Starcarft 2 with a Trigger activated by an item contained within that Dialog.
It definitely is. Maybe the moving shows the dialog again? Try to move the hide to the bottom. However, you most likely tested without the move before, didn't you?
Otherwise add debug messages printing the variables (even though the working move suggests, there is nothing wrong with those). Uploading the map might help as well.
What kueken said.
Else:
Are you sure that you aren't creating multiple instances of that dialog accidentally? So maybe one closes and you got a second one behind that does nothing because the button and dialog references were overwritten.
Thank you everyone for attempting to help. I don't know why, but it just started working. I haven't even made any major changes to how it worked. In any case, as long as its working I'm happy. Thanks again for the help and have a good one.
Just small note. in scenario like this as condition you can use "Dialog containing (used dialog item) == Dev Card Choice Window"
Also you can safely use "create button for last created dialog" unless you run multiple creation actions in own threads. Even then chance of overwriting 'last created' is minimal
You either create multiple of those windows or you have some trigger which Shows it again. There's no other option as Hide works with no issues. I use it all the time for 'X' close window buttons.
Last Created functions in SC2 are local, no other thread has any influence on them