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)
-   -   Race Restring (http://www.topmudsites.com/forums/showthread.php?t=461)

Verboden Faction 01-06-2003 02:05 AM

ok, I need help. I need a snippet for race restring. I use rom2b4. I have color and OLC already in it if that helps. But I need race restring for some major RP. Thanks.

jornel 01-06-2003 11:37 PM


Verboden Faction 01-07-2003 12:24 AM

race restring, what it does is make the race that is read in the who list different from the race a person really is. it's a command in a lot of muds. in score, a person is still elf, but on the who list, it'll say Boogie if I set it to that and it fits in the maximum string on the list. but only that person has it restrung.

Yuki 01-07-2003 11:58 AM

Put a new char pointer into pcdata, or chardata, depending which you know to do better.

char *raceRestring;

Then in the do_who method, if your raceRestring isn't NULL and isn't "", have it print that instead of the actual race.

Make a command to change it, and add raceRestring into save.c and recycle.c where needed.

Fairly simple.

Verboden Faction 01-07-2003 05:45 PM


Verboden Faction 01-08-2003 12:07 AM

rar, ok, i did it all, but i need help with the line in the do_who function, otherwise I got it. I need it to read what is in the pfile for raceR and put that in the place for race in the who list. But if that field is blank or doesn't exist, then it just uses the real race of the person.

Yuki 01-08-2003 12:57 AM

do_who I'm sure goes something like this:

sprintf(buf, "[%13s] %s%s", ...)

or something like that. Of course, my do_who code is far-modified, so what you do is find the thing that is producing the string in the brackets, and change it.

I can't remember what the name of it was, but I recall it being something like class or something, it's been years.

Anyhow, it's what all the immortal titles are set to, so find that, then at the end where it is being added in... say the name of the variable is whoString... and your raceString is called raceString...

put something akin to this right into the code...

raceString == NULL || raceString[0] = '\0' ? ch->pcdata->raceString : whoString

If that makes no sense to you, you shouldn't be coding yet. Grab a book on C++, read the first 4-5 chapters, don't bother reading about classes (stop right before it) then go back to mud coding. Get a book for reference. There's a snippet for this out there too, I'm sure. Kyndig.org I think has tons of snippets.

I can't actually code it for you without looking at the stock rom code, which I really don't want to do...

as for recycle.c, whenever you add in a string you should free the memory for it.

Verboden Faction 01-08-2003 01:00 AM



All times are GMT -4. The time now is 05:34 PM.

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