Currently using MudOS driver (newest) and a self created mudlib.
I was implementing the "standard" color codes you usually find in MudOS mudlibs (%^RED%^, etc). I created an ansi.h include file with a small function called do_ansi that returns a mapping of all colors with their corresponding ansi (colors["white"] is "\033[37m").
After creating this I caught myself wondering where to put the code to interpret these. I finally placed them in the receive_message function on our user object. I have it test the termtype, check if there is one at the beginning of the text, then while-loop sscanf the rest of the text. It works just fine.
Out of curiousity though I was wondering if there was in fact a more viable solution than this, or if anyone had any other suggestions on how to implement this.
I also wish to add a user-configurable terminal daemon, allowing them to change certain mud colors based on the class passed through message(). The only way I can think of doing this is through the receive_message as well, any ideas?
Kaylus@Solice
|