Skip to main content
Inspiring
April 11, 2018
Answered

Tracking the progress with variables and output to a progress bar

  • April 11, 2018
  • 1 reply
  • 534 views

Hi there, this may be a silly question but I just cannot get it straight.

Here is my case. I have a project with 4 levels.

The user can go to any level at any time - there is no prerequisites to go first to the first level and then to the second.

When the user goes to the last slide of each level, s/he would complete the level. I track that with a variable.

What I would like to track also is the overall progress with 4 stars. If the user has completed level 1 and 3, two of the stars will become yellow, the other two would be white. If the user completed level 2,3 and 4 three stars will become yellow and one will be white.

I am thinking of using a variable called v_ProgressVariable and to have it incremented with 1 every time the user completes a level. However, if the user completes level 1 twice for instance, s/he would get two stars... I do not want that. I want the user to get a star only for a unique visit of a level. I imagine that I can elaborate some complex schema with disabling buttons etc., but the project is already heavy with variables and I was thinking if anyone would have a simpler idea?

Thanks in advance!

Bobby

This topic has been closed for replies.
Correct answer Lilybiri

OK, this means you already have the variables You need the Expression command because Captivate has only basic mathematic operators and restricting to two terms or factors (you know I'm an engineer and maths lover). If I label the variable v_stars, with a default value of 0, and you have 4 variables, you'll need 3 Expression commands to calculate v_stars:

    Expression v_stars = v_one + v_two

    Expression v_stars = v_stars + v_three

    Expression v_stars = v_stars + v_four

JS experts will laugh at this workflow and use a function in JS, but if the number of terms is so small I prefer that 'ridiculous' sequence in an advanced action. I suspect you have already the setup for showing the stars?

1 reply

Lilybiri
Legend
April 11, 2018

Use a Boolean var for each level, toggled to 1  after completion. Calculate sum of those vars with Expression commands or JS, will give you number of stars.

Be careful with too much vars, try reusing vars and replacing advanced actions by shared action instances whenever possible.

Inspiring
April 11, 2018

Thank you for your usual kind reply Lieve, I followed your webinar and I must say that I am always trying to use shared actions when it is feasible.

As to the Boolean. This is what I am basically using right now. A variable will turn to 1 once the user has gone to the last slide of a level.

I am not sure about the Expression. Would you please give me a hint? This is how my action looks like, but what to use in the Expression to be sure that even if the user visits twice the level, s/he would not get another star? ...

Lilybiri
LilybiriCorrect answer
Legend
April 11, 2018

OK, this means you already have the variables You need the Expression command because Captivate has only basic mathematic operators and restricting to two terms or factors (you know I'm an engineer and maths lover). If I label the variable v_stars, with a default value of 0, and you have 4 variables, you'll need 3 Expression commands to calculate v_stars:

    Expression v_stars = v_one + v_two

    Expression v_stars = v_stars + v_three

    Expression v_stars = v_stars + v_four

JS experts will laugh at this workflow and use a function in JS, but if the number of terms is so small I prefer that 'ridiculous' sequence in an advanced action. I suspect you have already the setup for showing the stars?