29 May, 2012, halmud wrote in the 1st comment:
Votes: 0
Anyone here ever fooled around with displaying Mana &/or HP regen beside a prompt?
29 May, 2012, plamzi wrote in the 2nd comment:
Votes: 0
Your question is too broad to be answered in a useful way (e. g. I can say 'yes' and it will be of no help to you). What exactly are you trying to accomplish?
29 May, 2012, halmud wrote in the 3rd comment:
Votes: 0
Example: 500H/250M/200v 5Hrg 4Mrg

Where 5 is health regen per tic, 4 is mana regen per tic
29 May, 2012, plamzi wrote in the 4th comment:
Votes: 0
halmud said:
Example: 500H/250M/200v 5Hrg 4Mrg

Where 5 is health regen per tic, 4 is mana regen per tic


So you're talking about custom prompt options that show additional info.

If you have existing custom prompt code, it should be pretty easy to extend that with new variables (e. g. '%h', '%m') and then replace those vars with the additional stats you want to display, calculated on the fly if needed.

If you don't have such code, let me know–I can paste mine. We share the same codebase so it should mostly just work.
29 May, 2012, halmud wrote in the 5th comment:
Votes: 0
Yeah I don't have custom prompts yet, but that would be nice yes :)

Your help is greatly appreciated.
29 May, 2012, plamzi wrote in the 6th comment:
Votes: 0
Here you go. Note that I edited a lot of stuff out on the fly so I may have introduced some typos. Also, you'll have to add and rig up the GET_PROMPT macro, take care of saving and loading the custom prompt string together with the player, etc. My code won't do you any good there because it's very different from stock.

