> Let's say we have a string: "Hello there, how are you today?", if we
> have a dude who knows Elvish at 50%, we take first "Hello" and say
> something like: percent = number(1, 4); if (percent != 4) {
> translate(blah); }
> (translate being my function that does a static translation of the
> string). However I stumped dead at taking the string word by word and
> adding each word to the buffer either translatet or non-translated.
> Does anybody have any ideas how I could go about this? I'd be really
> greatful for any help at all.
char blah[500], blah2[500];
half_chop(argument, blah, blah2);
*buf = '\0';
do {
sprintf(buf, "%s%s", buf, number(1, 4) == 4 ? translate(blah) : blah);
half_chop(blah2, blah, blah2);
} while (blah);
should do it.
I do stuff like this all the time in my code when I need to go word for
word through a line. It's kind of tedious though for something like this
that will be used all the time :)
Ras
=-=-=-=-=-=-=-=-=
James C. Thomas Jr.
Head Implementor, FinalityMUD
finality.com 4000
=-=-=-=-=-=-=-=-=
+------------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
+------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST