A bug with the dialogues

Started by BlackBaron, Sun 04/01/2004 21:58:20

Previous topic - Next topic

BlackBaron

Here's something wierd I've noticed, it's not a big flaw since there's a very simple way to avoid it, but it may turn out to be useful to know why it happens.

I activate the option "Dialog options on GUI" and I set GUI number 2 for that in General Settings.

I don't want the GUI to be "on" until the character says the first lines, so I first call the the "rundialog" function and inside the dialog script I call the "run-script" function to turn on the appropiate GUI.

Now, it turns out that if the "Visible" property of the GUI is set on "Popup Modal", then, after I activate it with the "run-script" function the character stops using its talking animations; it just stands there, using the first sprite of the appropiate view, without changing, while the dialog continues normally.

If I set the "Visible" property of the dialogue GUI to "Normal" (and I turn it off in the "game_start" function), that doesn't happen, i.e. I can use "run-script" to turn on the GUI and the animations go on normally.

I think is also wierd that only the animation seems to be affected.

Could anyone else try to see if it is just my game?

As I say, is really easy to work around that bug, but I think it shouldn't happen.

I hope this can be useful to someone.

Thanks, cya.
"Do you thirst for knowledge no matter the cost?"
            -Watrik, master glassblower

Ryukage

The bug isn't in AGS, it's in your script.  You don't need to turn the dialog GUI on and off manually, just set it's display to 'normal' and AGS will do it for you.  By doing it manually, you're probably short-circuiting the engine and causing the animation blockage.

Scorpiorus

The thing is a pop-up modal GUI pauses the game (if was displayed by GuiOn) and thereby blocks an animation but what if you leave it as pop-up modal but remove the run-script at all? As Ryukage says, AGS maybe doesn't assume you to trigger dialog gui manually but performs it regarding the engine's internal mechanism bypassing GUIs visible setting.

~Cheers

BlackBaron

I see your point, if I set the dialog GUI's display to 'normal' and avoid turning it on and off manually, yes, indeed nothing anormal happens (I still have to turn it off when the game starts).

The thing is I WANT to have control on when the dialog GUI is on and when it's off and all I'm pointig out is that if you try to do that setting the GUI's display on "Popup Modal" you can't.

It's indeed a bug in my script since I'm trying to do something the wrong way, I'm just pointing it out so other people don't make the same mistake (since it wasn't obvious to me at all that all I had to do was changing the GUI's display from "Popup Modal" to "Normal").
"Do you thirst for knowledge no matter the cost?"
            -Watrik, master glassblower

Scorpiorus

Quote from: BlackBaron on Tue 06/01/2004 15:08:52
I see your point, if I set the dialog GUI's display to 'normal' and avoid turning it on and off manually, yes, indeed nothing anormal happens (I still have to turn it off when the game starts).
Yeah, right if it's set to normal you need to turn it off on game start. But what if you set it to pop modal but won't control the GUI through the script at all, it should work, right? If not then it's a bug probably.

QuoteThe thing is I WANT to have control on when the dialog GUI is on and when it's off and all I'm pointig out is that if you try to do that setting the GUI's display on "Popup Modal" you can't.
I see. Btw, you say:
QuoteI don't want the GUI to be "on" until the character says the first lines, so I first call the the "rundialog" function and inside the dialog script I call the "run-script" function to turn on the appropiate GUI.
So, maybe I don't understand it right but if you want some speech to be displayed before dialog options are shown you can put in the dialog script:
@S
ego: "blah"
man: "blah"
return

Doesn't it work as you want?

QuoteIt's indeed a bug in my script since I'm trying to do something the wrong way, I'm just pointing it out so other people don't make the same mistake (since it wasn't obvious to me at all that all I had to do was changing the GUI's display from "Popup Modal" to "Normal").
Yes, thanks for pointing it out. It's really not that evident. ;)

~Cheers

BlackBaron

Quote from: Scorpiorus on Tue 06/01/2004 15:24:18
Yeah, right if it's set to normal you need to turn it off on game start. But what if you set it to pop modal but won't control the GUI through the script at all, it should work, right? If not then it's a bug probably.

Yes, if I set the GUI to pop modal and I don't control it through the script at all, it works indeed.

Quote from: Scorpiorus on Tue 06/01/2004 15:24:18
So, maybe I don't understand it right but if you want some speech to be displayed before dialog options are shown you can put in the dialog script:
@S
ego: "blah"
man: "blah"
return

