I wasn't sure how to use that in Spellcast, but I was able to derive an idea from it and it seems to work. The only problem (and it's pretty minor) is that when you take an action with HP above the threshold, it unlocks for actions after that, but for that action itself, the Twilight set is still locked in place. So...here's what I have:
Autoexec:
Code
<register event="lowhp|hpp_1*"" silent="false">input /equip head "Twilight helm"; input /equip body "Twilight mail"</register>
This puts my Twilight set on automatically anytime my HP gets below 20%.
Spellcast:
Code
<if HPPLT="20">
<addtochat color="121">HP Low - Twilight Set Locked</addtochat>
<disable slot="head|body" />
</if>
<if HPPGT="19">
<enable slot="head|body" />
</if>
This segment prevents Spellcast from swapping the Twilight set when HP is below 20% and announces that it is locked.
The next idea I have is to see if it can be put into Autoexec in some form to do the lock toggle automatically, which would ideally alleviate the delayed unlock.
I'm not certain how to make Autoexec do that though (if it's even possible).