Coders-- Help a newbie
Ok, well I'm new to C, and I wanna custom-tailor a mud (MERC) to look (kinda) like LegendMUD. Legend is a good mud to look up to from my point of view-- It has a LOT of people working on it, and it has ANSi color graphics in it..
One question coders, -Where- did you put that in the source, and how did you add all of those actions????
--Live long and prosper
What we did for those was to add a secondary parser that the regular parser falls through to when no standard commands match. It checks through a text table that holds social commands, and matches the specific case (social alone, social to self, social to mobile, social to object) and simply looks up the relevant strings in a table. It makes adding socials very very simple.
Color code processing is placed in write_to_buffer, which is in our comm.c file. We loop through the text looking for the pipe and U that define our color codes. Depending on your color type selection (ANSI, AVATAR, or RAW) we then generate a new string which is a copy of the old one but with the appropriate color codes embedded in place of the internal system. In adding color support, we chose this route because we wanted to filter out all actual ANSI codes being sent in so that we could prevent the nasty tricks you can pull on other people with them. :)