Doesn't it work as you want?

That doesn't do exactly what I want.
If I do that, the dialog starts (dialog GUI off), Ego says "blah", man says "blah" and then dialog GUI turns on and I get to choose the options, but after I select an option and they start talking again, the GUI turns off, but I want it to stay on.
I actually have 2 GUIs: one "main" GUI, for normal play (GUI 1), and dialog GUI (GUI 2)
and what I want is pretty much like this:
Ego chooses to talk to man, ego goes to where man is, ego says "blah", man says "blah", GUI 1 turns off, GUI 2 turns on, I select my option, they keep talking with GUI 2 on, the dialog ends, GUI 2 turns off, if needed, ego says an extra line and, finally, GUI 1 turns on and gameplay turns back to normal.

I said what I said in my previews post because if I try to keep GUI 2 on all through the dialog by turning it on before it starts, I have it on when the chars say their first lines and, as I said, that's not what I want.


Thanks for the replies.

P.S.
I found a way to do what I want (it may not be the most efficient way, but it works fine) and I don't think I need any help there (for now, at least), I'm just posting this to answer Scorpiorus, but thanks anyway, I appreciate your concern.
"Do you thirst for knowledge no matter the cost?"
            -Watrik, master glassblower

a-v-o

Hello BlackBaron,

can you please post your solution because I'm looking for the same effect (dialog GUI is on during the whole dialog except the intro and "last words").

I tried different things some days ago, but nothing was really satisfying, so I decided to wait until CJ is back and suggest this behaviour as a feature for a future release.

Thanks in advance.

Gilbert

I'm not sure, maybe he's just using some displayspeech() etc before the GUI pops up, I think it's nice to have some features so what he wanted can be done easily.

BlackBaron

#8
What I did was this:
For the beginning:
"Talk to character", "Run Script":

 // function 1
 // script for character1: Talk to character
 MoveCharacterBlocking (EGO,character[MAN].x+30 , character[MAN].y, 0);
 FaceCharacter(EGO,MAN);
 RunDialog(0);


Dialog 0 script:

@S  // dialog startup entry point
 EGO: "EGO Hi!"
 MAN: "MAN Hi!"
 run-script 1
 return
 (...)

@n  // option n
 EGO: "Bye"
 MAN: "Bye"
 stop


On the global script:

function dialog_request(int parameter) {
 if (parameter == 1) {
   GUIOn(DIALOGUE);
   GUIOff(MAINGUI);
   Wait(1);
 }  
 (...)
}

(For some reason I don't quite understand yet, if I don't force the game to wait a gamecycle, with that 'wait(1)', you can see how next time you choose a dialog option, the DIALOGUE GUI goes off while the MAINGUI is still on, just before the DIALOGUE GUI turns on again (it's very subtle, it all last juts a fraction of a second), instead of just staying on. If you don't get what I mean, just take off that 'wait(1)' when you try it and see if there's any difference, if there isn't, please tell me, because that could mean I'm doing something else wrong)

You could also do that by using 'DisplaySpeech' to say the first lines, switch the GUIs and then run the dialog without those lines, as Gilbot V7000a said, but I prefer to have those lines in the dialog script. (By the way, if you do it this way -turning on the dialog GUI in the script before it- and use Popup modal for the dialog GUI, you still have the problems with the animations).

Now, here comes the tricky part for the post-dialog script (this is where I COULD use some better ideas) that come AFTER they both say "BYE".
I realized that if you just put this script after the RunDialog(0) up there, it executes it before the dialog and not after, this is because the game waits for the next gamecycle before running the dialog (I supect that the thing related to the 'wait(1)' line I mentioned before has something to do with this). To solve this, I add a second "Run Script" on the "Talk to character", just after the previous one, and THERE I put the post-dialog script:


 // function 2
 // script for character1: Talk to character
 GUIOff(2);
 FaceLocation (EGO, character[EGO].x, character[EGO].y+20);
 DisplaySpeech(EGO, "This guy is nuts!");
 GUIOn(0);


Wow, this is a LONG post, I hope that's clear enough (I often say more than is needed and confuse people), if not, please feel free to ask.


"Do you thirst for knowledge no matter the cost?"
            -Watrik, master glassblower

Pumaman

So would the easiest solution here be if I added an option not to display the dialog options GUI until the first set of options were presented to the player?
Would that cover it?

SMF spam blocked by CleanTalk