Re: Sector checking for camping hack

From: Skylar (skylar@ifconfig.intserv.com)
Date: 10/29/96


On Tue, 29 Oct 1996 BuckFloyd@aol.com wrote:

> 2)  But this didn't (GET_ROOM_SECTOR didn't either)..
> 
>      if ((SECT(ch->in_room) != SECT_FIELD) || 
>       (SECT(ch->in_room) != SECT_FOREST) || (SECT(ch->in_room)
>       != SECT_HILLS)  || (SECT(ch->in_room) != SECT_MOUNTAIN))
>          send_to_char("You must be outdoors to camp.", ch);

This will never work. All those OR's should be AND's (&&).  What you're
basically doing here is checking if the sector type is not ALL of these
sectors - which it can't be (more than one sector type).

Translate the code to english and read it aloud and you'll probably
get a clearer view of why you need &&'s instead of ||'s


-Sky

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



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