[coding] [newbie] languages

From: Dan Egli (dan@mudhosts.net)
Date: 01/25/99

I recently downloaded the language patch for circle, but it's not quite
what I'm looking for. I wonder if someone out there could help?

The problem is this: Unless everyone in the room is fluent in that
language, and they are set to speak in that language, then the system
garbels the text. I could see that if they were not fluent in the
language, but really... If someone actually knows a language, should it
really matter if they are speaking in it? Just because I'm speaking englih
doesn't mean I couldn't understand another language I knew if I heard
someone speak it. How would you accompilsh that? Here's the do_say routine
as I have hacked it to work:
  char ibuf[MAX_INPUT_LENGTH];
  char obuf[MAX_INPUT_LENGTH];
  char *buf2;
  struct char_data *tch;
  if(!*argument) {
    send_to_char("Yes, but WHAT do you want to say?\r\n", ch);
  strcpy(ibuf, argument);     /* preserve original text */
  if (!IS_NPC(ch))
garble_text(ibuf, GET_SKILL(ch, SPEAKING(ch)));
  for (tch = world[ch->in_room].people; tch; tch = tch->next_in_room) {
    if (tch != ch && AWAKE(tch) && tch->desc) {
      strcpy(obuf, ibuf);     /* preserve the first garble */
  if (!IS_NPC(ch) && !IS_NPC(tch) && GET_LEVEL(ch) > LVL_IMMORT)
  sprintf(buf, "$n says, '%s'",  argument);
else sprintf(buf, "$n says, '%s'", ibuf);
      act(buf, TRUE, ch, 0, tch, TO_VICT);
  sprintf(buf, "You say, '%s'", argument);
  act(buf, TRUE, ch, 0, 0, TO_CHAR);

That USUALLY allows immortals to understand period, but I want the system
to display normally to ANYONE who is fluent in that language. Languages
are defined as skills currently. Here's the garble_text function:

void garble_text(char *string, int percent)
  char letters[] = "aeiousthpwxyz";
  int i;

  for (i = 0; i < strlen(string); ++i)
    if (isalpha(string[i]) && number(0, 1) && number(0, 100) > percent)
      string[i] = letters[number(0, 12)];

Anyone? Thanks in advance! (I'm really terrible in C. I understand basics,
and thats about it)

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |

This archive was generated by hypermail 2b30 : 12/15/00 PST