MUD Update
Posted in MUD Development
First watch, 5 bells (10:33 pm)

Tonight I’ve spent a couple hours polishing my file input/output code and added support for socials (eg. nod, yawn, etc). I also cleaned up all my logging to go through the central log daemon and not to std::cerr, std::cout, etc.

My socials are easily implemented, and easy to add on to. I have a single file, each social has 6 lines of text, each social is separated by the number (’#‘) character. The format looks something like this:
slap
You slap yourself silly.
%ME% slaps %REFLEXIVE% silly.
You slap %TARGET% upside the head.
%ME% slaps you upside the head.
%ME% slaps %TARGET% upside the head.

The first line is the name of the social. The second is what the issuer sees when the command is sent with no arguments. The third line is what everyone else sees. The next three lines cover when the command is sent with an argument (another person). The first of them is what the issuer sees, the second is what the target sees, and the final is what everyone else sees. The three tokens, %ME%, %TARGET%, and %REFLEXIVE% are changed out for the issuer’s name, the target’s name (in the case of a supplied argument), and, depending on the sex of the character, a reflexive pronoun (himself, herself, or itself) is substituted. Nice and easy.

The socials are loaded on startup from a single text file. I will add new functionality later to add socials while online (if the proper permissions are held), as well as saving everything back to a file on destruction.

Leave a Comment »