Lights go red on contact change

I see what you're say. I've not dealt with custom variables yet and thought i could do it with some if statements however the bulb now always goes lol. There's probably a lot of mistake but if you can spot one let me know

IF (Bi Fold Door open(F) AND
Office lamp(on) is on(T) [FALSE]) THEN
Capture: Office lamp
Delay 0:00:01
Set color: Office lamp ->Red ->Level: 50
ELSE
IF (Bi Fold Door closed(T) [TRUE]) THEN
Delay 0:00:02
Restore: Office lamp
END-IF
END-IF
IF (Bi Fold Door open(F) AND
Office lamp(on) is off(F) [FALSE]) THEN
On: Office lamp
Capture: Office lamp
Delay 0:00:00.3
Set color: Office lamp ->Red ->Level: 50
ELSE
IF (Bi Fold Door closed(T) [TRUE]) THEN
Restore: Office lamp
Delay 0:00:00.4
Off: Office lamp
END-IF
END-IF