Re: [DG Scripts] Bug in room variables

From: Mark A. Heilpern (heilpern@MINDSPRING.COM)
Date: 01/22/98


At 10:24 AM 1/22/98 +0100, you wrote:
>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';
>      }

I'll put the else's in there for PL3. Thanks for the good catch.

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

I did something similar to what you describe (though I used elseif instead of
the seperate else if keywords which your mail appears to be) and things
worked fine. I didn't try seperate else if, but if you do that make sure
tou have
an "end" for each "if" you use. (if - elseif - elseif ----   only needs a
single "end").


PL3 will have Chris Jacobson's switch (and while) block supported, so this
will
be a better option for you perhaps.


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