Here's a link to the
IF Statement thread.
Basically you create an action button with scripts assigned to OnActivate and OnDeactivate (or some other boolean event pair). Then use a comparison test to set the boolean value.
button.activated="health<50"
<button name="button" OnActivate="lessthan50script" OnDeactivate="greaterthan50script">