Expression-style speech

From Adventure Game Studio | Wiki
Jump to navigation Jump to search

Expression-style speech by ~}Shade{~. Module to customize sierra-style (portrait) speech view, with changing expressions.

// Main script for module 'expression-speech-style' V0.3

int textstyle = 1; int waittime1 = 5; int waittime2 = 2;

function Speech (Character *Who, int expression, const string message){

 btnPortrait.Animate(Who.SpeechView, expression, 3, eRepeat);
 lblText.TextColor = Who.SpeechColor;
 if (textstyle == 0){
 gDispgui.Visible = true;
 Who.SayAt(320, 200, 0, message);
 //WaitKey (((StrLen(message) / game.text_speed) + 1) * GetGameSpeed());
 gDispgui.Visible = false;

} if (textstyle == 1){ int length=0;

 int i = 0;
 string displayedline;
 StrCopy(displayedline," ");
 gDispgui.Visible = true;
 StrFormat(displayedline, "%s%c", displayedline, StrGetCharAt(message,i));
 if (StrGetCharAt(message,i) == ' '){

} //SetLabelText(5, 1, text);

 //DisplaySpeechAt(320,200,0,wer, text);
 WaitMouseKey(((StrLen(message) / game.text_speed) + 1) * GetGameSpeed());
 gDispgui.Visible = false;


/* how to set it up?

1) create a new gui and call it "Dispgui" 2) create a button wherever you want and call it "btnPortrait" 3) create a label wherever you want and call it "lblText" 4) put the different expressions into the characters' speech views

how to use it?

first of all this script is used in the way of the "displayspeech" or the "player.say" command. "Who" is the one who talks, "expression" is the loop number of the character speech view, "message" is the message" if you want to use this in dialogs it gets a little bit more complicated. 1) for every dialog option you have to set up a "run-script x" command. 2) then go to the "dialog_request" section in your global-script 3) do something like this:

if (param == 1){ conversation } if (param == 2){...

the params are your dialog options now. you just have to keep track on which param belongs to which dialog option. as you should have noticed you don't have to use the dialog editor for the conversations.

what is textstyle and waittime here? textstyle 0 is the normal pop up one and textstyle 1 is the typewriter one. waittime1 means how long a " " is shown in your text before the next character is shown and waittime2 means how long the single characters are shown before the next one is shown.

about voicespeech with expression-speech-style! you just can use voicespeech with textstyle 0! if you want to use it look in the manual how it is used with ".Say"!

Thanks to Ashen for putting this into new style scripting and for improving it! I took the typewriter script from spook1 ( )!

changes from v0.2 to v0.3 - added another textstyle (typewriter)

changes from v0.1 to v0.2 - added possibility to have voicespeech

v0.1 features - sierra-speech-style with expressions.