Bartender4 and Balefire Bolt

In SoD if you use Balefire Bolt after 9 stacks you die. Is there a way to have bartender4 switch action bars when your debuffs of Balefire Bolt hit 9 stacks? I basically would like Action bar 1 button 3 to have Balefire Bolt and Action bar 2 button 3 to have Frostfire bolt, that way I never accidently kill myself.

I see an option in Bartender4 where you can go to a state configuration for Action Bar 1, and write a custom condition in lua. I don’t have the skill or know anyone that could code this. Is this even possible to swap bars from debuffs, and would anyone have an idea how to code it?