Story Format: Sugarcube 2.31.1
I might be just having a major brain fart because I know there has to be a better way to do what I’m doing, but I can’t think of it.
Here’s my problem:
I’ve got 10 variables:
$pInv.book0 $pInv.book1 $pInv.book2 $pInv.book3 $pInv.book4 $pInv.book5 $pInv.book6 $pInv.book7 $pInv.book8 $pInv.book9
These variables can have values of 0, 1, or 2.
Is there a way to check these variables en masse? So instead of:
<<if $pInv.book0 is 1 or $pInv.book1 is 1 or $pInv.book2 is 1 or $pInv.book3 is 1 or $pInv.book4 is 1 or $pInv.book5 is 1 or $pInv.book6 is 1 or $pInv.book7 is 1 or $pInv.book8 is 1 or $pInv.book9 is 1>>
I could just have something like:
<<if $pInv.books is 1>>
Further, is there a better way to check these 10 variables to see if None, One, or Multiple of them has a particular value?
So if only one of them has a value of 1, one thing happens, but if two or more have the value of 1, something else happens?
Hopefully that makes sense. Any help would be greatly appreciated.