Re: [CODE]Title

From: Welcor (
Date: 03/01/02

From: "Kevin Dethlefs" <Demortes@MSN.COM>
> Somewhere in the code is attaching the name automatically before the
> You see, my coder is trying to make a function to where you can put your
> name in your title, and it justs stay's there. He can't find it, and
> can I (which isn't a bit suprising, I'm too new to coding), anyway. I will
> give you an example.
> >title The dark master, Demortes
> Then my title on who and in rooms should be 'The dark master, Demortes'.
> it is currently 'Demortes The dark master, Demortes' How do i get rid of
> first 'demortes'?
> Loving Kilara, and you know I love every moment of this.
> Kevin
You'll want to completely rewrite the way titles are handled.
Currently (in stock), the title is just a text, which is displayed after
the name - as you yourself wrote above;

void set_title(struct char_data * ch, char *title)
  if (title == NULL) {
    if (GET_SEX(ch) == SEX_FEMALE)
      title = title_female(GET_CLASS(ch), GET_LEVEL(ch));
      title = title_male(GET_CLASS(ch), GET_LEVEL(ch));

+  /* if there isn't a %s inthere, make sure it's put in front */
+  if (!strstr(title, "%s"))
+    title = strcat("%s ", title);

  if (strlen(title) > MAX_TITLE_LENGTH)
    title[MAX_TITLE_LENGTH] = '\0';

  if (GET_TITLE(ch) != NULL)

  GET_TITLE(ch) = str_dup(title);

Now, everywhere you use GET_TITLE(ch) for display
(do_title, list_char_to_char, etc.) change it like this:

- sprintf(buf, "%s %s", GET_NAME(ch), GET_TITLE(ch));
+ sprintf(buf, GET_TITLE(ch), GET_NAME(ch));

This is all Mailer Code (i believe that's a (tm) :P),
and I haven't tested it.


   | FAQ: |
   | Archives: |
   | Newbie List:   |

This archive was generated by hypermail 2b30 : 06/25/03 PDT