Since I'm a newbie in HAI programming, I'm try to get this to work but the flags in HAI is over my head 
I want to automate the porch light at night when away, and here are the conditions:
a) when it's dark and someone opens the frontdoor, front porch light turns on for 5 minutes
when it's dark and someone opens the garage door, front porch light turns on and stay on
c) when it's dark and someone closes the garage door, front porch light turns off in 5 minutes
d) when it's dark and in AWAY mode, front porch light turns on automatically and stay on until disarms
e) when set AWAY mode and dark, front porch light turns on and stay on
My problem is, in AWAY mode, I have a code to issue ALL OFF commands to all lights in the house (X10) so the front porch light will get turned off too. And in other conditions, it seems like if someone opens/closes the door, but other door still opens (say frontdoor opens/closes, but garage door remains opens), lights may turn off or doesn't turn off after the garage is closed. Or in the case of the AWAY mode, since someone will still be opening/closing the garage door and one of the conditions will be met, so light will turn off automatically after a few minutes.
Or I should just walk up to the switch to turn on/off the light, but that takes away the fun of programming
Any guidance would be greatly appreciated. So far I have 2 flags set up with this. I can post what I have so far tonight when I get home. Thanks.

I want to automate the porch light at night when away, and here are the conditions:
a) when it's dark and someone opens the frontdoor, front porch light turns on for 5 minutes

c) when it's dark and someone closes the garage door, front porch light turns off in 5 minutes
d) when it's dark and in AWAY mode, front porch light turns on automatically and stay on until disarms
e) when set AWAY mode and dark, front porch light turns on and stay on
My problem is, in AWAY mode, I have a code to issue ALL OFF commands to all lights in the house (X10) so the front porch light will get turned off too. And in other conditions, it seems like if someone opens/closes the door, but other door still opens (say frontdoor opens/closes, but garage door remains opens), lights may turn off or doesn't turn off after the garage is closed. Or in the case of the AWAY mode, since someone will still be opening/closing the garage door and one of the conditions will be met, so light will turn off automatically after a few minutes.
Or I should just walk up to the switch to turn on/off the light, but that takes away the fun of programming

Any guidance would be greatly appreciated. So far I have 2 flags set up with this. I can post what I have so far tonight when I get home. Thanks.