[DG Scripts] Bug in room variables

From: Andy Hubbard (hub@LEICESTER.AC.UK)
Date: 01/22/98


Hi,

 Ok, so I'm starting to use this marvellous system a bit ...

To fix the room variables, ie. name, up, down, north, etc.
you need to put an else before all the if checks apart from the
"name" one.  ie.

    else if (r) {
      if (!str_cmp(field, "name"))
 strcpy(str, r->name);

      else if (!str_cmp(field, "north")) {
 if (r->dir_option[NORTH])
   sprintbit(r->dir_option[NORTH]->exit_info ,exit_bits, str);
 else
   *str = '\0';
      }

      else if (!str_cmp(field, "east")) {
 if (r->dir_option[EAST])
   sprintbit(r->dir_option[EAST]->exit_info ,exit_bits, str);

[snip] (add 'elses')

      else {
 *str = '\0';
 sprintf(buf2,
  "Trigger: %s, VNum %d, type: %d. unknown room field: '%s'",
  GET_TRIG_NAME(trig), GET_TRIG_VNUM(trig), type, field);
 script_log(buf2);

That'll do it!

Now for a question!

I can't seem to get past more than 1 'else if' statement,

eg.

if <condition1>
<statement1>
else if <condition2>
<statement2>
else if <condition3>
<statement3>

A successful check on condition3 yields statement2 :(

Any ideas on this?

Andy

telnet://winnt.cmht.le.ac.uk:4000


     +------------------------------------------------------------+
     | 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