>M.A.Clubine wrote: >> >> Should be a && not a ||. >> >just my two cents worth but, wouldn't && (logical and from what I >understand) make his code only let you kick if you were both a bard and >a warrior, where as the || (logical or) make it so that it could be >either a bard or a warrior that could kick? >> Monroe - Eternal >> >> On Wed, 20 Nov 1996, CircleMud Admin wrote: >> >> > Ok, I added a new class and gave the skill kick to the class. I went into >> > the act.offensive.c and changed the ACMD(do_kick) to: >> > >> > if (GET_CLASS(ch) != CLASS_WARRIOR || GET_CLASS(ch) != CLASS_BARD) { >> > send_to_char("You'd better leave all the martial arts to >> > fighters.\r\n", ch) >> > ; >> > return; >> > } >> > >> > Which should let people in the class BARD perform the skill. But it's >> > still returning that message. Any clue what I missed? >> > >> > -Mike Okay, if you look at this code here you'll notice that we're doing a != check instead of an == check so we've got this: if not warrior and not bard do - so if we're testing a warrior we get not warrior = false not bard = true true and false is false so it skips the send_to_char and performs the kick. if we're testing a cleric we get net warrior = true not bard = true true and true is true so it sends the error message and doesnt kick you would also want to add () around each check just to make things cleaner I don't remember the order or precedence for != or || or && but ()'s never hurt. -- George Campbell Northwestern University daishi@nwu.edu +-----------------------------------------------------------+ | 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