Bit twiddling can be tricky, and there are multiple ways to set or clear a particular bit from your strategy.
Looks like your first attempt at using the BitChange command was very close, you just had the first and last parameters swapped. You might also consider using the BitSet and BitClear commands, which may be less confusing.
Also, you may eventually want to use the bitwise operators available in OptoScript (check out form 1700, the PAC Control User's guide, and search for "bitwise operators"). Below is an example of how you might use the bitor command to set an additional bit in your Alarm variable (which I called Alarm_Flags here):
[INDENT]// set the 0th (least-significant) bit of Alarm_Flags
// BitChange(SET_FLAG, Bit, Output_Value);
BitChange( 1, 0, Alarm_Flags);
// Set the bit for Alarm_Number (3 in this example)
// without changing any of the other bits
Alarm_Number = 3;
Alarm_Flags = Alarm_Flags bitor (1 << Alarm_Number);
[/INDENT]When you step through and debug your code, you may find that this "BINary" option in the debug window is helpful.
Here I'm showing the Alarm_Flags variable just after calling that BitChange command, then after the bitor assignment above. You can see the individual bits getting set.
Thanks for the good question, keep them coming! I'm just working on some OptoScript tutorial materials and will be sure to include a section on bit manipulation. As you've seen, there are usually several ways to do something in PAC Control, it's just a matter of finding what makes most sense to you, and what's easiest to maintain.
p.s. Here's another thought: instead of using bits, what about an integer table (still one variable/tag) where each element represents one of these alarms? Given how much memory our controllers have these days, saving memory is not typically a big concern. Saving frustration--by creating strategies and projects that are easy to understand and maintain by even non-bitheads--might be your bigger concern here. Of course, I can name many situations where we HAVE to manipulate bits, so I'm glad you asked this question!