Top Mud Sites Forum

Top Mud Sites Forum (http://www.topmudsites.com/forums/index.php)
-   MUD Coding (http://www.topmudsites.com/forums/forumdisplay.php?f=9)
-   -   Title reset (http://www.topmudsites.com/forums/showthread.php?t=354)

Verboden Faction 05-06-2003 03:06 PM

When I change someone's title using string title, or any other means, the title resets when they level up. I have looked at the code, and can't seem to find where it does that. I still want it to change when they level up if it's not a custom title, but if an immortal changes the title, i want it to stay.

[code]
[60 HUM INV] [KNIGHT] Sir Veratio L'Anel the Invoker
[/quote]
but I changed the title to
[code]
[60 HUM INV] [KNIGHT] Sir Veratio L'Anel the
[/quote]
but when I level, it changes to the title of the next level, and doesn't keep the one I set. But if I don't change my title, i want it to change with the levels, but not reset when I set it myself.

Yui Unifex 05-06-2003 03:19 PM

Grep for 'title' or whatever the variable that contains the title is called in your sources. Excluding the database operations, look where it is set. Bonus points if you see a reference to a table that contains 'the Invoker' or whatever level-based titles your mud has. Simply jump around setting the title in this place if their title is not one that was set by them levelling up (i.e., it's not in the table of level titles).

Verboden Faction 05-11-2003 08:50 PM

yea, couldn't find that

Yui Unifex 05-12-2003 07:09 AM

You couldn't find grep? Or were you unable to do grep title *.c? Is the title named something differently? You can easily find the exact name in whatever command sets it (do_title?), of course. If you are indeed grepping for the correct variable name, then your being unable to find it is simply a result of your not trying hard enough =). You can probably cross-reference your search by grepping for a string that is only output to the player when he levels up.

karlan 05-15-2003 10:33 PM

Assuming you find the location in code where it sets the title...

a bit of a hack, but you could have a plr flag that toggles if their title is set by an immortal, or not, then you could use the same data in the struct to store it, but if it is set by an immortal, then handle it differently (maybe a control code to mark the end of the static part of the title?)

alternatively you could write a parser for their title string, if they have a string set, look for control codes and replace them with appropriate information (same as is done for colour codes) eg: &sC -> class
[code] title L'Anel the &sC[/quote]
could then pase that string and when it finds an occurance of &s (I use & for colour codes, but do not have a code for s, but the control code is up to you) look at the next char and react based on that, ie: [code] case 'C';
  // insert into string (possibly the middle so there are some extra issues here) class_title[GET_CLASS(ch)];[/quote]

resulting in...
[code] 60 HUM INV] [KNIGHT] Sir Veratio [B]L'Anel the Invoker[/B][/quote]

You just have to remember that string operations can be computationaly(sp?) expensive.


All times are GMT -4. The time now is 12:29 PM.

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright Top Mud Sites.com 2022