`_.,-'~'-,._.,-'~'-,._.,-'~'-,._.,-'~'-,._.,-'~'-,._.,-'~'-,._.,-'~'-,._' Enhanced Prompt Code Copyright 1996, by Daniel Koepke `_.,-'~'-,._.,-'~'-,._.,-'~'-,._.,-'~'-,._.,-'~'-,._.,-'~'-,._.,-'~'-,._' I. Introduction =============== This is a patch to change prompts from the dull standard one to one that player's can define and add color, etc. to. The prompt can have any number of embedded codes in it which can display their current or max hitpoints, mana, movements, tank, tank's health, opponent, opponent's health, gold in hand, gold in the bank, etc. The patch resembles (and includes a piece of) my inline color code that I wrote two years ago for my long since defunct MUD, KrimsonMUD. This code was added to permit inline color to be added into the prompt without me needing to rely upon the easy color system (if you didn't have it then you wouldn't be able to have color in your prompts), thus you can the inline color in the prompt if you do or don't have the easy_color patch. So now you can colorize the elements of your prompt. I suggest you write a good help file for this, it's rather complex. NOTE: BACKUP YOUR PLAYER FILE BEFORE INSTALLING THIS PATCH, IT WILL CHANGE YOUR PLAYER FILE FORMAT AND YOU WILL NEED TO DELETE YOUR OLD PFILE IN ORDER FOR IT TO WORK. I AM NOT RESPONSIBLE IF THE PATCH DOESN'T WORK, YOU DELETE YOUR ONLY COPY OF YOUR PFILE, AND YOU HAVE TO REMOVE THE PATCH AND SIMPLY END UP WITH A LOST PFILE. MAKE THE BACKUP NOW! IT'S EASY AND SAFER THAN PROCEEDING WITLESSLY! If you don't have inline colors installed in your MUD (the easy_color patch or something other than that), one small change to the SEND_TO_Q() macro after installation of this package will add it. To add inline colors, do the following in comm.h: // add this line char *interpret_colors(char *, bool); // change the SEND_TO_Q() macro to this #define SEND_TO_Q(txt, d) \ write_to_output(interpret_colors(txt, (d->character && \ (PRF_FLAGGED(d->character, PRF_COLOR_1) || \ PRF_FLAGGED(d->character, PRF_COLOR_2)) ? TRUE : FALSE)), d); Now wherever the SEND_TO_Q() macro is called, the ampersand (&) color codes are availible for use, too. Which means that you can put color in your menu, title screen, etc. This is especially useful if you have my query_ansi.diff.gz patch installed. II. Standard (Keep-me-from-court) Disclaimer ============================================ Use this at your own risks. There is (like pretty much all code) some bugs. That is to be expected. I am giving you this, so I expect that, in return, you will send me improvements you add, or report any bugs you encounter. My e-mail address is dkoepke@california.com. You do not need to give me credit for this. I ask, though, that you do not take credit for it. I appreciate any credit you give me. Of course, you have to follow the CircleMUD license... but that goes without saying and you are *obviously* already doing that [pssst, read doc/license.doc if you haven't, yet]. III. Installing =============== Okay, now on to how to install this thing... Move the new_prompt.diff file to the src/ directory. Go into the src/ directory and type: % patch < new_prompt.diff If you get any failures/rejects, look at the .rej files and manually install from that (key: '+' is add, '-' is remove, '!' is change). If the entire thing fails, manually patch from the new_prompt.diff file (same key). VI. Help ======== The following codes are availible for usage in the prompt: &x = black &b = blue &g = green &c = cyan &r = red &m = magenta &y = brown &w = white/gray &X = dark gray &B = light blue &G = light green &C = light cyan &R = light red &M = hot pink &Y = yellow &W = white &0 = black bg &1 = blue bg &2 = green bg &3 = cyan bg &4 = red bg &5 = magenta bg &6 = brown bg &7 = gray bg &f = toggle flash && = ampersand %h = current hitp %H = max. hitp %m = current mana %M = max. mana %v = current move %V = max. move %p = percent of... {hmvx} (%px = percent of exp to level) %o = opponent cond %x = current exp %X = exp to level %g = gold on hand %G = gold in bank %t = tank condition %_ = new line %% = percent sign A few default prompts are accessable via do_display(). Inside the game type "display" without arguments for a list of prompts. V. For the Coders ================= Here's some basics about the enhanced prompt system and how it works: MACRO: GET_PROMPT(ch), ch->player.prompt Retrieves the player's prompt. VARIABLE: char prompt[MAX_INPUT_LENGTH+1], char_file_u The saved version of the player's prompt (maxlen 257 chars) FUNCTION: is_color(c), int/comm.c Given a character 'c' it returns a proper number if the code is one of our special color codes, -1 if it's a '&', 1 if it's an 'f', or zero if none of the above. FUNCTION: prompt_str(ch), char pointer/comm.c Takes _ch_'s prompt, seeks out any special characters in it and replaces them with the proper thing. CODE: beginning of prompt_str(), comm.c In the beginning of prompt_str(), there is an if() check that simply sees if the player's prompt is NULL. If so, it uses a default prompt for them. The default prompt should be changed to include your MUD's name instead of "Unnamed MUD". IV. Other Patches By Me ======================= The below are availible at the CircleMUD anonymous ftp site (see below for the address): Filename: new.do_who.diff.gz, /pub/CircleMUD/contrib/code Usage : A replacement for do_who(), it splits apart immortals and mortals, gives immortals a "who title" ("Immortal" instead of "31 War"), keeps a count of highest players on per boot, and a little bit more. Filename: mount.diff.gz, /pub/CircleMUD/contrib/code Usage : A small, basic mount system with a TAME skill, your mount taking the move point cost, and a little more. Filename: obj_mail.diff.gz, /pub/CircleMUD/contrib/code Usage : Permits attaching of objects to mail Filename: query_ansi.diff.gz, /pub/CircleMUD/contrib/code Usage : A patch to query a logging in user for whether they want ANSI color support on/off before display of the title screen. Actually quite useful... Filename: multi_hit.diff.gz, /pub/CircleMUD/contrib/code Usage : Adds multiple attacks per round and the connected skills. VII. Popular CircleMUD Sites ============================ Anonymous ftp : [ftp.circlemud.org] Homepage : [http://www.circlemud.org/] Code snippets : [http://cspo.queensu.ca/~fletcher/Circle/Snippet/] Have fun and godspeed, -- Daniel Koepke dkoepke@california.com Forgive me father, for I am sin.