# AND's and OR's

**URL:** <https://forum.vassalengine.org/t/ands-and-ors/3840>\
**Category:** Module Design\
**Created:** [April 15, 2011, 2:41pm UTC](https://forum.vassalengine.org/t/ands-and-ors/3840 "2011-04-15T14:41:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![DrNostromo](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/drnostromo/32/12593_2.png) [@DrNostromo](https://forum.vassalengine.org/u/DrNostromo)\
**Post date:** [April 15, 2011, 2:41pm UTC](https://forum.vassalengine.org/t/ands-and-ors/3840/1 "2011-04-15T14:41:19Z")

</div>

I know this has been discussed before but I’ve been remiss it writing down for future reference. How do you mix && and || in a single statement. For example, I have a button that can be clicked if…

AnchorStealStatus = 0 && RoundStatus = 1 && playerSide != ActivePlayer && playerSide != Questioner && (here’s the problem part)

It can be clicked by either playerSide = Anchor OR playerSide = Master

---

<div class="post-metadata">

**Author:** ![Tim\_M](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/tim_m/32/2_2.png) [@Tim\_M](https://forum.vassalengine.org/u/Tim_M)\
**Post date:** [April 15, 2011, 3:50pm UTC](https://forum.vassalengine.org/t/ands-and-ors/3840/2 "2011-04-15T15:50:01Z")

</div>

What you need is the regular expression match

playerSide ~= Anchor | Master && AnchorStealStatus = 0 && RoundStatus = 1 &&  
playerSide != ActivePlayer  
&& playerSide != Questioner

* * *

From: DrNostromo [drnostromo@drnostromo.com](mailto:drnostromo@drnostromo.com)  
To: [messages@vassalengine.org](mailto:messages@vassalengine.org)  
Sent: Fri, April 15, 2011 9:41:19 AM  
Subject: [messages] [Module Design] AND’s and OR’s

I know this has been discussed before but I’ve been remiss it writing  
down for future reference. How do you mix && and || in a single  
statement. For example, I have a button that can be clicked if…

AnchorStealStatus = 0 && RoundStatus = 1 && playerSide != ActivePlayer  
&& playerSide != Questioner && (here’s the problem part)

It can be clicked by either playerSide = Anchor OR playerSide = Master

* * *

Read this topic online here:  
[https://forum.vassalengine.org/t/ands-and-ors/3840/1](https://forum.vassalengine.org/t/ands-and-ors/3840/1)

---

<div class="post-metadata">

**Author:** ![DrNostromo](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/drnostromo/32/12593_2.png) [@DrNostromo](https://forum.vassalengine.org/u/DrNostromo)\
**Post date:** [April 15, 2011, 4:50pm UTC](https://forum.vassalengine.org/t/ands-and-ors/3840/3 "2011-04-15T16:50:03Z")

</div>

Thanx. I wasn’t even aware that a tilde was a valid expression character.

---

<div class="post-metadata">

**Author:** ![Tim\_M](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/tim_m/32/2_2.png) [@Tim\_M](https://forum.vassalengine.org/u/Tim_M)\
**Post date:** [April 15, 2011, 5:44pm UTC](https://forum.vassalengine.org/t/ands-and-ors/3840/4 "2011-04-15T17:44:58Z")

</div>

Looking at it more closely I don’t think you need the playerSide exclusions and should be able to get away with this:

playerSide ~= Anchor | Master && AnchorStealStatus = 0 && RoundStatus = 1

---

<div class="post-metadata">

**Author:** ![DrNostromo](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/drnostromo/32/12593_2.png) [@DrNostromo](https://forum.vassalengine.org/u/DrNostromo)\
**Post date:** [April 16, 2011, 2:31am UTC](https://forum.vassalengine.org/t/ands-and-ors/3840/5 "2011-04-16T02:31:53Z")

</div>

No, I need the exclusions. It’s a button that allows players to attempt to steal a trivia question that the active player doesn’t guess correctly. The active player and the questioner are obviously not allowed to steal. Therefore, their steal button shouldn’t work.

---

<div class="post-metadata">

**Author:** ![DrNostromo](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/drnostromo/32/12593_2.png) [@DrNostromo](https://forum.vassalengine.org/u/DrNostromo)\
**Post date:** [April 16, 2011, 2:56pm UTC](https://forum.vassalengine.org/t/ands-and-ors/3840/6 "2011-04-16T14:56:01Z")

</div>

Oh, I see why you asked whether those options needed to be included in the statement.

I should have noted $ActivePlayer$ and $Questioner$ (their variables)

Basically, if the playerside known as Anchor is the active player or the questioner, the button won’t work.

That probably makes more sense.
