Module: QueueBGSpeech 2.03, by SSH, Scorpiorus
Queued Background speech, with optional subtitles
Download QueueBGSpeech as a zip file
Author
Andrew MacCormack (SSH) and Scorpiorus
Please use the PM function on the AGS forums to contact
me about problems with this module
Abstract
Provides functions for queueing background speech,
with optional subtitles and score or globalint setting
Dependencies
AGS 2.71RC4 or later
Strict strings OFF
Functions
qDisplaySpeech(Character *CharID, string message)
Displays a character's speech message in the background and plays an appropriate
talk animation. You can queue up multiple messages by typing in several functions
one after another.
You can have a pause in the conversation by specifying a special qDelay(int time)
directive. The time parameter tells how long to wait before proceeding further.
The valid range is 1 through 199. Where time=1 is the shortest delay.
The qSetGlobalInt directive can be used, too, toset a globalint at a particular
point in the conversation, and this can trigger other events happening, by
checking for the globalint in a repeatedly_execute.
Similarly, qAddScore can be used to add to the player score at any point in the
conversation.
You can also have a sound to be played. Put the character '@' followed by a sound
number, for example:
qDisplaySpeech(cEgo, "@3 what is that?");
would display "what is that?" text message and play sound3.xxx file.
Note, however, it plays a normal sound, not a voice speech from the speech.vox file!
qDisplaySpeechSubtitled(Character *CharID, string message, string subtitle)
As with qDisplaySpeech, except a subtitle is displayed, centred
qStopSpeech()
Just stops background conversation.
qIsTalking()
Returns 1 if conversation is going on. Otherwise returns 0.
qSkipCurrentMessage()
Calling this function will skip currently displayed message and force the next one
to proceed.
qSubtitleSetup(int y, int font, int colour)
This function configures the subtitle's appearance: y position, font and colour.
qSetSkippable(int skippable)
This function enables or disables whether the standard conversation skip key also
skips the background conversation
Example
// Davy and Mika chat, but with their thoughts in subtitles... qSubtitleSetup(180, 1, 60000); qDisplaySpeechSubtitled(cDavy, "Hi Mika", "I want you!"); qDisplaySpeechSubtitled(cMika, "Hi Davy", "I hate you!"); qDisplaySpeech(cDavy, qDelay(50)); qDisplaySpeechSubtitled(cDavy, "How are you?", "I want you SO much!"); qDisplaySpeech(cDavy, qAddScore(7)); qDisplaySpeechSubtitled(cMika, "OK, thanks. Yourself?", "You're such a nerd"); qDisplaySpeech(cDavy, qSetGlobalInt(3, -5)); qDisplaySpeechSubtitled(cDavy, "Fine. Fine", "I am socially inept"); qDisplaySpeechSubtitled(cMika, "Seeya", "You are socially inept"); qDisplaySpeech(cDavy, qSetGlobalInt(1, 9));
Caveats
None yet.
Revision history
v2.03 [28.02.06] SSH
- Fixed but in qStopSpeech which gave random null errors
v2.02 [25.11.05] SSH:
- Made overlay removal safer
- Fixed SpecialHandler parsing bugs
v2.00 [24.11.05] SSH:
- Moved into AGS 2.71 module, struct and strings
- Added subtitles
- Added globalint setting
v1.02 [23.05.04] Scorpiorus:
- Added qSkipCurrentMessage() function to skip the message being currently displayed;
- Play sound was added: qDisplaySpeech(EGO, "@3 hey"); will play "sound3.xxx" file;
v1.01+ [06.04.04] Scorpiorus:
- Fixed import function Delay (should be import string Delay)
v1.01 [25.02.04] Scorpiorus:
- Delay(int time) directive was added;
- Fixed qIsTalking() returning 0 when the *last* phrase is being said;
- Changed the repeatedly execute part of the script;
Licence
Queued Background Speech AGS script module
Copyright (C) 2005 Andrew MacCormack, 2004 Scorpiorus
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
In addition to the licences mentioned in the modules themselves, you may choose to use the following creative commons licence if you prefer for all AGS modules and open source code resources on my site.

This work is licenced under a Creative Commons Licence.