[NEWBIE] Damage Message code

From: Timbrewolf (brandon@timbrewolf.com)
Date: 08/01/01


Hello, I hate to seem like an idiot, but I came across this wonderful damage
code posted by d. hall in '97:

http://www.circlemud.org/maillist/1997-08/0545.html

The problem I'm having is that he uses a personal lib function to build the
display variable.  I'm still learning C and haven't been able to recreate
this or rewrite it in a way that works (without destroying my tiny
civilization :)

At this point, I think that even if I did "figure it out" it would possibly
been buggy or memory-intensive since the only way I see of doing this is to
use like 5 different variables and try to build them together on-the-fly.

The specific code (from above linked archive) I'm trying to figure out is:
>// message to onlookers
>  *message = '\0';             // Reset the message cache
>   istrlist (3, message,
>             replace_string (dam_weapon[weapon_index].to_room,
>                             attack_hit_text[w_type].singular,
>                             attack_hit_text[w_type].plural),
>             ", which ",
>             dam_amount[amount_index].to_room);
>   act (message, FALSE, ch, NULL, vict, TO_NOTVICT);

Mr. Hall's 'istrlist' is obviously the lib, the '3' states how many
arguments are being passed, the 'message' is the name of the variable, and
the rest is the variable to strcat together... As far as I can tell.

I don't really need the lib, I just was interested in being able to build
the variable correctly, anyone who can help me with that?  I'm sure it's a
minor issue for you C veterans, but I've spent four hours on it so far (and
it's hard to find specific information on building variables, surprisingly).

Thanks in advance for all the help!

Brandon

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/06/01 PST