I already changed THANKS anyway :-) I thinked... thinked... tried tried tried tried... and after a day of try i did make this(WORKS!): This code will make life/mana/move yellow at 66% and red at 33% and green with more than 66%: char *make_prompt(struct descriptor_data *d) { static char prompt[MAX_PROMPT_LENGTH]; /* Note, prompt is truncated at MAX_PROMPT_LENGTH chars (structs.h) */ if (d->str) strcpy(prompt, "] "); /* strcpy: OK (for 'MAX_PROMPT_LENGTH >= 3') */ else if (d->showstr_count) { snprintf(prompt, sizeof(prompt), "\r\n[ Return to continue, (q)uit, (r)efresh, (b)ack, or page number (%d/%d) ]", d->showstr_page, d->showstr_count); } else if (STATE(d) == CON_PLAYING && !IS_NPC(d->character)) { int count; size_t len = 0; *prompt = '\0'; if (GET_INVIS_LEV(d->character) && len < sizeof(prompt)) { count = snprintf(prompt + len, sizeof(prompt) - len, "i%d ", GET_INVIS_LEV(d->character)); if (count >= 0) len += count; } if (PRF_FLAGGED(d->character, PRF_DISPHP) && len < sizeof(prompt)) { if (COLOR_LEV(d->character) >= C_CMP) { if (GET_HIT(d->character) > GET_MAX_HIT(d->character)/1.5){ count = snprintf(prompt + len, sizeof(prompt) - len, "\x1B[1;32m%dHp ", GET_HIT(d->character)); } if (GET_HIT(d->character) <= GET_MAX_HIT(d->character)/1.5){ count = snprintf(prompt + len, sizeof(prompt) - len, "\x1B[1;33m%dHp ", GET_HIT(d->character)); } if (GET_HIT(d->character) <= GET_MAX_HIT(d->character)/3) { count = snprintf(prompt + len, sizeof(prompt) - len, "\x1B[1;31m%dHp ", GET_HIT(d->character)); } } else if (COLOR_LEV(d->character) < C_CMP) { count = snprintf(prompt + len, sizeof(prompt) - len, "%dHp ", GET_HIT(d->character)); } if (count >= 0) len += count; } if (PRF_FLAGGED(d->character, PRF_DISPMANA) && len < sizeof(prompt)) { if (COLOR_LEV(d->character) >= C_CMP) { if (GET_MANA(d->character) > GET_MAX_MANA(d->character)/1.5){ count = snprintf(prompt + len, sizeof(prompt) - len, "\x1B[1;32m%dMn ", GET_MANA(d->character)); } if (GET_MANA(d->character) <= GET_MAX_MANA(d->character)/1.5){ count = snprintf(prompt + len, sizeof(prompt) - len, "\x1B[1;33m%dMn ", GET_MANA(d->character)); } if (GET_MANA(d->character) <= GET_MAX_MANA(d->character)/3) { count = snprintf(prompt + len, sizeof(prompt) - len, "\x1B[1;31m%dMn ", GET_MANA(d->character)); } } else if (COLOR_LEV(d->character) < C_CMP) { count = snprintf(prompt + len, sizeof(prompt) - len, "%dMn ", GET_MANA(d->character)); } if (count >= 0) len += count; } if (PRF_FLAGGED(d->character, PRF_DISPMOVE) && len < sizeof(prompt)) { if (COLOR_LEV(d->character) >= C_CMP) { if (GET_MOVE(d->character) > GET_MAX_MOVE(d->character)/1.5){ count = snprintf(prompt + len, sizeof(prompt) - len, "\x1B[1;32m%dMv", GET_MOVE(d->character)); } if (GET_MOVE(d->character) <= GET_MAX_MOVE(d->character)/1.5){ count = snprintf(prompt + len, sizeof(prompt) - len, "\x1B[1;33m%dMv", GET_MOVE(d->character)); } if (GET_MOVE(d->character) <= GET_MAX_MOVE(d->character)/3) { count = snprintf(prompt + len, sizeof(prompt) - len, "\x1B[1;31m%dMv", GET_MOVE(d->character)); } } else if (COLOR_LEV(d->character) < C_CMP) { count = snprintf(prompt + len, sizeof(prompt) - len, "%dMv", GET_MOVE(d->character)); } if (count >= 0) len += count; } if (len < sizeof(prompt)) strncat(prompt, "\x1B[37m>\x1B[0;0m", sizeof(prompt) - len - 1); /* strncat: OK */ } else if (STATE(d) == CON_PLAYING && IS_NPC(d->character)) snprintf(prompt, sizeof(prompt), "%s> ", GET_NAME(d->character)); else *prompt = '\0'; return (prompt); } --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.381 / Virus Database: 214 - Release Date: 02/08/02 -- +---------------------------------------------------------------+ | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html | | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html | | Newbie List: http://groups.yahoo.com/group/circle-newbies/ | +---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 06/25/03 PDT