[DG-SCRIPTS] variable prob

From: Jon Barrett (mixtli@SINFO.NET)
Date: 03/19/98


I origninally had a problem with the actor variable not being filled, or
just not displayin anything.  The variable was being filled fine, well,
almost fine....

This define:
#define ADD_UID_VAR(buf, trig, go, name) { \
                                 sprintf(buf, "%c%ld", UID_CHAR, GET_ID(go)); \
                                 add_var(&GET_TRIG_VARS(trig), name, buf); }

fills the variable with the UID_CHAR which is '\\e' and then with the
playes id_num.  But when I watch the variable at runtime it is actually
'e1'.  Where did the '\' go?  I thought it could be because of the %c in
the above sprintf, or maybe it is compikler specific.
Anyway, in the next check from get_char(), which is called from
find_replacement():

if (*name == UID_CHAR)

It is looking for that '\e' which is the UID_CHAR.  Since the '\' is
missing the check is always false and a null is always returned.

Now as a test I made the UID_CHAR = 'e' and it worked fine after that.
Obviously that will cause problems, and so could just using '\', but it
proved that was the problem.  Any recomendations on an 'appropriate' fix?
Should I just choose any character for the UID_CHAR, or is there another
format specifier for sprintf I should use?  Any help is apprectiated.

Oh, I use MSVC++ 5.0, so if it is an OS or compiler problem, maybe a fix
could be added to the patch for future users.


 .....Jon.....


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



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