Adventure Game Studio

AGS Support => Modules, Plugins & Tools => Topic started by: monkey0506 on Sun 04/12/2005 04:23:21

Title: MODULE: QueuedSpeech v4.1 - Updated 1 Oct 2016 (Bugfix edition)
Post by: monkey0506 on Sun 04/12/2005 04:23:21
Disregarding the module that SSH made (http://www.adventuregamestudio.co.uk/forums/index.php?topic=11868.msg293282#msg293282) (:P), I've modulized Scorporius's queued background speech code (http://www.adventuregamestudio.co.uk/forums/index.php?topic=11868):

1 October 2016: Thanks cat for pointing out some heinous coding on my part, I've uploaded v4.1 with a bugfix. Everything else is the same, see thread for details.

27 January 2015: I have updated this module to v4.0, with a revised interface and dynamic queue sizing. This allows you to add basically as many items to the queue as you want at one time (*current maximum is actually 1000000, but queue is dynamically sized to preserve memory). The new version also has improved handling if the character speaking in the background starts moving - they will be released from their speech view and continue their movement.

Example:

Code (ags) Select
void InitializeBackgroundDialogue()
{
  QueuedSpeech.ClearQueue();
  QueuedSpeech.Looping = true;
  QueuedSpeech.Paused = true; // don't start the queue right away
  cEgo.SayQueued("Gee, I wonder where Bob wondered off to...");
  cEgo.SayQueued("When I find him, I'm gonna knock his block off.", null, 120); // add a delay to this message
  cEgo.SayQueued("That'll show him.");
}

function room_Load()
{
  InitializeBackgroundDialogue();
}

function hRug_Interact()
{
  QueuedSpeech.Paused = false; // start thinking about Bob
}


Requires AGS 3.4.0.3 or higher!

Download v4.1 (https://sites.google.com/site/monkey0506/QueuedSpeech_410.scm?attredirects=0&d=1)

25 January 2013 Four years later... Updated the module to work with the new-style audio clips. If you want to use the old-style audio system then just stick to v3.0 because v3.5 isn't backwards compatible. See the included documentation for full changelog. Notably, the Character.SayQueued method now requires an AudioClip* for voice speech, instead of formatting it into the message string.

08 January 2009 After nearly a full three years since the last update to this thread...I figure it's time to get this download back up. And I had a bit of fun toying around with making a demo. Hijacked RON sprites and all. Oh, and Microsoft SAM speeching!
Title: Re: MODULE: QueuedSpeech
Post by: Lazarus on Mon 05/12/2005 10:45:07
I was wondering if this module lets to speech to continue running while the player is interacting with objects etc..

thanks
Title: Re: MODULE: QueuedSpeech
Post by: monkey0506 on Mon 05/12/2005 11:28:05
The text will be removed if you interact with an object.  I'll try to get that fixed, but do realize that the view is locked (with Character.LockView) to the character's speech view, so if you have any sort of animation for picking objects up or anything, that wouldn't be played.
Title: Re: MODULE: QueuedSpeech v2.2 BETA
Post by: monkey0506 on Tue 18/04/2006 23:39:12
New BETA, so I figured I'd let everyone know.

This BETA is primarily for the testing of multiple queues, so let me know how it works for you (you can set the number of queues per game (eQueuedSpeech_MaxQueues) and number of items per queue (eQueuedSpeech_MaxOptions) (come to think of it, that should probably be renamed) in the module header.

Please note (for those who aren't going to read the first post's edit) that looping does not currently work, I'm working on implementing that right now.  And there are no checks to prevent the same player from talking simultaneously in multiple queues, so that could create some confusion.  I'll add something to prevent it.
Title: Re: MODULE: QueuedSpeech v3.0 - Updated 07 Jan 2009 (Now with demo!)
Post by: monkey0506 on Thu 08/01/2009 08:40:52
Multiple queues was a foolish idea anyway. :=

Idealistically this should one day be able to take advantage of actual speech files but for now it uses sound files for speech. Looping is functional as displayed in the demo. Also it would be wonderful if the speech could be played in an ambient manner similar to that of PlayAmbientSound...for those wondering the reasoning behind not using PlayAmbientSound as-is stands because that would cause the sound to loop and there's no way of determining when it has finished playing.

Oh, further, I've drastically decreased the default queue size in this module down to only 30 items. You should be able to raise it without problem.
Title: Re: MODULE: QueuedSpeech v3.0 - Updated 07 Jan 2009 (Now with demo!)
Post by: joelphilippage on Tue 03/02/2009 22:01:50
This is part of another problem I'm having but I think it just involves this module. The speech is displaying weird. I am using the smooth parallax scroll module, 640 x 400, and 32 bit color. Here is a screen shot of what happens.
(http://www.2dadventure.com/ags/text.PNG)
Title: Re: MODULE: QueuedSpeech v3.0 - Updated 07 Jan 2009 (Now with demo!)
Post by: Dave Gilbert on Wed 03/03/2010 15:04:12
Hello!  Sorry for digging up this old post, but this module is *perfect* for my current project.  I got it working perfectly, but I encountered the same text color issue as JoelPhilippage above.  The game is 640 x 480 and 32 bit color.  Is there around this problem? 
Title: Re: MODULE: QueuedSpeech v3.0 - Updated 07 Jan 2009 (Now with demo!)
Post by: monkey0506 on Wed 03/03/2010 15:12:19
I'm sorry, I'm not aware what the problem is! :o

I guess I must have overlooked joel's post (sorry!!). So from the screenshot it looks like the top line is being cut off, correct? I have a job interview to go to ATM but when I get back I shall investigate!!
Title: Re: MODULE: QueuedSpeech v3.0 - Updated 07 Jan 2009 (Now with demo!)
Post by: Dave Gilbert on Wed 03/03/2010 15:14:29
Hi monkey!  Basically the problem is the weird magenta dots that surround the text.  It looks like an AGS sprite that was badly imported.
Title: Re: MODULE: QueuedSpeech v3.0 - Updated 07 Jan 2009 (Now with demo!)
Post by: GarageGothic on Wed 03/03/2010 16:43:11
Looks like you're using anti-aliased fonts which would create this effect when drawn onto a transparent surface. The easy fix is to just add a "SetGameOption (OPT_ANTIALIASFONTS , 0);" before the DrawingSurface routines in the module (and reset it after the drawing), but for a smoother look, there's also some suggestions mentioned in this thread (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=39364.0) on how to achieve an antialiased effect on a transparent overlay.
Title: Re: MODULE: QueuedSpeech v3.0 - Updated 07 Jan 2009 (Now with demo!)
Post by: monkey0506 on Wed 03/03/2010 18:30:24
You mean like this one (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=39364.msg518660#msg518660)? ::)
Title: Re: MODULE: QueuedSpeech v3.0 - Updated 07 Jan 2009 (Now with demo!)
Post by: Dave Gilbert on Wed 03/03/2010 21:40:14
Quote from: GarageGothic on Wed 03/03/2010 16:43:11
Looks like you're using anti-aliased fonts which would create this effect when drawn onto a transparent surface. The easy fix is to just add a "SetGameOption (OPT_ANTIALIASFONTS , 0);" before the DrawingSurface routines in the module (and reset it after the drawing), but for a smoother look, there's also some suggestions mentioned in this thread (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=39364.0) on how to achieve an antialiased effect on a transparent overlay.

That worked, GG.  Thank you!
Title: Re: MODULE: QueuedSpeech v3.0 - Updated 07 Jan 2009 (Now with demo!)
Post by: Sslaxx on Mon 29/03/2010 14:21:18
Do you have the source code for the demo?
Title: Re: MODULE: QueuedSpeech v3.0 - Updated 07 Jan 2009 (Now with demo!)
Post by: joelphilippage on Thu 15/07/2010 01:40:54
This module does not allow walking and talking. Has anyone found a solution to this?
Title: Re: MODULE: QueuedSpeech v3.0 - Updated 07 Jan 2009 (Now with demo!)
Post by: BrightBulb on Tue 20/03/2012 18:16:38
Quote from: Dave Gilbert on Wed 03/03/2010 15:04:12
Hello!  Sorry for digging up this old post, but this module is *perfect* for my current project.  I got it working perfectly, but I encountered the same text color issue as JoelPhilippage above.  The game is 640 x 480 and 32 bit color.  Is there around this problem? 

I know this thread isn't current anymore, but I have found the solution for the speech color issue. Took me a while to find it, so to save you the hassle...

In line 116 is the command: Overlay *newOverlay = Overlay.CreateGraphical(x, y, sprite.Graphic, true);

You have to change "true" to "false" and it will display the color properly.
Title: Re: MODULE: QueuedSpeech v3.5 - Updated 25 Jan 2013 (Now with AudioClips!)
Post by: monkey0506 on Fri 25/01/2013 07:11:06
Bump for new version. In case anybody cares.

As for the transparency issue, as far as I can tell it's only related to fonts with anti-aliasing. From what the manual has to say on the "transparent" parameter for Overlay.CreateGraphical, it doesn't seem a viable "bug-fix" but if anyone confirms and lets me know then I'll swap out the line.

Regarding "walking and talking", I'm not sure what the intended purpose was, but the Overlay will not follow characters around the room. I imagine that would be relatively simple to implement if anyone needs it, so again feel free to let me know.
Title: Re: MODULE: QueuedSpeech v3.5 - Updated 25 Jan 2013 (Now with AudioClips!)
Post by: pixg on Mon 28/01/2013 08:26:10
Excelent work! I've been searching for something like this that works properly for days now, so many of the modules are incompatable with the new AGS, but this one is great!
Title: Re: MODULE: QueuedSpeech v3.5 - Updated 25 Jan 2013 (Now with AudioClips!)
Post by: bslinger on Sat 06/04/2013 22:18:43
The hosting account that these files were on is saying the account is suspended - is there anywhere else this module is available?
Title: Re: MODULE: QueuedSpeech v3.5 - Updated 25 Jan 2013 (Now with AudioClips!)
Post by: Dualnames on Sun 28/04/2013 17:34:34
Of course, I believe I've hosted it here: http://duals.agser.me/Modules/QueuedSpeech_v3.0.rar I think that doesn't cover version 3.5. Currently a bit on the army side of things, but I'll have standard access to my harddrive rather shortly, if you can wait by then.
Title: Re: MODULE: QueuedSpeech v3.5 - Updated 25 Jan 2013 (Now with AudioClips!)
Post by: bangerang101 on Mon 11/11/2013 18:56:52
Where can I download this 3.5 version? ???
Title: Re: MODULE: QueuedSpeech v3.5 - Updated 25 Jan 2013 (Now with AudioClips!)
Post by: monkey0506 on Mon 11/11/2013 19:08:35
You can download v3.5 by going here (https://docs.google.com/viewer?a=v&pid=sites&srcid=ZGVmYXVsdGRvbWFpbnxtb25rZXkwNTA2fGd4OjdhZTkyOWMyOTBjNDJkYmQ). Click the arrow to the far right to download the SCM file.
Title: Re: MODULE: QueuedSpeech v4.0 - Updated 27 Jan 2015 (Now with INFINITE* messages!)
Post by: monkey0506 on Wed 28/01/2015 04:04:17
Bump for new version! Details in the first post.
Title: Re: MODULE: QueuedSpeech v4.0 - Updated 27 Jan 2015 (Now with INFINITE* messages!)
Post by: cat on Wed 04/05/2016 14:21:08
The module crashed on me during the final test run just one hour before the MAGS deadline :-\

(http://cat.agser.me/games/ToffeeTrouble/queuedSpeechCrash.png)

It only happened once, but it crashed the complete game. I have no clue what this line is supposed to do anyway, so I just commented it out. This line cannot work at all, it will always be a blocking function within rep_ex_always...
Title: Re: MODULE: QueuedSpeech v4.0 - Updated 27 Jan 2015 (Now with INFINITE* messages!)
Post by: Slasher on Sat 07/05/2016 20:02:16
If Block == eNoBlock

should lines not read:
Code (ags) Select

chara,Walk(xx, yy, Block)


Just a stab in the dark...
Title: Re: MODULE: QueuedSpeech v4.0 - Updated 27 Jan 2015 (Now with INFINITE* messages!)
Post by: cat on Sat 07/05/2016 22:18:37
It does not make sense either way because in rep_ex_always you are never allowed to use blocking functions...

I guess we have to wait for monkey0506.
Title: Re: MODULE: QueuedSpeech v4.0 - Updated 27 Jan 2015 (Now with INFINITE* messages!)
Post by: Julius Dangerous on Wed 01/06/2016 22:49:28
i'm using Build 3.3.5.5 of AGS and the v.4.0 of this module doesn't works
Title: Re: MODULE: QueuedSpeech v4.0 - Updated 27 Jan 2015 (Now with INFINITE* messages!)
Post by: Crimson Wizard on Wed 01/06/2016 23:18:50
Quote from: Julius Dangerous on Wed 01/06/2016 22:49:28
i'm using Build 3.3.5.5 of AGS and the v.4.0 of this module doesn't works
Does it give any error messages, or it simply fails to perform what it must?
Title: Re: MODULE: QueuedSpeech v4.0 - Updated 27 Jan 2015 (Now with INFINITE* messages!)
Post by: cat on Mon 06/06/2016 15:18:25
As written in the first post, this module requires AGS 3.4.0

However, with the current bug not solved, I STRONGLY ADVICE AGAINST USING THIS MODULE
Title: Re: MODULE: QueuedSpeech v4.0 - Updated 27 Jan 2015 (Now with INFINITE* messages!)
Post by: monkey0506 on Sun 02/10/2016 04:58:28
I've only just noticed this bug report. I haven't been around the forums much lately. The line in question was an incomplete attempt at getting the character to be able to move about freely without destroying or stopping the queued speech. This code was not meant to be included in the production release of v4.0, I apologize for that. Commenting it out won't harm anything in the rest of the module. I will upload a fixed v4.1 shortly, which will utilize #362 (https://github.com/adventuregamestudio/ags/pull/362) for AGS v3.4.1+ (and ignoring that feature for prior AGS versions).

Edit: Actually... looking at the changelog, it seems that I forgot that the feature wasn't fully implemented. It's been well over a year since I released this version, so I don't recall.

Edit, Mk. II: v4.1 is uploaded, and I even tested the changes. :=
Title: Re: MODULE: QueuedSpeech v4.1 - Updated 1 Oct 2016 (Bugfix edition)
Post by: Khris on Thu 27/07/2017 14:23:11
rmonic79 just encountered a bug regarding voice speech, but it was an easy fix:
On line 170, the second boolean has to be inverted. (http://www.adventuregamestudio.co.uk/forums/index.php?topic=55070.msg636567237#msg636567237)
Title: Re: MODULE: QueuedSpeech v4.1 - Updated 1 Oct 2016 (Bugfix edition)
Post by: daneeca on Sat 18/04/2020 17:11:26
Hi! I'm using this great module and I ran into a small issue. If I change the language ingame, while a bunch of queued speeches playing, then it doesn't translate these texts. I have the "GetTranslation" part before the texts but it works only if I change the language before I start to play the QueuedSpeech. Is there and easy way to update the actual speeches somehow? Or should I replay all queued speeches manually when I change the language? Thank you in advance for your help!
Title: Re: MODULE: QueuedSpeech v4.1 - Updated 1 Oct 2016 (Bugfix edition)
Post by: Crimson Wizard on Sat 16/05/2020 13:56:07
I was not sure if the module stores already translated text, or untranslated text?
If latter, the easiest fix would be to go into function BuildOverlay inside the module's script and do this at the very beginning:
Code (ags) Select

message = GetTranslation(message);

this will ensure it always displays current messages in current language. But you have to also make sure to pass non-translated strings in the module's functions from outside.


Since you asked about this on Discord, I'd also mention that the module strangely does not account for room scrolling... Again, the quick fix seems to be this: go again to BuildOverlay,
1) Put this at the beginning:
Code (ags) Select

int char_x = this.x - GetViewportX();
int char_y = this.y - GetViewportY();

2) Replace all other this.x and this.y with char_x and char_y inside function BuildOverlay.
Title: Re: MODULE: QueuedSpeech v4.1 - Updated 1 Oct 2016 (Bugfix edition)
Post by: Potajito on Mon 26/04/2021 15:09:19
Quote from: Crimson Wizard on Sat 16/05/2020 13:56:07
I was not sure if the module stores already translated text, or untranslated text?
If latter, the easiest fix would be to go into function BuildOverlay inside the module's script and do this at the very beginning:
Code (ags) Select

message = GetTranslation(message);

this will ensure it always displays current messages in current language. But you have to also make sure to pass non-translated strings in the module's functions from outside.


Since you asked about this on Discord, I'd also mention that the module strangely does not account for room scrolling... Again, the quick fix seems to be this: go again to BuildOverlay,
1) Put this at the beginning:
Code (ags) Select

int char_x = this.x - GetViewportX();
int char_y = this.y - GetViewportY();

2) Replace all other this.x and this.y with char_x and char_y inside function BuildOverlay.
Thanks a lot for this! I had this problem and that did the trick. Thanks also for this module, it's super useful and still works pretty good nowadays :D
Title: Re: MODULE: QueuedSpeech v4.1 - Updated 1 Oct 2016 (Bugfix edition)
Post by: Potajito on Sun 16/05/2021 17:55:50
I know this is an old module and all that, but so far it's been working for me...
Everything but the audioclip part. What I'm doing is importing the lines that are said using QueuedSpeech as Audioclips, and passing them as such, for example:
Code (ags) Select
cNarrator.SayQueued("This is it...", aNarrator1);
But the line displays on screen for like one ms and then it dissapears, no audio at all.
Then I thought that as a workaround I could use aNarrator1.Play and aNarratorX.PlayQueued and try to sync them, but I don't really know how to sync them, as audio is playing much faster than the lines, and also it looks hacky as shit.
Has anyone been able to make the audioclips work? Do you have any other idea for a workaround?
Cheers!
Title: Re: MODULE: QueuedSpeech v4.1 - Updated 1 Oct 2016 (Bugfix edition)
Post by: Monsieur OUXX on Tue 18/05/2021 10:28:26
Quote from: Potajito on Sun 16/05/2021 17:55:50
But the line displays on screen for like one ms and then it dissapears, no audio at all.

Not very helpful but my guess is that the text disappears instantly becaue the audio is not played at all (if the audio is zero-seconds long then the text disappears as soon as it appears, it makes sense). I'm just saying that to help looking in the right direction.
Title: Re: MODULE: QueuedSpeech v4.1 - Updated 1 Oct 2016 (Bugfix edition)
Post by: Potajito on Mon 24/05/2021 12:36:01
Well, I managed to fix the audio not playing, and meanwhile I adapted the module to AGS 3.5+ (currently working on AGS 3.6 Alpha). I also added Crimson Wizard fixes for localization and room scrolling.

Here it is, in case anyone is interested:

https://drive.google.com/file/d/1UBl2ACjRqZDQUgQDTrRXwsf1n3s09jui/view?usp=sharing
Title: Re: MODULE: QueuedSpeech v4.1 - Updated 1 Oct 2016 (Bugfix edition)
Post by: eri0o on Sat 12/02/2022 14:46:53
Potajito, I took the liberty of pushing your modification as v4.2 here: https://ericoporto.github.io/agsModuleList/?q=queuedspeech