# Creating Accuracy Score

Dec 03, 2021

Hi,

I'm creating a drag and drop game in Storyline 360. The scenario is this: learner should be able to drag the cards provided into 5 categories within 3 minutes (otherwise, game's over). I would like to be able to calculate the total number of cards attempted in 3 minutes, the total number of cards matched correctly, and using that, be able to display an accuracy score.

Here's what I have tried so far:

1) Created a variable to calculate the total number of cards matched correctly: Patientcard

2) Created a variable to calculate the total number of cards attempted in 3 minutes: Cardsattempted

3) Created a variable for accuracy: Percentage

4) Set Percentage to variable Patientcard when the timeline starts on the slide

5) Divide Percentage by variable Cardsattempted when the timeline starts on the slide

6) Multiply percentage with value 100.

7) Display the percentage variable reference on the slide.

But for some reason, the percentage result appears as Nan.

Can someone please help me figure out how to fix this?

## 4 Replies

have you added all the other values as references possible that one of those is not giving a value or can you post the slide?

Hi Phil,

I am sharing a sample file where I have recreated the interaction I'm trying to build. I would really appreciate it if you could help me out with this.

Warm regards,

Divya

percentage_mh.storyHi, Divya.

Thank you for sharing your .story file!

The triggers you're using are set to "

when the timeline starts". At that point, all the variables are set to 0, which is why you're getting the error.Those variables are not getting "re-checked" as the timeline is not re-starting as the user progresses.

Instead, assign the triggers to "

when the variable changes":Here are two recordings of what this would look like in Preview:

Example 1: 100%

Example 2: 60%

I hope this helps!

Thank you, Maria! Yes, it's working perfectly now :).