[SOLVED] Dialogue Stop and Colour Mysteries

Started by cipberbloom, Tue 25/01/2022 06:18:45

Previous topic - Next topic

cipberbloom

Hello and happy new year, everyone!  :-D

In one of my dialogues the third question is meant to close the conversation...


Code: ags

@3

  if (JerryOneQfive < 1)
    {
    cMalcolm.SayBubble("Please just go away!");
  
    cJerrysHead.SayBubble("Hmm hmm hmm da da da...")
 
    JerryOneQfive++;
    }
stop



...but for some reason you have to click the option twice for the dialogue to close.

And now for the embarrassing question:

When I began creating the game in October of 2020 I chose this hideous red and yellow colour combo (red dialogue options, hover to bright yellow), but can no longer find the setting.  ???

Thanks in advance!

arj0n

That would be these two:
game.dialog_options_highlight_color = xxx; //color used to draw the active (selected) dialog option
Character.SpeechColor = xx;

Khris

When you say you have to click it twice, are you saying that absolutely nothing is happening after the first click?

cipberbloom

Thanks a million, arj0n! I didn't even know about that list of game variables in the manual/help! I'd chosen dark red as the speech colour within the interface, maybe yellow is the default highlight? Anyway, awesome--that's fixed that (and you've opened up a new world of possibilities).  ;-D

Quote from: Khris on Tue 25/01/2022 09:08:32
When you say you have to click it twice, are you saying that absolutely nothing is happening after the first click?

Hullo, Khris!  ;-D

Yeah, after clicking the option that's meant to close the dialogue, the lines for the characters are displayed as scripted, but then the dialogue options are back again. If you click the aforementioned option again it does actually close.

My intention is for cMalcolm to say his line, cJerrysHead to say his, and for the dialogue to be gone. I've also tried putting return RUN_DIALOG_STOP_DIALOG; within the if statement in various places but it doesn't appear to make any difference.

Code: ags

@3

  if (JerryOneQfive < 1)
    {
    cMalcolm.SayBubble("Please just go away!");
  
    cJerrysHead.SayBubble("Hmm hmm hmm da da da...");
 
    JerryOneQfive++;
    return RUN_DIALOG_STOP_DIALOG;
    }
stop



Thanks again, everyone!



Khris

The only explanation I can think of is that due to a scripting error elsewhere, the dialog actually stops but then is immediately started again. Would that be possible?

cipberbloom

Quote from: Khris on Thu 27/01/2022 08:43:32
The only explanation I can think of is that due to a scripting error elsewhere, the dialog actually stops but then is immediately started again. Would that be possible?

It absolutely seems like it. And my scripting skills aren't great, to put it generously. (laugh)

Here's the bit from the global script that starts the dialogue (and is supposed to fade cJerrysHead out after the dialogue is exhausted, which also isn't working  :( ).

Code: ags

// TALKING TO JERRY
function cJerrysHead_Talk()
  {
    if (JerryDialogueOne == 0)
    {
    // Preamble invoked only on first load of this dialogue
    cMalcolm.SayBubble("Oh no...");
    cJerrysHead.SayBubble("bla bla bla");
    cMalcolm.SayBubble("bla bla bla");
    cJerrysHead.SayBubble("bla bla bla");
    cMalcolm.SayBubble("Sigh.");

    JerryDialogueOne = 1;

    dJerry1.Start();
    }
    // END DIALOGUE PRELUDE

   if (!dJerry1.HasOptionBeenChosen(1) || !dJerry1.HasOptionBeenChosen(2) || !dJerry1.HasOptionBeenChosen(3) || !dAskJerry1.HasOptionBeenChosen(1) || !dAskJerry1.HasOptionBeenChosen(2) || !dAskJerry1.HasOptionBeenChosen(3))
    {
    dJerry1.Start();
    }

   if (dJerry1.HasOptionBeenChosen(1) && dJerry1.HasOptionBeenChosen(2) && dJerry1.HasOptionBeenChosen(3) && dAskJerry1.HasOptionBeenChosen(1) && dAskJerry1.HasOptionBeenChosen(2) && dAskJerry1.HasOptionBeenChosen(3))
    {
    cJerrysHead.Clickable = false;
    int trans = cJerrysHead.Transparency;
    while (trans < 100)
      {
      trans++;
      cJerrysHead.Transparency = trans;
      Wait(1);
      }
    }
  }



I'm happy to post the two related dialogues too, if that would help. I don't see anything missing, out of place or duplicated in them, but there could've been an oversight on my part. BTW the if statements and JerryOneQfive etc variable have since been rubbished (superfluous part of some other stuff I was trying to do).

Thanks for your help!


Matti

In line 19 to 22 the dialog starts again if any of those six options has not been chosen. This seems wrong and could be the problem you're talking about.

cipberbloom

Quote from: Matti on Fri 28/01/2022 14:35:43
In line 19 to 22 the dialog starts again if any of those six options has not been chosen. This seems wrong and could be the problem you're talking about.

Ahhh! Thanks, Matti--that was it! I was over-complicating the situation and have removed the extra dJerry1.Start(); replaced the second if with:

Code: ags

    if (JerryDialogueOne == 1)
    {
    dJerry1.Start();
    }


I didn't want the preamble before the dialogue starts to play every time you try to talk to the character.

Again, thanks a million.  ;-D



Khris

Quote from: Skeevy Wonder on Fri 28/01/2022 04:47:27and is supposed to fade cJerrysHead out after the dialogue is exhausted, which also isn't working
Starting a dialog gets queued until the current function finishes. This is also what caused the other problem I guess, because the option logic, even if correct, is executed before the dialog even starts.

cipberbloom

Quote from: Khris on Sat 29/01/2022 20:55:30
Starting a dialog gets queued until the current function finishes. This is also what caused the other problem I guess, because the option logic, even if correct, is executed before the dialog even starts.

Hey! Apologies for not getting back to this sooner and marking it solved. I'd moved the fade-out section back to the main room's RepExec which seemed more logical (though I didn't know why). That sorted it out--thank you Khris for letting me know what was going on behind the scenes!

All the best!  ;-D

SMF spam blocked by CleanTalk