Re: [Code] Syntax Explanations

From: James Stephens (
Date: 01/18/97

On Sun, 19 Jan 1997, DJ Pure wrote:

> Question 3.
> I have this if statement in my code.
> The following variables (with their current values) are this [taken from
> printf AND the MSVC *watch* command]
> GET_CLASS(ch) returns the number 9.
> #define CLASS_CONJURER 9
> 	// First check to see that they can scroll spells.
> 	if ( (GET_CLASS(ch) != CLASS_CONJURER) ||
> 		 (GET_CLASS(ch) != CLASS_INVOKER) ||
> 		// Not a valid class to scroll, so leave please.
> 		send_to_char ("Only those with the ability to cast arcane spells can
> scribe scrolls.\n", ch);
> 		return;
> 	}

> Now this statement goes INSIDE this if statement, which it shouldn't as i
> told it to only go inside if it DOESN'T equal one of the classes. Why is it
> going inside ??? I've gone over it SO many times .. it shouldn't be going
> inside. Those are simple logical OR i have used, right?
> Thanks to all those who give some advice. All flames go into recyling.
> Jussy.
My knowledge of C is limited at best, but if you want it so Conjurers,
Invokers, Necromancers, Illusionists, Sorcerers to be able to scribe
scrolls, shouldn't it be a logical AND, ie if !conjurer && !invoker &&
!necromancer etc then they can't do it... the Logical OR will always be
true because the character doesn't have all those classes..  
but like I said, my knowledge of C is poor so I may be wrong.


James Stephens
Senior System Administrator                          Anarch@SNNI.COM
Southwest Nineteen Networks                     714-991-1919 ext 310

| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   |

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