You may have seen this topic before. I don't know, but I can't find anything on it, so I'm going to ask nicely for help in my own post. I'm working on a cool idea that includes a complicated chat system that apperently needs dialogs. However, after I copied a tutorial to try and make a dialog and see if it even worked, I met a HUGE problem. The dialog doesn't even show up at map start. The triggers look like this.
Event: Map initialization
UI- create tip (Not important)
Camera- Pan camera (Not important)
Camera - Follow units for player 1 (Not important)
Dialog - Create a Modal dialog of size (500, 400) at (0, 0) relative to Center of screen.
Variable - Set DialogVariableA = (Last Created Dialog)
Dialog - Set title of DialogVariableA to "Name"
Camera - Lock Camera input for Player 1
That's it. I have no idea what is wrong with it since it looks exactly the same as many others. It's either a simple something that I didn't see or a very complicated problem that I can't fix. Fingers crossed on something simple that I missed. :D
My original problem was the dialog wasn't showing up. Now my new problem is how to save my buttons differently. Currently, it saves all my buttons to like 5 seperate spots in a data table. But, it saves last created button inbetween each button creation. EX:
Create button blah blah
Save (Last created button) as blah blah blah
Create button blah blah
Save (Last created button) as blah blah blah
Create button blah blah
Save (Last created button) as blah blah blah
...like that. I want to know if there is another way to save them so when I press a button, it doesn't react as if all of the buttons are being pressed. Does anyone have any ideas?
The save last created thing should work just fine, what exactly is the issue when you do it that way?
You can always do this in script, though, there a button is only an integer , which is returned by the create function and can be stored in the data table directly without using the last created button (but it should be the same thing)
I think it's better to store the buttons as a variable, not as an entry in a data table.
In the trigger with your button event you basically have to use conditions or if-clauses to see what button has been pressed:
Event:-ButtonpressedCondition:-Triggeredbutton==BUTTON_1<=thisisavariable--OR--Event:-ButtonpressedCondition:LocalVariables:-RealButton=0<integer>Action:Foreachnumberxbetween1and5do:If(Triggeredbutton==BUTTOn[x]) then
set RealButton = x
Endif
Thanks. I'll try everything I can to get this all fixed. I really want to show everyone my shops for my complicated chat demo as well as an easy way to talk to quest givers. I'll see if those work and reply again.
Ok, this problem is much more difficult than I thought. I tried everything. I even tried making each button a fraction of the original size and make conditions that register it, but it still behaves as if I clicked all the buttons at once. I'm posting up the map now to see if anyone can figure out what's wrong. :(
€ 3 of the 5 triggers I looked at react to the "Relative dialog item of Dialog Save Name 2 for 1"-Button. Of course they will all trigger at the same time ;)
€ ah, I think I found the issue. Triggers get initialized before the game starts. All your variables are 0 at that point, so all your triggers point to 0 as well. Then you set the variables, but that does not affect the triggers anymore.
just from the looks of it, I agree with s3rius. I would really recommend using global variables. And use easy distinguishable names or you will just confuse yourself.
Theres a library hosted on here that is basically a chat window created from dialogs, and it is repositionable.
BTW I find it extremely hard to find Librarys on the site......... we seriously need some better search functionality, as well as more areas of the site to list such things under. The map hosting sucks imo.
Rollback Post to RevisionRollBack
Skype
KageNinpo = SN
My Libraries
DialogLeaderboard & TeamSort
My Projects
SPACEWAR Tribute
Infinite TD
Oh, those are supposed to be the same. My only problem is it seems to save each button to all the variables instead of what I told it to do. I hust don't get it. Nothing is wrong with the F-ing chat triggers. It's the Start of game trigger. I'll go and see if I can organize my triggers better, but I don't think that's the problem. :(
Like edited, I think the problem is the event. You want the trigger to react to the buttons, but the triggers get initialized before the game starts and the buttons get set after the game starts, but this does not affect the triggers anymore. So they all react to button 0 (because dialog items are just integers, so the dialog item variables all are 0 when the triggers are initialized, and so are the relative items you register the events for).
If you want the triggers react for the single buttons, you need to use galaxy script; otherwise you need to react to all buttons and use conditions to check, which button was clicked.
Oh, those are supposed to be the same. My only problem is it seems to
save each button to all the variables instead of what I told it to do. I
hust don't get it. Nothing is wrong with the F-ing chat triggers. It's
the Start of game trigger. I'll go and see if I can organize my triggers
better, but I don't think that's the problem. :(
Try this....
Global Variables
MyDialog (type:dialog)
MyDialogButton01 (type:dialogbutton) cant remember if you can select dialog button as a variable type if not use "dialogitem"
MyDialogButton02 (type:dialogbutton)
MyDialogButton03 (type:dialogbutton)
Initialize Dialog Trigger
Events
Time elapsed 1 second
Actions
Create Dialog
Set variable(MyDialog) = last created dialog
Create Dialog Button for MyDialog
Set variable(MyDialogButton01) = last created dialog item
Create Dialog Button for MyDialog
Set variable(MyDialogButton02) = last created dialog item
Create Dialog Button for MyDialog
Set variable(MyDialogButton03) = last created dialog item
DialogButtonHandler
Events
UI - Any User clicks any dialog button
conditions
Actions
Switch (triggering dialog item)
if MyDialogButton01
Do stuff for MyDialogButton01
if MyDialogButton02
Do stuff for MyDialogButton02
if MyDialogButton03
Do stuff for MyDialogButton03
This requires GLOBAL variables and two seperate triggers. One trigger for setting up your dialogs, and another for processing thier clicks. I have several dialogs on my map that I use and I set all my dialogs up from one trigger. I process the clicks from all of my dialogs with one trigger.
Its just a good idea to seperate them. You can make it so the code that runs from the switch statement calls other function/actions and passes parameters. Its very customizable way to go about it.
You may have seen this topic before. I don't know, but I can't find anything on it, so I'm going to ask nicely for help in my own post. I'm working on a cool idea that includes a complicated chat system that apperently needs dialogs. However, after I copied a tutorial to try and make a dialog and see if it even worked, I met a HUGE problem. The dialog doesn't even show up at map start. The triggers look like this.
Event: Map initialization
UI- create tip (Not important)
Camera- Pan camera (Not important)
Camera - Follow units for player 1 (Not important)
Dialog - Create a Modal dialog of size (500, 400) at (0, 0) relative to Center of screen.
Variable - Set DialogVariableA = (Last Created Dialog)
Dialog - Set title of DialogVariableA to "Name"
Camera - Lock Camera input for Player 1
That's it. I have no idea what is wrong with it since it looks exactly the same as many others. It's either a simple something that I didn't see or a very complicated problem that I can't fix. Fingers crossed on something simple that I missed. :D
dialog - show dialog "dialogvariableA"
Hey, thanks for the help. I never thought to do that. Thank you very much. :D
My original problem was the dialog wasn't showing up. Now my new problem is how to save my buttons differently. Currently, it saves all my buttons to like 5 seperate spots in a data table. But, it saves last created button inbetween each button creation. EX:
Create button blah blah
Save (Last created button) as blah blah blah
Create button blah blah
Save (Last created button) as blah blah blah
Create button blah blah
Save (Last created button) as blah blah blah
...like that. I want to know if there is another way to save them so when I press a button, it doesn't react as if all of the buttons are being pressed. Does anyone have any ideas?
The save last created thing should work just fine, what exactly is the issue when you do it that way?
You can always do this in script, though, there a button is only an integer , which is returned by the create function and can be stored in the data table directly without using the last created button (but it should be the same thing)
@yukaboy: Go
I think it's better to store the buttons as a variable, not as an entry in a data table.
In the trigger with your button event you basically have to use conditions or if-clauses to see what button has been pressed:
'scuse the pseudo code. But that's the idea.
@Kueken531: Go
@s3rius: Go
Thanks. I'll try everything I can to get this all fixed. I really want to show everyone my shops for my complicated chat demo as well as an easy way to talk to quest givers. I'll see if those work and reply again.
Ok, this problem is much more difficult than I thought. I tried everything. I even tried making each button a fraction of the original size and make conditions that register it, but it still behaves as if I clicked all the buttons at once. I'm posting up the map now to see if anyone can figure out what's wrong. :(
I will have a look at the map.
€ 3 of the 5 triggers I looked at react to the "Relative dialog item of Dialog Save Name 2 for 1"-Button. Of course they will all trigger at the same time ;)
Might I ask where you found those? Perhaps a picture or something?
€ ah, I think I found the issue. Triggers get initialized before the game starts. All your variables are 0 at that point, so all your triggers point to 0 as well. Then you set the variables, but that does not affect the triggers anymore.
just from the looks of it, I agree with s3rius. I would really recommend using global variables. And use easy distinguishable names or you will just confuse yourself.
Theres a library hosted on here that is basically a chat window created from dialogs, and it is repositionable.
BTW I find it extremely hard to find Librarys on the site......... we seriously need some better search functionality, as well as more areas of the site to list such things under. The map hosting sucks imo.
@Kueken531: Go
Oh, those are supposed to be the same. My only problem is it seems to save each button to all the variables instead of what I told it to do. I hust don't get it. Nothing is wrong with the F-ing chat triggers. It's the Start of game trigger. I'll go and see if I can organize my triggers better, but I don't think that's the problem. :(
Like edited, I think the problem is the event. You want the trigger to react to the buttons, but the triggers get initialized before the game starts and the buttons get set after the game starts, but this does not affect the triggers anymore. So they all react to button 0 (because dialog items are just integers, so the dialog item variables all are 0 when the triggers are initialized, and so are the relative items you register the events for).
If you want the triggers react for the single buttons, you need to use galaxy script; otherwise you need to react to all buttons and use conditions to check, which button was clicked.
Try this....
Global Variables
Initialize Dialog Trigger
DialogButtonHandler
This requires GLOBAL variables and two seperate triggers. One trigger for setting up your dialogs, and another for processing thier clicks. I have several dialogs on my map that I use and I set all my dialogs up from one trigger. I process the clicks from all of my dialogs with one trigger.
Its just a good idea to seperate them. You can make it so the code that runs from the switch statement calls other function/actions and passes parameters. Its very customizable way to go about it.
@SouLCarveRR: Go
OMG!!! YOU ARE A MAGE DUDE! IT TOTALLY WORKS! :D THANK YOU THANK YOU THANK YOU! I LOVE YOU MAN! :D
I believe the term is "God" but glad it worked for you.
I think Ive written those triggers out like 20 times now on the site. Wish the search functionality was a bit better.
@SouLCarveRR: Go
Me too. :(