void make_prompt(struct descriptor_data * d)
{
int percent;
char prompt[MAX_INPUT_LENGTH*5];
char *pnt;

if (d->showstr_count) {
sprintf(prompt, "\r\n[ Return to continue, [q]uit, [r]efresh, [b]ack, or page # (%d/%d) ]", d->showstr_page, d->showstr_count);
write_to_descriptor(d->descriptor, prompt);
}
else if (!d->connected) {
char prompt[MAX_INPUT_LENGTH];

*prompt = '\0';

if (!PROMPT_STR(d->character)) { // no custom prompt, go for usual

if (GET_PROMPT(d->character) != 0)
sprintf(prompt, "%s[%s", CBWHT(d->character,C_NRM), CCNRM(d->character,C_NRM));

if (GET_INVIS_LEV(d->character))
sprintf(prompt, "%si%d ", prompt, GET_INVIS_LEV(d->character));

if (IS_SET(GET_PROMPT(d->character), PRM_ABSOLUTE)) {

if (IS_SET(GET_PROMPT(d->character), PRM_HP))
sprintf(prompt, "%s%s%d%shp%s ", prompt, CBCYN(d->character,C_NRM),
GET_HIT(d->character),CCCYN(d->character,C_NRM), CCNRM(d->character,C_NRM));

if (IS_SET(GET_PROMPT(d->character), PRM_MANA))
sprintf(prompt, "%s%s%d%sm%s ", prompt, CBMAG(d->character,C_NRM),
GET_MANA(d->character), CCMAG(d->character,C_NRM), CCNRM(d->character,C_NRM));

if (IS_SET(GET_PROMPT(d->character), PRM_MOVE))
sprintf(prompt, "%s%s%d%sv%s ", prompt, CBBLU(d->character,C_NRM),
GET_MOVE(d->character), CCBLU(d->character,C_NRM), CCNRM(d->character,C_NRM));

} else if (IS_SET(GET_PROMPT(d->character), PRM_CURRMAX)) {

if (IS_SET(GET_PROMPT(d->character), PRM_HP))
sprintf(prompt, "%s%s%d(%d)%shp%s ", prompt, CBCYN(d->character,C_NRM),
GET_HIT(d->character),GET_MAX_HIT(d->character),CCCYN(d->character,C_NRM), CCNRM(d->character,C_NRM));

if (IS_SET(GET_PROMPT(d->character), PRM_MANA))
sprintf(prompt, "%s%s%d(%d)%sm%s ", prompt, CBMAG(d->character,C_NRM),
GET_MANA(d->character), GET_MAX_MANA(d->character), CCMAG(d->character,C_NRM), CCNRM(d->character,C_NRM));

if (IS_SET(GET_PROMPT(d->character), PRM_MOVE))
sprintf(prompt, "%s%s%d(%d)%sv%s ", prompt, CBBLU(d->character,C_NRM),
GET_MOVE(d->character), GET_MAX_MOVE(d->character), CCBLU(d->character,C_NRM), CCNRM(d->character,C_NRM));

} else {

if (IS_SET(GET_PROMPT(d->character), PRM_HP))
sprintf(prompt, "%s%s%d%%%shp%s ", prompt, CBCYN(d->character,C_NRM),
(int) (((float) GET_HIT(d->character)/(float)GET_MAX_HIT(d->character))*100),CCCYN(d->character,C_NRM),
CCNRM(d->character,C_NRM));

if (IS_SET(GET_PROMPT(d->character), PRM_MANA))
sprintf(prompt, "%s%s%d%%%sm%s ", prompt, CBMAG(d->character,C_NRM),
(int) (((float) GET_MANA(d->character)/(float)GET_MAX_MANA(d->character))*100), CCMAG(d->character,C_NRM), CCNRM(d->character,C_NRM));

if (IS_SET(GET_PROMPT(d->character), PRM_MOVE))
sprintf(prompt, "%s%s%d%%%sv%s ", prompt, CBBLU(d->character,C_NRM),
(int) (((float) GET_MOVE(d->character)/(float)GET_MAX_MOVE(d->character))*100), CCBLU(d->character,C_NRM), CCNRM(d->character,C_NRM));

}

if (IS_SET(GET_PROMPT(d->character), PRM_DIAGNOSE) && FIGHTING(d->character)) {

if (GET_MAX_HIT(FIGHTING(d->character)) > 0)
percent = (100 * GET_HIT(FIGHTING(d->character))) / GET_MAX_HIT(FIGHTING(d->character));
else
percent = -1;

if (percent >= 100)
sprintf(buf, "excellent");
else if (percent >= 90)
sprintf(buf, "scratched");
else if (percent >= 80)
sprintf(buf, "small bruises");
else if (percent >= 70)
sprintf(buf, "big bruises");
else if (percent >= 60)
sprintf(buf, "light wounds");
else if (percent >= 50)
sprintf(buf, "wounded");
else if (percent >= 40)
sprintf(buf, "nasty");
else if (percent >= 30)
sprintf(buf, "hurt");
else if (percent >= 20)
sprintf(buf, "awful");
else if (percent >= 10)
sprintf(buf, "bleeding");
else if (percent >= 0) {
if (IS_APP(d->character))
sprintf(buf, "bleeding");
else
sprintf(buf, "mortally wounded");
}
else {
sprintf(buf, "mortally wounded");
}

sprintf(prompt, "%s%s(%s%s%s)%s ", prompt, CCRED(d->character,C_NRM), CBRED(d->character,C_NRM),
buf, CCRED(d->character,C_NRM), CCNRM(d->character,C_NRM));
}
if (IS_SET(GET_PROMPT(d->character), PRM_EXP)) {
if (GET_LEVEL(d->character) >= LVL_IMMORT) {
sprintf(prompt, "%s%s(%s-%s)%s ", prompt, CBCYN(d->character,C_NRM), CCCYN(d->character,C_NRM),
CBCYN(d->character,C_NRM), CCNRM(d->character,C_NRM));
} else {
sprintf(prompt, "%s%s(%s%d%s)%s ", prompt, CBCYN(d->character,C_NRM), CCCYN(d->character,C_NRM),
(titles[(int) GET_CLASS(d->character)][GET_LEVEL(d->character) + 1].exp) - GET_EXP(d->character),
CBCYN(d->character,C_NRM), CCNRM(d->character,C_NRM));
}
}
if (GET_PROMPT(d->character) == 0)
sprintf(prompt, "%s> ", prompt);
else {
prompt[strlen(prompt)-1] = '\0';
sprintf(prompt, "%s%s]%s>%s ", prompt, CBWHT(d->character,C_NRM), CBCYN(d->character,C_NRM), CCNRM(d->character,C_NRM));
}
/* add CR to default prompt by default */
sprintf(prompt, "%s\r\n", prompt);

} else { // CUSTOM PROMPT!!!!

pnt = PROMPT_STR(d->character);

while (*pnt != '\0') {
if (*pnt == '%') {
pnt++;
if (*pnt != '\0')
switch (*pnt) {
case 'h':
sprintf(prompt,"%s%d", prompt, GET_HIT(d->character));
break;
case 'H':
sprintf(prompt,"%s%d", prompt, GET_MAX_HIT(d->character));
break;
case 'm':
sprintf(prompt,"%s%d", prompt, GET_MANA(d->character));
break;
case 'M':
sprintf(prompt,"%s%d", prompt, GET_MAX_MANA(d->character));
break;
case 'v':
sprintf(prompt,"%s%d", prompt, GET_MOVE(d->character));
break;
case 'V':
sprintf(prompt,"%s%d", prompt, GET_MAX_MOVE(d->character));
break;
case '1':
sprintf(prompt,"%s%d", prompt, (int) (((float) GET_HIT(d->character)/(float)GET_MAX_HIT(d->character))*100));
break;
case '2':
sprintf(prompt,"%s%d", prompt, (int) (((float) GET_MANA(d->character)/(float)GET_MAX_MANA(d->character))*100));
break;
case '3':
sprintf(prompt,"%s%d", prompt, (int) (((float) GET_MOVE(d->character)/(float)GET_MAX_MOVE(d->character))*100));
break;
case 'e':
if (GET_LEVEL(d->character) < LVL_MAXMORTAL)
sprintf(prompt,"%s%d", prompt, (titles[(int) GET_CLASS(d->character)][GET_LEVEL(d->character) + 1].exp) - GET_EXP(d->character));
else
sprintf(prompt,"%s%.1fM", prompt, ((float)GET_EXP(d->character)/(float)1000000));

break;
case 'E':
if (GET_EXP(d->character) > 1000000)
sprintf(prompt,"%s%.1fM", prompt, ((float)GET_EXP(d->character)/(float)1000000));
else
sprintf(prompt,"%s%d", prompt, GET_EXP(d->character));
break;
case 'w':
sprintf(prompt,"%s%d", prompt, GET_WIMP_LEV(d->character));
break;
case 'r':
sprintf(prompt,"%s%d", prompt, GET_RECALL(d->character));
break;
case 's':

if (FIGHTING(d->character)) {
if (GET_MAX_HIT(FIGHTING(d->character)) > 0)
percent = (100 * GET_HIT(FIGHTING(d->character))) / GET_MAX_HIT(FIGHTING(d->character));
else
percent = -1;

if (percent >= 100)
sprintf(prompt, "%sexcellent", prompt);
else if (percent >= 90)
sprintf(prompt, "%sscratched", prompt);
else if (percent >= 80)
sprintf(prompt, "%ssmall bruises", prompt);
else if (percent >= 70)
sprintf(prompt, "%sbig bruises", prompt);
else if (percent >= 60)
sprintf(prompt, "%slight wounds", prompt);
else if (percent >= 50)
sprintf(prompt, "%swounded", prompt);
else if (percent >= 40)
sprintf(prompt, "%snasty", prompt);
else if (percent >= 30)
sprintf(prompt, "%shurt", prompt);
else if (percent >= 20)
sprintf(prompt, "%sawful", prompt);
else if (percent >= 10)
sprintf(prompt, "%sbleeding", prompt);
else if (percent >= 0) {
if (IS_APP(d->character))
sprintf(prompt, "%sbleeding", prompt);
else
sprintf(prompt, "%smortally wounded", prompt);
}
else
sprintf(prompt, "%smortally wounded", prompt);

} else // no info, just a dash
sprintf(prompt,"%s-",prompt);

break;
case 'S':
if (GET_POS(d->character) == POS_SLEEPING)
sprintf(prompt,"%ss", prompt);
else if (GET_POS(d->character) == POS_RESTING || GET_POS(d->character) == POS_SITTING)
sprintf(prompt,"%sr", prompt);
else if (GET_POS(d->character) == POS_MORTALLYW || GET_POS(d->character) == POS_INCAP)
sprintf(prompt,"%sw", prompt);
else if (GET_POS(d->character) == POS_STUNNED)
sprintf(prompt,"%st", prompt);
else {
if (IS_AFFECTED(d->character, AFF_INVISIBLE) || IS_AFFECTED(d->character, AFF_HIDE))
sprintf(prompt,"%si", prompt);
if (IS_AFFECTED(d->character, AFF_FLY))
sprintf(prompt,"%sf", prompt);
if (IS_AFFECTED(d->character, AFF_SANCTUARY))
sprintf(prompt,"%sg", prompt);
}
break;

case 'c':
sprintf(prompt,"%s%d/", prompt, IS_CARRYING_W(d->character));
sprintf(prompt,"%s%d-", prompt, CAN_CARRY_W(d->character));
sprintf(prompt,"%s%d/", prompt, IS_CARRYING_N(d->character));
sprintf(prompt,"%s%d", prompt, CAN_CARRY_N(d->character));
break;
case 'k':
sprintf(prompt,"%s%d", prompt, GET_KILLS(d->character));
break;
case 'y':
sprintf(prompt,"%s%d", prompt, GET_AGE(d->character));
break;
case 'a':
sprintf(prompt,"%s%d", prompt, GET_ALIGNMENT(d->character));
break;
case 'q':
sprintf(prompt,"%s%d", prompt, (int)GET_QP(d->character));
break;
case 'A':
sprintf(prompt,"%s%d", prompt, GET_AC(d->character));
break;
case 'd':
sprintf(prompt,"%s%d", prompt, GET_DAMROLL(d->character));
break;
case 'D':
sprintf(prompt,"%s%d", prompt, GET_HITROLL(d->character));
break;
case 'g':
sprintf(prompt,"%s%d", prompt, GET_GOLD(d->character));
break;
case 'G':
sprintf(prompt,"%s%d", prompt, GET_BANK_GOLD(d->character));
break;
case 'l':
sprintf(prompt,"%s%d", prompt, GET_LEVEL(d->character));
break;
case 't':
if (FIGHTING(d->character)) sprintf(prompt,"%s%s", prompt, GET_NAME(FIGHTING(d->character)));
break;
/* Target's target prompt option. Finds your target, then finds their target. */
case 'T':
if (FIGHTING(d->character) && FIGHTING(FIGHTING(d->character)))
sprintf(prompt, "%s%s", prompt, GET_NAME(FIGHTING(FIGHTING(d->character))));
break;
case '%':
sprintf(prompt,"%s\r\n", prompt);
break;
default:
sprintf(prompt, "%s%c", prompt, *pnt);
break;
}
else
;
} else
sprintf(prompt, "%s%c", prompt, *pnt);

pnt++;

} // end of while

if (!strstr(prompt, "\r\n"))
sprintf(prompt, "%s ", prompt);

} // end of custom prompt part!

/* color support */
if(d->character)
proc_color(prompt, (clr(d->character, C_CMP)));

write_to_descriptor(d->descriptor, prompt);
/* handle snooping */
if (d->snoop_by)
SEND_TO_Q(prompt, d->snoop_by);
}
else
write_to_descriptor(d->descriptor, prompt);
}
}
29 May, 2012, halmud wrote in the 7th comment:
Votes: 0
Thanks, I'll see what I can do with it :)
29 May, 2012, Exodus wrote in the 8th comment:
Votes: 0
And here I thought we were talking about representation of regeneration/degeneration. With that in mind, has anyone successfully implemented a visual representation of health regen? I was thinking of something ala Guildwars where each point of regeneration regenerated health at a certain speed. Tying it to ticks or system pulses seems a bit too resource intensive when every entity in the game has to track regeneration of its health individually.

Maybe a VT102 interface could solve that? It would be neat to have a health bar that continuously increments in real time (like a progress bar) up to full health again when you are damaged and regenerating.
29 May, 2012, KaVir wrote in the 9th comment:
Votes: 0
Exodus said:
And here I thought we were talking about representation of regeneration/degeneration. With that in mind, has anyone successfully implemented a visual representation of health regen?

You mean like this?

Exodus said:
Maybe a VT102 interface could solve that? It would be neat to have a health bar that continuously increments in real time (like a progress bar) up to full health again when you are damaged and regenerating.

I offer TV100 energy bars as well, but I prefer the graphical ones.
30 May, 2012, Exodus wrote in the 10th comment:
Votes: 0
Perhaps exactly like that. What is the update interval?
30 May, 2012, KaVir wrote in the 11th comment:
Votes: 0
It updates when data changes, and the regenerate rate in my mud is by the second, so when you're healing the energy bars update once per second.
0.0/11