Hey all,
I've been reading these forums off and on now for years. I recently started mucking around with the Rom2.4b6 codebase yet again and am looking for some assistance on setting up a prefix-prompt that will occur only during combat.
I've come to think that the best way to accomplish this is doing so within the send_to_char functions:
void send_to_char (const char *txt, CHAR_DATA * ch)
{
const char *point;
char *point2;
char buf[MAX_STRING_LENGTH * 4];
int skip = 0;
buf[0] = '\0';
point2 = buf;
if (txt && ch->desc)
{
if (IS_SET (ch->act, PLR_COLOUR))
{
for (point = txt; *point; point++)
{
if (*point == '{')
{
point++;
skip = colour (*point, ch, point2);
while (skip-- > 0)
++point2;
continue;
}
*point2 = *point;
*++point2 = '\0';
}
*point2 = '\0';
write_to_buffer (ch->desc, buf, point2 - buf);
}
else
{
for (point = txt; *point; point++)
{
if (*point == '{')
{
point++;
continue;
}
*point2 = *point;
*++point2 = '\0';
}
*point2 = '\0';
write_to_buffer (ch->desc, buf, point2 - buf);
}
}
return;
}
The issue I'm having is this is a bit above my RUSTY programming expertise. I ripped out all the base Rom combat systems and implemented a weapon speed-type approach; fast weapons are causing a lot of prompt-redrawing spam, unfortunately. Here's an example over about 6 seconds:
Quote:
<546/546 hp 220/220 m 460/460 mv 60000/1000 xp>
Your slash hits Monster for 139 damage.
Your slash hits Monster for 152 damage.
<546/546 hp 220/220 m 460/460 mv 60000/1000 xp>
Your slash hits Monster for 135 damage.
Your slash hits Monster for 161 damage.
Testing tells you, 'testtest'.
<546/546 hp 220/220 m 460/460 mv 60000/1000 xp>
Monster's slice hits you for 5 damage.
<546/546 hp 220/220 m 460/460 mv 60000/1000 xp>
Your slash hits Monster for 142 damage.
What I'd like to do is, whenever a character is in combat, have the following prompt enabled instead:
Quote:
[100% 100%] Your slash hits Monster for 139 damage.
[100% 100%] Your slash hits Monster for 152 damage.
[100% 100%] Your slash hits Monster for 135 damage.
[100% 100%] Your slash hits Monster for 161 damage.
[100% 100%] Testing tells you, 'testtest'.
[100% 100%] Monster's slice hits you for 5 damage.
[100% 100%] Your slash hits Monster for 142 damage.
For argument's sake, the 100%s represent the character's and victim's health respectively.
Any help would be greatly appreciated - I would love to avoid having to drop in show_battleprompt(ch,victim) function calls all over the place :)
|