OLC, str_dup question.

From: Fionn Colvin (gavry@ozemail.com.au)
Date: 05/22/99


Heya all,
             I'm currently adding spells effects on items, simular to
how its done in the wpn.spell patch on the ftp site. I'm expanding it
though so items can give you perm spell effects, like ring of
infravision, glasses of detect invis etc, etc. I've got it all up and
running except for one little bit.

For my system I have 2 text sections in my object_spells structure:

struct obj_spell_type {
   int spelltype;               /* number of spell            -1 is no
spell */
   int level;                     /* level of spell                 only
used for procing spells  */
   int percentage;           /* percentage of success   -1 is perm */
   char *ymessage;        /* Message sent to wearer */
<------ This One
   char *rmessage;         /* Message sent to room   */
<------ This One
};


With the OLC editor, your enter text for both those fields. That text is
then passed through act when an items worn. As a result I'm adding act
formattting to the text such as $n and such. The trouble is that when it
saves the text to the obj file it duplicates all the $ signs. So if I
type in $n's eyes start to glow red. It will be saved as $$n's eyes
start to glow red.

OLC_OBJ(d)->spell_affect[OLC_VAL(d)].ymessage = str_dup(arg);

The above line is used to read in the text for the message.

Ant help as to why this occurs would be greatly appreciated.

Gavry


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST