Flag information as of 12/04/08 obtained through testing and communication through Till
Flags and event triggers
There are two types of flags in the Cortexa- Static -
- can be used in case statements to trigger specific conditions
- can be used Trigger Type: Flag" if and only if 'the flag trigger is a non-zero value
- Second Counter
- can be triggered when the counter decrements itself to 0.
- cannot be triggered when countdown value is set to 0 through an event or button press'''
Flag as a device
Recently a flag device was added to allow for a flag value to be set to a user defined number as the on value while the off value is hard coded to zero.- The flag device is capable of setting a trigger-able flag with the ON button (ON value cannot be 0)
- The 'flag device is not capable of using the off button to cause an event, because a flag value set to 0 (for both static flags or a non natural second counter to zero) will not trigger an event (see above)

Flag workaround
A few methods to work around flags exist
Flags not tied to buttons
- If the flags will only be accessible to events (no buttons to control flags), use 1 as the triggerable off state (instead of 0) for static flags. Triggerable off states for count down timers shoud still be zero.
Flags tied to buttons
- Flag as device (confusing/less preferred) -
- Create a new device with type flag.
- Set the On value be the value you care for to turn the event off
- Label the device " ----- Off".
You will be associating the Off command with the ON button for the device (hence confusing)
- Custom Button -
- Create custom button where a button press will be tied with an Event that causes the flag to go to a non-zero value.
- Create another event with Trigger Type: Flag based on a non-zero flag value that will cause an action to occur
- Once that flag is set to its non-zero value by the custom button, it will change the flag and then the Trigger type: Flag, event will occur.
Additional buttons might be needed to have an ON event and an Off Event (i.e. sprinklers On button and sprinklers off button)
- Countdown timers
A countdown timer cannot be forced to zero (by users) and cause an event. It can be forced to 1 or 2 and naturally decrement. The Flag as Button option could be used for a count down timer utilizing two count down flags (or a single count down flag and a static flag).
- Create a second counter flag that decrements the amount of time desired (call it XXXX-Countdown)
- Create a static or second countdown flag or a static flag (call it XXXX-Dummy)
- Create a Flag as Device tied into the XXXX-Dummy Flag (see image above).
- Create a new event with the the startup of the device and in the macro section set up the following:
- set the XXXX-Countdown Flag to the desired value
- set the XXXX-Dummy flag to the On Value (lets say 1) (make sure this flag is tied into the Flag as Device)
- turn on the desired device
- have a single second wait command
- compare the XXXX-Dummy Flag to 0 and if the case is met, then shut down the device
- a case comparing the XXXX-Countdown Flag to 0 and if the case is met, then shut down the device
- a case comparing the XXXX-Countdown Flag to 0 and if the case is met, then se the XXXX-Dummy Flag to 0.
- an end macro command tied to either of the two flags (if you want the event to run for the entire
- at the end of the countdown timer set the device to Off
Macro list for allowing a dummy flag to control the actions of a countdown timer if desired. 
This would allow you to set the dummy flag to zero which would be read by the countdown timer and cause an action to occur (or stop)
The other issue that was seen by Till and partially by myself, is that with an event with a set flag value action and an action of end Macro, that the flag value will not be changed appropriately. After removing the "end macro" line, the event worked correctly. Adding the end macro line back in allowed it to work correctly. I don't think this is tied directly into the end macro, but something weird is going on. Further looking into this should include occurrences if the cortexa is rebooted...
Cortexa