cannot progress untill food is eaten.

As the title suggests, this is a puzzle I'm trying to create- however, I'm not sure where to begin with it.
Do I make the door unlockable once the players HP goes over a certain amount, triggered by eating the food?
Is there a reverse key option so a door will only open when a food item is removed from the game?
thanks in advance.

Both ideas are scriptable. I think the second one easier.

exitname.locked=false

sorry to bug you again, but how exactly would I implement this? I havent tried scripting at all yet.
I messed with setting object expressions to open a lock but I couldnt really work it out.

I appended a testgame. have a look at the exit gatelock and the eat verb of the apple object

Thanks pertex, that really helped me out!