Does player.Say even block r_e_a?

Started by Kumpel, Mon 21/03/2016 16:28:26

Previous topic - Next topic

Kumpel

For my translator situation I want the player to say something in a dialog and soon after he started talking (or at least after the first line is said) the translator has to say "*He translates*" to a third person" via some code in r_e_a . But it seems when the player is speaking even r_e_a is getting blocked from it. Am I doing something wrong or is player.Say not the right way to do it in this case? Do I have to customize the speach-event for the player to bypass this game blocking event of Say?

Here is the code in Global Script's r_e_a that should start inside a players speech but atm starts right after the last Say line:

Code: ags
 if (player.Speaking == true) // Checks if the player says something and deactivates a switch
  switch = false;
 
 if (switch == false) // If switch is off 
 {
  if (BgSpeech.GetIndexLength() == 0) // and if nothing is on (BgSpeech=)backgroundspeak's stack
  {
    BgSpeech.Pause(20);
    BgSpeech.Add(cDolm,"*übersetzt auf Deutsch*", eBgSpeech_Animating);  // add new stuff
  }
  else
    BgSpeech.Start(eBgSpeech_NoLoop);   // if the stack isn't empty, start the BgSpeech.

  switch = true;                        // activate switch
 }
 else if ((cDolm.Animating == false)  // if translator has finished speaking
  {
   BgSpeech.Stop(eBgSpeech_ResetPlayQueue);  // Stop BgSpeech
   BgSpeech.Reset();                         // and clear BgSpeech stack
  }

Cassiebsg

Say is blocking, any reason why you can't use SayBackground, that's non-blocking?
There are those who believe that life here began out there...

Kumpel

SayBackground wouldn't work because it has no speech animation and - whats more important - no "click to continue". :X


Cassiebsg

uhm... the speech animation you could fake it/force it... but if you require a click to continue then you need it to be blocking.
Maybe you could set the reading speeding to "dead slow" so you could avoid the click to continue... but that might piss off the fast readers. (roll)

(I'm out of ideas) You may have to rethink how that translation will work.
There are those who believe that life here began out there...

Crimson Wizard

#4
What does exactly BgSpeech do? You may run its functions from repeatedly_execute_always, but how they are processed internally?
I mean, are they really supposed to work during blocking functions?

Kumpel

Thats exactly what the module BgSpeech is for (it's from Phemar (Click). It makes nonblocking animated background speech possible via overlays, timers and nonblocking animations of specific characters and saves all speech lines in an indexed stack. This module works for that pretty good and it does what it's been made for even while speech (because the timers already had been started?) but I guess only if the program got the BgSpeech command before a player's speech event.

UPDATE: I got the idea behind the variable player.Speaking wrong. I thought it would be true only if the player is doing the speech animation but this var actually is true as long as the speech itself isn't over (which I guess only happens in dialog scripts, when return or stop is executed). I just replaced it with player.Animating (maybe I have to  add the limitation of the specific speech view in the future) and it worked like a charm! Thanks everyone.


Kumpel

Yes, sorry for not responding over there yet. I did see it but I had some difficulties to understand your suggestion and while trying to work it out I solved that problem on my own. (I will post my - I am pretty sure very dilettante - solution soon, if you are interested)

Now this time the background speech has to come shortly after the execution of the player's say command . So I had the idea to connect the player animation of speaking with the code block that starts the BgSpeech of the translator.  And this worked too :D

(I am a bit nervous when it comes to custom functions. :-[ My AGS 3.3.3.0 has some weird bug that occasionally corrupts the global header and script and sometimes even rooms (compiling and testing crashes with an error saying something about an old room format and stuff like that) when I try to export custom functions in the header. (wtf) )

Monsieur OUXX

Quote from: Kumpel on Tue 22/03/2016 01:18:02
My AGS 3.3.3.0 has some weird bug that occasionally corrupts...
I would suggest to immediately upgrade your game files to AGS 3.3.4!
 

Cassiebsg

3.3.5 is out, any reason not to go all the way????
There are those who believe that life here began out there...

SMF spam blocked by CleanTalk