Please login or register.

Login with username, password and session length
Advanced search  


IRC channel - server:  channel: #wme (read more)

Author Topic: Multiple talk, one line in  (Read 2665 times)

0 Members and 1 Guest are viewing this topic.


  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 196
    • View Profile
Multiple talk, one line in
« on: August 31, 2006, 10:57:06 PM »

I had this tough.
When you're translating a sentance from one language to another, it might not have the same structure, and i wanted to be able to keep a few sentances grouped together in one talk.

Lets say my actor wants to say:
"My name Is Guybrush Threepweeod."
"I want to be a pirate."

I'd write in my code

Code: [Select]"/GUYBRUSH_HELLO_00/Hello");"/GUYBRUSH_HELLO_01/My name Is Guybrush Threepweeod.");"/GUYBRUSH_HELLO_02/I want to be a pirate.");

and in i'd have:
GUYBRUSH_HELLO_00       Hello.
GUYBRUSH_HELLO_01       My name Is Guybrush Threepweeod.
GUYBRUSH_HELLO_02       I want to be a pirate.
and i'd have 3 files GUYBRUSH_HELLO_00.ogg GUYBRUSH_HELLO_01.ogg GUYBRUSH_HELLO_02.ogg.

but i was thinking, maybe when translating it, you need more then 3 sentances ? or maybe 2 are enough.
So, i didn't want to need to keep a diffrent code for each language, but to group all these 3 into one line.
But how do i split them so the actor will say each line, and that i'd have 3 seperate audio files ?

i wrote this talk method, you can put it in your actor script file:

Code: [Select]
method Talk(inString)
// get the input string and split it into the tag and value with /
var myStr = new String(inString);
var SplitArr = myStr.Split("/");
// if it's not in format ("/aaa/bbb")  say it as it
if (SplitArr.Length < 2) {
// get it form the
var expanded = Game.ExpandString(inString);

// split it for parts with \ in them
// i assume expanded splited will only have 1 item if it's missing from so we'll treat it as single.
var expandedStr = new String(expanded);
var SplitArr2 = expandedStr.Split("\");
// if it's a one liner say it as it is.
if (SplitArr2.Length < 2) {

// say each part and play sound for it with TAG_NAME_00 etc..
for (var i= 0; i < SplitArr2.Length; i = i+1){
var fmti;
if (i < 10) {
fmti = "0" + i;
}  else {
fmti = i;
var outString = "/" + SplitArr[1] + "_" + fmti + "/" + SplitArr2[i] ;


Now, i also want to make sure that i have all my strings in my so instead of the text hardcoded i write "MISSING_TEXT BLABLABLA" so i'd know what's missing when i do QA work.
so now what i have is :


and in
GUYBRUSH_HELLO       Hello.\My name Is Guybrush Threepweeod.\I want to be a pirate.

and i keep my original recorded files GUYBRUSH_HELLO_00 through 02 and it works like a charm.

Note, Initially i wanted to use | for line seperator, but WME already changes it into a \n. which is undocumented as far as i know, and you can't split a string easily with two characters without writing another function.


Page created in 0.154 seconds with 22 queries.