: Updated Prompt with HMV/Color/Gold/Fight/Exit/Experience Display / A minor fix, *X will no longer print when color&dispexp is off. / Victim Percentage-Hit added. / Added gold to the prompt line ;). Ok, first of all, this code is insane ;). I lost my sanity somewhere in the middle and just mashed in some ansi codes, i've heard people talking about problems with colored prompts, this should solve it. The colors will change depending on the percentage of your stats. If you are fighting, it will display the mobhealth (in text). I added all the standard diffs if you want to change the colors on your own. This prompt will let you enable exit display. I've also made some changes to the do_display command to make prompt define easier. Set the #define MAX_PROMPT_LENGTH in structs.h to something around 180 -----------------------------[ Step One ]----------------------------- > in file structs.h > preference flags > search for #define PRF_ROOMFLAGS > add: (change the numbers to fit your list) #define PRF_DISPEXP (1 << 22) #define PRF_DISPEXITS (1 << 23) #define PRF_DISPGOLD (1 << 24) -----------------------------[ Step Two ]----------------------------- > in file act.other.c > replace ACMD(do_display) with: ACMD(do_display) { size_t i; if (IS_NPC(ch)) { send_to_char("Mosters don't need displays. Go away.\r\n", ch); return; } skip_spaces(&argument); if (!*argument) { send_to_char("Usage: prompt { H | M | V | G | X | E } | all | none }\r\n", ch); return; } if (!str_cmp(argument, "on") || !str_cmp(argument, "all")) SET_BIT(PRF_FLAGS(ch), PRF_DISPHP | PRF_DISPMANA | PRF_DISPMOVE | PRF_DISPEXP ); else if (!str_cmp(argument, "off") || !str_cmp(argument, "none")) REMOVE_BIT(PRF_FLAGS(ch), PRF_DISPHP | PRF_DISPMANA | PRF_DISPMOVE | PRF_DISPEXP | PRF_DISPEXITS | PRF_DISPGOLD); else { for (i = 0; i < strlen(argument); i++) { switch (LOWER(argument[i])) { case 'h': if (PRF_FLAGGED(ch, PRF_DISPHP)) REMOVE_BIT(PRF_FLAGS(ch), PRF_DISPHP); else SET_BIT(PRF_FLAGS(ch), PRF_DISPHP); break; case 'm': if (PRF_FLAGGED(ch, PRF_DISPMANA)) REMOVE_BIT(PRF_FLAGS(ch), PRF_DISPMANA); else SET_BIT(PRF_FLAGS(ch), PRF_DISPMANA); break; case 'v': if (PRF_FLAGGED(ch, PRF_DISPMOVE)) REMOVE_BIT(PRF_FLAGS(ch), PRF_DISPMOVE); else SET_BIT(PRF_FLAGS(ch), PRF_DISPMOVE); break; case 'g': if (PRF_FLAGGED(ch, PRF_DISPGOLD)) REMOVE_BIT(PRF_FLAGS(ch), PRF_DISPGOLD); else SET_BIT(PRF_FLAGS(ch), PRF_DISPGOLD); break; case 'x': if (PRF_FLAGGED(ch, PRF_DISPEXP)) REMOVE_BIT(PRF_FLAGS(ch), PRF_DISPEXP); else SET_BIT(PRF_FLAGS(ch), PRF_DISPEXP); break; case 'e': if (PRF_FLAGGED(ch, PRF_DISPEXITS)) REMOVE_BIT(PRF_FLAGS(ch), PRF_DISPEXITS); else SET_BIT(PRF_FLAGS(ch), PRF_DISPEXITS); break; default: send_to_char("Usage: prompt { H | M | V | X | E } | all | none }\r\n", ch); return; } } send_to_char(OK, ch); } } ----------------------------[ Step Three ]---------------------------- > .. this is the insane part .. > in file comm.c > replace char *make_prompt with: char *make_prompt(struct descriptor_data *d) { static char prompt[MAX_PROMPT_LENGTH -1]; int door; int percent; /* Note, prompt is truncated at MAX_PROMPT_LENGTH chars (structs.h )*/ if (d->showstr_count) { sprintf(prompt, "\r[ Return to continue, (q)uit, (r)efresh, (b)ack, or page number (%d/%d) ]", d->showstr_page, d->showstr_count); } else if (d->str) strcpy(prompt, "] "); else if (STATE(d) == CON_PLAYING && !IS_NPC(d->character)) { int count = 0; *prompt = '\0'; if (PRF_FLAGGED(d->character, PRF_AFK)) count += sprintf(prompt + count, "[AFK] "); if (PLR_FLAGGED(d->character, PLR_CRIMINAL)) count += sprintf(prompt + count, "[Jailed] "); if (GET_INVIS_LEV(d->character)) count += sprintf(prompt + count, "i%d ", GET_INVIS_LEV(d->character)); if (PRF_FLAGGED(d->character, PRF_DISPHP)) { if (COLOR_LEV(d->character) >= C_CMP) { if (GET_MAX_HIT(d->character) > 0) percent = (100 * GET_HIT(d->character)) / GET_MAX_HIT(d->character); else percent = -1; if (percent >= 100) count += sprintf(prompt + count, "\x1B[0;32m%dH\x1B[0;0m ", GET_HIT(d->character)); else if (percent >= 90) count += sprintf(prompt + count, "\x1B[0;32m%dH\x1B[0;0m ", GET_HIT(d->character)); else if (percent >= 75) count += sprintf(prompt + count, "\x1B[0;32m%dH\x1B[0;0m ", GET_HIT(d->character)); else if (percent >= 50) count += sprintf(prompt + count, "\x1B[0;0m%dH\x1B[0;0m ", GET_HIT(d->character)); else if (percent >= 30) count += sprintf(prompt + count, "\x1B[0;0m%dH\x1B[0;0m ", GET_HIT(d->character)); else if (percent >= 15) count += sprintf(prompt + count, "\x1B[1;31m%dH\x1B[0;0m ", GET_HIT(d->character)); else if (percent >= 0) count += sprintf(prompt + count, "\x1B[1;31m%dH\x1B[0;0m ", GET_HIT(d->character)); else count += sprintf(prompt + count, "\x1B[1;31m%dH\x1B[0;0m ", GET_HIT(d->character)); } else count += sprintf(prompt + count, "%dH ", GET_HIT(d->character)); } if (PRF_FLAGGED(d->character, PRF_DISPMANA)) { if (COLOR_LEV(d->character) >= C_CMP) { if (GET_MAX_MANA(d->character) > 0) percent = (100 * GET_MANA(d->character)) / GET_MAX_MANA(d->character); else percent = -1; if (percent >= 100) count += sprintf(prompt + count, "\x1B[1;36m%dM\x1B[0;0m ", GET_MANA(d->character)); else if (percent >= 90) count += sprintf(prompt + count, "\x1B[1;36m%dM\x1B[0;0m ", GET_MANA(d->character)); else if (percent >= 75) count += sprintf(prompt + count, "\x1B[1;36m%dM\x1B[0;0m ", GET_MANA(d->character)); else if (percent >= 50) count += sprintf(prompt + count, "\x1B[0;36m%dM\x1B[0;0m ", GET_MANA(d->character)); else if (percent >= 30) count += sprintf(prompt + count, "\x1B[0;36m%dM\x1B[0;0m ", GET_MANA(d->character)); else if (percent >= 15) count += sprintf(prompt + count, "\x1B[1;35m%dM\x1B[0;0m ", GET_MANA(d->character)); else if (percent >= 0) count += sprintf(prompt + count, "\x1B[1;35m%dM\x1B[0;0m ", GET_MANA(d->character)); else count += sprintf(prompt + count, "\x1B[1;35m%dM\x1B[0;0m ", GET_MANA(d->character)); } else count += sprintf(prompt + count, "%dM ", GET_MANA(d->character)); } if (PRF_FLAGGED(d->character, PRF_DISPMOVE)) { if (COLOR_LEV(d->character) >= C_CMP) { if (GET_MAX_MOVE(d->character) > 0) percent = (100 * GET_MOVE(d->character)) / GET_MAX_MOVE(d->character); else percent = -1; if (percent >= 100) count += sprintf(prompt + count, "\x1B[0;33m%dV\x1B[0;0m ", GET_MOVE(d->character)); else if (percent >= 90) count += sprintf(prompt + count, "\x1B[0;33m%dV\x1B[0;0m ", GET_MOVE(d->character)); else if (percent >= 75) count += sprintf(prompt + count, "\x1B[0;33m%dV\x1B[0;0m ", GET_MOVE(d->character)); else if (percent >= 50) count += sprintf(prompt + count, "\x1B[0;33m%dV\x1B[0;0m ", GET_MOVE(d->character)); else if (percent >= 30) count += sprintf(prompt + count, "\x1B[0;33m%dV\x1B[0;0m ", GET_MOVE(d->character)); else if (percent >= 15) count += sprintf(prompt + count, "\x1B[0;33m%dV\x1B[0;0m ", GET_MOVE(d->character)); else if (percent >= 0) count += sprintf(prompt + count, "\x1B[0;33m%dV\x1B[0;0m ", GET_MOVE(d->character)); else count += sprintf(prompt + count, "\x1B[0;33m%dV\x1B[0;0m ", GET_MOVE(d->character)); } else count += sprintf(prompt + count, "%dV ", GET_MOVE(d->character)); } if (PRF_FLAGGED(d->character, PRF_DISPGOLD)) { if (COLOR_LEV(d->character) >= C_CMP) count += sprintf(prompt + count, "\x1B[1;33m%dG\x1B[0;0m ", GET_GOLD(d->character)); else count += sprintf(prompt + count, "%dG ", GET_GOLD(d->character)); } if (GET_LEVEL(d->character) < LVL_IMMORT -1) { if (PRF_FLAGGED(d->character, PRF_DISPEXP)) { if (COLOR_LEV(d->character) >= C_CMP) count += sprintf(prompt + count, "\x1B[0;36m%dX\x1B[0;0m ", level_exp(GET_CLASS(d->character), GET_LEVEL(d->character) + 1) - GET_EXP(d->character)); else count += sprintf(prompt + count, "%dX ", level_exp(GET_CLASS(d->character), GET_LEVEL(d->character) + 1) - GET_EXP(d->character)); }} if (GET_LEVEL(d->character) >= LVL_IMMORT -1) { if (PRF_FLAGGED(d->character, PRF_DISPEXP)) { if (COLOR_LEV(d->character) >= C_CMP) count += sprintf(prompt + count, "\x1B[0;36m0X\x1B[0;0m "); else count += sprintf(prompt + count, "0X "); }} if (PRF_FLAGGED(d->character, PRF_DISPEXITS)) { for (door = 0; door < NUM_OF_DIRS; door++) if (EXIT(d->character, door) && EXIT(d->character, door)->to_room != NOWHERE && !EXIT_FLAGGED(EXIT(d->character, door), EX_CLOSED)) count += sprintf(prompt + count, "%c ", LOWER(*dirs[door])); } if (FIGHTING(d->character)) { if (COLOR_LEV(d->character) >= C_CMP) { sprintf(prompt + strlen(prompt), "\x1B[1;37mMob: \x1B[0;0m"); } else { sprintf(prompt + strlen(prompt), "Mob: "); } if (COLOR_LEV(d->character) >= C_CMP) { if (GET_MAX_HIT(FIGHTING(d->character)) > 0) percent = (100 * GET_HIT(FIGHTING(d->character))) / GET_MAX_HIT(FIGHTING(d->character)); else percent = -1; sprintf(prompt + strlen(prompt), "(%d%%) ", (int)(GET_HIT(FIGHTING(d->character))*100)/GET_MAX_HIT(FIGHTING(d->character))); if (percent >= 100) sprintf(prompt + strlen(prompt), "\x1B[0;32mExcellent condition\x1B[0;0m "); else if (percent >= 90) sprintf(prompt + strlen(prompt), "\x1B[0;32mA few scratches\x1B[0;0m "); else if (percent >= 75) sprintf(prompt + strlen(prompt), "\x1B[0;32mSmall wounds and bruises\x1B[0;0m "); else if (percent >= 50) sprintf(prompt + strlen(prompt), "\x1B[0;0mQuite a few wounds\x1B[0;0m "); else if (percent >= 30) sprintf(prompt + strlen(prompt), "\x1B[0;0mBig nasty wounds and scratches\x1B[0;0m "); else if (percent >= 15) sprintf(prompt + strlen(prompt), "\x1B[1;31mPretty hurt\x1B[0;0m "); else if (percent >= 0) sprintf(prompt + strlen(prompt), "\x1B[1;31mAwful condition\x1B[0;0m "); else sprintf(prompt + strlen(prompt), "\x1B[1;31mBleeding awfully from big wounds\x1B[0;0m "); } else { if (GET_MAX_HIT(FIGHTING(d->character)) > 0) percent = (100 * GET_HIT(FIGHTING(d->character))) / GET_MAX_HIT(FIGHTING(d->character)); else percent = -1; sprintf(prompt + strlen(prompt), "(%d%%) ", (int)(GET_HIT(FIGHTING(d->character))*100)/GET_MAX_HIT(FIGHTING(d->character))); if (percent >= 100) sprintf(prompt + strlen(prompt), "Excellent condition "); else if (percent >= 90) sprintf(prompt + strlen(prompt), "A few scratches "); else if (percent >= 75) sprintf(prompt + strlen(prompt), "Small wounds and bruises "); else if (percent >= 50) sprintf(prompt + strlen(prompt), "Quite a few wounds "); else if (percent >= 30) sprintf(prompt + strlen(prompt), "Big nasty wounds and scratches "); else if (percent >= 15) sprintf(prompt + strlen(prompt), "Pretty hurt "); else if (percent >= 0) sprintf(prompt + strlen(prompt), "Awful condition "); else sprintf(prompt + strlen(prompt), "Bleeding awfully from big wounds "); }} strcat(prompt, ">\x1B[0;0m "); } else if (STATE(d) == CON_PLAYING && IS_NPC(d->character)) sprintf(prompt, "%s> ", GET_NAME(d->character)); else *prompt = '\0'; return (prompt); } ---------------------------------------------------------------------- Do whatever you want with this piece of code. Enjoy it, hate it, smash it, remake it...... If you decide to use it, please send me a mail, including the address to your mud. A line in your credit file is of course also appreciated / Hugor (hugor@freebox.com)