I know it's too late to offer advice, but what I do for layered images with variables is just use the variable within the layered image itself.
layeredimage brianne:
group hair:
auto
attribute hair default:
"brianne_hair_[haircolor]"
Then all you have to do is change the variable based on what the user selects. And if you set it as the default layer, then it'll automatically show it whenever the character appears on screen. Much more simpler than bothering with condition switches.
Being self-taught programmer, when I first started playing around with layered images, I searched everywhere for a solution to this, but couldn't find one and eventually just had to mess around with it before I figured out how to do it myself. It's all just trial and error. :3