Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Crymson4
Novice


Joined: 20 Nov 2001
Posts: 35
Location: USA

PostPosted: Thu Nov 22, 2001 8:55 pm   

Logical AND/OR and bitwise AND/OR
 
This is probably a really simple question, but I have trouble none-the-less.

I'm trying to get one IF statement to differentiate between cases.

Basically, on 2d6, if the number rolled is a 2, 3, 4, 9, 10, 11, 12, I want it to one thing.
If it's a 5, 6, 7, 8 I want it do something else.

Now logically, in my mind, I'd just do something like this:

#IF (@DTotal=2 | 3 | 4 | 9 | 10 | 11 | 12) {Do true} {Do false, in this case, 5, 6, 7, 8}

then go on my merry way.

But it seems to think that it's true reguardless of the number rolled.

If I substitute & in there, it always thinks it's false, so I restructured the if to look like this.

#IF (@DTotal = 2 | 3 | 4 & 5 & 6 & 7 & 8 | 9 | 10 | 11 | 12) {Do this}

But again, that didn't work.

I don't really want to make an if for all 11 numbers, so could anybody shed some light on this? Maybe I just dunno the difference between logical and bitwise functions... one of the many things I was never taught in public school. hehe.

Anyways, thanks guys.

-Crymson
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Fri Nov 23, 2001 6:24 am   
 
Umm, try this:

#if (@DTotal >= 5 AND @DTotal <= 8) {#Noop here's where the 5 through 8 code goes} {#noop here is where the other code goes}

li'l shmoe of Dragon's Gate MUD
Reply with quote
Crymson4
Novice


Joined: 20 Nov 2001
Posts: 35
Location: USA

PostPosted: Fri Nov 23, 2001 6:53 am   
 
That worked. Sometimes, the answer is so freakin simple.

Thanks

-=Crymson

Reality is the effect of alcohol deficiency
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net