2.54 changing speech style doesn't work

Started by Timosity, Thu 22/05/2003 10:11:52

Previous topic - Next topic

Timosity

I just started adding speech to my game and it always uses lucasarts style speech

I can't get it to change

I've clicked all the boxes for the different speech styles and it always stays at the original lucasarts style.

even when I put this in the start

SetSpeechStyle (SPEECH_SIERRABKGRND);

and even tried to use it just before the speech.

I've also closed down roomedit and opened it again to see if it needed to be restarted. and to see if it had saved my changes, and it had.

is there something I'm doing wrong or is it a bug

I'm using the  2.54.323 version

Scorpiorus

Hmm, have you assigned the talking view?

-Cheers

Timosity

#2
Sorry about that, I figured it out and forgot about the post, but I have another question.

The Style didn't turn out the way I wanted, I figured out a way to do what I want but I'm wondering if there is an easier way.

What I want is the speech to appear in a box similar to a message box but has a label of who is speeking and not an image, also within the box at the top.

I created a gui for each character with there name across the top

using this script

game.speech_text_gui=11;
DisplaySpeechAt(140,100,168,EGO,"[Text goes here");
game.speech_text_gui=12;
DisplaySpeechAt(125,25,168,KAL,"[More here");

I also set the talking view to a transparent image to get rid of it.

I also put in "[" before each speech to have a space for the label.

Is that the best way around it.

Also Is it posible to have an image in the background, say on the lefthand side, and not have the text go over it? that goes for message boxes and speech boxes .

(I guess you could just use a few spaces on the start of each line)

Thanks for the help Scorpiorus

Scorpiorus

Yep, although AGS includes all basic speech styles, sometimes it isn't exactly what we want. As about your problem you take the right approach. Actually were it possible to resize the GUI one would make his own textwindow using a button to show an image (as you want). Well you could do that way also displaying the speech as the label text for example but as I already said the GUI won't resize automatically. If it fits your requirements then that's good if not... then make it as you suggested.
Ok still about the image, char's name and text alignment - what you could do is to make another always-on GUI representing the image you want. That GUI have to have a higher id number than the one is used as speech textwindow so the image GUI will be always drawn over it. The same for the char's name - make one more GUI with label to show char's name.
Then whenever you DisplaySpeech() the textwindow make sure you turn on the image and name GUIs then after turn them off:

GUIOn(GUIIMAGE);
GUIOn(GUINAME);
DisplaySpeechAt(...);
GUIOff(GUIIMAGE);
GUIOff(GUINAME);

About alignment:

Quote(I guess you could just use a few spaces on the start of each line)
Exactly. That's the way you should go. Here is a function which I hope helps you to align the text to the right. Keep in mind however each space takes one char and the whole string must fit in 200 chars (including left spaces).

function AlignRight(int spacenum, int width, string str_in, string str_out) {
 if (width < 1) width = 1;
 if (spacenum < 0) spacenum = 0;
 string sformat;
 StrFormat(sformat, "%%s[%%%ds", spacenum);
 StrCopy(str_out, "");
 int i,j;
 while (i < StrLen(str_in)) {
    if (j <= 0) {
       StrFormat(str_out, sformat, str_out, "");
       j = width;
    }
    else {
       StrFormat(str_out, "%s%c", str_out, StrGetCharAt(str_in, i));
       j--; i++;
       if (j <= 0) if (StrGetCharAt(str_in, i) != ' ') j = 1; else i++;
    }
 }
}

The function align the input string str_in to the right returning the result in str_out.

int spacenum
A number of spaces to put before each line.

int width
width of the line (without spaces). Make sure you have long enough textwindow to display the string in.

Example of usage:

 string s1;
 AlignRight(1, 1, "some text here .... . . . . . . . . . . . . . .", s1);
 DisplaySpeechAt(65,50,181,EGO,s1);



So the whole function you could make:

function MyDisplaySpeech(int CharID, int CharImage, string text) {

SetGUIBackgroundPic (GUIIMAGE, CharImage);
SetLabelText(GUINAME, 0, character[CharID].name);
SetGUIPosition(GUIIMAGE, ......);
SetGUIPosition(GUINAME, ......);
GUIOn(GUIIMAGE);
GUIOn(GUINAME);
string s1;
AlignRight(10, 20, text, s1);
DisplaySpeechAt(65,50,181,EGO,s1);
GUIOff(GUIIMAGE);
GUIOff(GUINAME);

}

this way.
I hope it helps you to achieve it. ask questions if any ;)

-Cheers

Timosity

Thanks Scorpiorus, You've been really helpful,

I'll try out a few things and see how I go.

cheers

Tim

SMF spam blocked by CleanTalk