Attempting a setup where I pull a lever to open a door. Pulling it again will close the door. I'm not able to look up the function calls at this second so my code is more pseudocode but it should be pretty obvious.

This is what I attempted:
Code
IF
CharacterUsedItem(Character, Lever)
AND
ItemIsClosed(Door)
THEN
OpenItem(Door);

IF
CharacterUsedItem(Character, Lever)
AND
ItemIsOpen(Door)
THEN
CloseItem(Door);


When this executes, nothing appears to happen. I believe this is because the first script executes, opens the door, then the second condition is evaluated which is now true and the door closes.

I'm an experienced programmer but still having some issues wrapping my head around Osiris. I don't think theres an "Else" I can make use of here so I'm not sure what other way I can accomplish this.

How can this be better written?