Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Vault15 on Fri 01/06/2012 18:59:19

Title: [Solved] MultiResponse Module Speech Delay Fix?
Post by: Vault15 on Fri 01/06/2012 18:59:19
I'm fairly sure this could be an easy fix. I was unable to find a solution so my apologies if it was obvious.

I'm just trying to make it where the sound clip of the character speaking starts right as the text comes up. Right now it's playing once I click out of the text that appears above the character.

My code:
Code (AGS) Select

function Toilet_Interact()
{
 
  int state=Multi.Say("Look around. Can you see anything? I can't either.>I only remember where things are because my days are the epitome of redundancy.>I don't have to go and it's too dark.");
  if (state==1) aCell_toodark1.Play();
  if (state==2) aCell_toodark2.Play();
  if (state==3) aCell_toodark3.Play();

 
}
Title: Re: MultiResponse Module Speech Delay Fix?
Post by: Kweepa on Fri 01/06/2012 21:43:02
I think the simplest way to fix this is to use the standard speech support.

Code (AGS) Select

  int state = Multi.Say("&1 Look around. Can you see anything? I can't either.>&2 I only remember where things are because my days are the epitome of redundancy.>&3 I don't have to go and it's too dark.");


Should play the corresponding ego1.wav, ego2.ogg, or ego3.mp3. As a bonus, it will play translated lines from a speech pack, and skip the speech playback if the dialog line is skipped.
Title: Re: MultiResponse Module Speech Delay Fix?
Post by: Vault15 on Sat 02/06/2012 20:17:36
I did actually try that as well and it seems to just literally display "&1". I don't know if it's the module's issue?
Title: Re: MultiResponse Module Speech Delay Fix?
Post by: Kweepa on Sun 03/06/2012 01:54:27
Hmm, sorry about that!
In that case you'll have to dig into the module a bit. You could add a separate Multi.Choose function that chooses the appropriate string and returns the state, then a Multi.SayChosen function that actually says the chosen string.

Then
Code (AGS) Select

int state = Multi.Choose("Look...>I only...>I don't...");
if (state == 1) aCell_toodark1.Play();
if (state == 2) aCell_toodark2.Play();
if (state == 3) aCell_toodark3.Play();
Multi.SayChosen();
Title: Re: MultiResponse Module Speech Delay Fix?
Post by: Vault15 on Mon 04/06/2012 19:00:21
Thanks for the info. I don't mean for someone to have to hold my hand, but is there any way you'd be able to explain the exact code I should add within MultiResponse? I feel like I will screw it up for sure just attempting that.
Title: Re: MultiResponse Module Speech Delay Fix?
Post by: Kweepa on Mon 04/06/2012 22:21:30
Digging into it a bit more, the easiest thing to do is this:

Code (AGS) Select

string chosen = Multi.SRespond("A>B>C"); // or SLoop or SRandom
int state = Multi.response;
if (state == 1) a1.Play();
if (state == 2) a2.Play();
if (state == 3) a3.Play();
player.Say(chosen);
Title: Re: MultiResponse Module Speech Delay Fix?
Post by: Vault15 on Wed 06/06/2012 13:31:48
Outstanding, that did it! This makes the coding incredibly easy now =]

Also thank you for noting "SLoop or SRandom" as a comment since I do want some conversations to have a random response. I was actually trying to figure that out as well.
Title: Re: [Solved] MultiResponse Module Speech Delay Fix?
Post by: Khris on Wed 06/06/2012 16:46:37
Did you look at the module's documentation?
http://ssh.me.uk/moddoc/MultiResponse
Title: Re: [Solved] MultiResponse Module Speech Delay Fix?
Post by: Vault15 on Wed 06/06/2012 18:09:03
Surprisingly I have, although I realize now that it must have been for an older version. A lot of that looks familiar but beefed up info (I had found it on this forum earlier I believe). Definitely worth a bookmark, thanks.