Squiffy: Showing Score

I know how to create and update a score variable in Squiffy.

Im trying to figure an efficient way to show it at the top of the gaming/text area.

Say I have a score variable: I’m considering to put the following before the rest of the text on each section where you want to show score and there is a @clear:

<span style="background-color:black;">
Score: <b>{score}</b>
</span>

However, this is rather repetitive in terms of the amount of “non story” text for each section.

I don’t want to use the master section since there are sections where I need not to show the score.

Is there a better way to do this on Squiffy?

If someone here doesn’t chime in, you might want to crosspost this on the Squiffy forum as well:

http://textadventures.co.uk/forum/squiffy

2 Likes

Did a quick test using conditions in the master section:

Welcome! 

Proceed to [[next section]](section1, showScore, score+=1)

[[section1]]:
Your score just increased!

Is this game easy or [[what]](section2, showScore=false)!

[[section2]]:
Not really. You've died.

[[]]:
{if not score: {@score=0}}
{if showScore: Score= {score} }

Could something like this work?

It does work. I’ll adapt it to my WIP and tweak it if needed.

Much obliged!

1 Like