Conditionally Displayed StoryMeters

Twine Version: Newest
Story Format: Sugarcube
I am trying to only display the mana meter when the class mage has been selected. The meter will not show up once the variable is set to true. The meter works fine if it isn’t inside an if statement.

Also I need to be able to change the data-value with a variable but when I try it just shows the variable name. Any ideas?

<div id="target" class="meter-gauge" data-label="Target" data-max="200" data-value="200"><div></div></div>
<div id="health" class="meter-gauge" data-label="Health" data-max="200" data-value="200"><div></div></div>
<<if $mage eq true>> 
<div id="mana" class="meter-gauge" data-label="Mana" data-max="300" data-value="300"><div></div></div>
<</if>>
1 Like

Got the answer from Discord.

The StoryMeters was being called before my class selection. So I had to call it after my class selection. I also ended up writing it as a widget so that I could update the target health as well.

<<script>>
$("#story-meters")
   .empty() .wiki(Story.get('StoryMeters').processText());
<</script>>
<</widget>>
1 Like