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

What you need is the regular expression match

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


From: DrNostromo drnostromo@drnostromo.com
To: 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

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

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

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.

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.