Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Knox on Tue 10/08/2010 13:29:50

Title: Player "say" without text...? **SOLVED**
Post by: Knox on Tue 10/08/2010 13:29:50
Hi,

Ive got a custom script that shows character expressions (not finished, still debugging):


void showExpression(this Character*, Expressions eExpressionType, Expression_Length eLength, String sSay)
{
 int iView;
 int iBlink;
 int iLength;
 int iDefaultLength;
 bool bIsGamePaused;
 iDefaultLength = Game.MinimumTextDisplayTimeMs;
 
 bIsGamePaused = IsGamePaused();
 
 if (eLength == eShort) iLength = 750;
 else if (eLength == eMedium) iLength = 1500;
 else if (eLength == eLong) iLength = 2500;
 
 previousView = this.GetSpeechView();
 
 if (eExpressionType == eSmile)
 {
   if (this == player)
   {
     //getSpeechView to know which expressions to show depending on what version of Brian...
     iView = 17;
     iBlink = 40;
   }
 }
 else if (eExpressionType == eAhhhh)
 {
   iView = 39;
   iBlink = 40;    
 }
 
 this.SpeechView = iView;
 this.BlinkView = iBlink;
 Game.MinimumTextDisplayTimeMs = iLength;
 
 if (bIsGamePaused == true) UnPauseGame(); //if  the game is paused, unpause so the portrait can close itself...
 
 if (sSay == "") Display("Debug, just show the portrait");
 else player.GSay(String.Format("%s", sSay));
 
 if (bIsGamePaused == true) PauseGame();
 
 Game.MinimumTextDisplayTimeMs = iDefaultLength; //(should be 1000)
 this.restoreSpeechView(previousView);
 
 bIsGamePaused = false; //reset
}


At this line:  if (sSay == "") Display("Debug, just show the portrait");, Im not sure what to place so  that if the text to display is "nothing", I just want to show the portrait animation with no text...right now if the text is blank (sSay == ""), no portrait is displayed at all.

Im guessing its something to do with AGS's built-in "say" that wont show the portrait animation if there is no text?
Title: Re: Player "say" without text...?
Post by: Calin Leafshade on Tue 10/08/2010 13:36:17
how about a space?

or rather a series of spaces depending on how long you want it to display for.
Title: Re: Player "say" without text...?
Post by: Knox on Tue 10/08/2010 13:43:25
Hey Calin!

Well if I put a space, (sSay == " "), for example, we will see the speech text box next to the player's speech portrait, but empty...so  in my case a square border with blue filled background...I was wondering how I could do it so that the text box doesnt appear at all. Can I (or do I need to) hack the "say" command so that if the text is a space or empty it wont display the textbox but still display the speech portrait animation?

Title: Re: Player "say" without text...?
Post by: Calin Leafshade on Tue 10/08/2010 15:37:15
well if the character isnt actually *saying* anything than I would recommend you dont use the say command at all.

Just use a gui or something and draw the portrait that you want.. then get the engine to wait for 2 seconds or until the player presses a button.
Title: Re: Player "say" without text...?
Post by: Khris on Tue 10/08/2010 15:59:12
Doesn't saying "..." create a pause while showing only the portrait?
(I've never used anything other than LA style speech though.)
Title: Re: Player "say" without text...?
Post by: Knox on Tue 10/08/2010 16:20:09
wow, just tried that (say("...")...it works great :P

Is that in the manual? If so, Im really sorry I missed that...and quite embarassed  :-[
Title: Re: Player "say" without text...? **SOLVED**
Post by: Khris on Tue 10/08/2010 23:58:12
Not sure where I read that. Might very well have been some obscure collections of tidbits and snippets :)