Scenario Flow Controls

Modified on Mon, 1 May, 2023 at 5:08 PM

Changing Step Order

Sometimes one may want trainers to go back to the same step again for review within a training. This is where we could try our advanced interaction for structuring the flow of the training to be more complex. Here we give 3 guided ways to start playing with the order!

Go to Last/Next Index

Let’s start by going to the last step or next step. The syntax are very similar, to go to the last step, you could call the below line.

Store.dispatch('steps/back');

When this line is called, the training will directly go to the last step and play last step’s training content. And to go to the next step, you could call the below line.

Store.dispatch('steps/next');

Setting Step to a Specific index

You can also specify going to an index, by calling the below line.

Store.dispatch('steps/setCurrentStepIndex', stepIndexYouWantToGoTo);

After calling this line, the step will automatically go to the step index you set after presenting the content of the current step. For example, the trainer is current at step 6, and you hope it to go back to step 3. You could call:

Store.dispatch('steps/setCurrentStepIndex', 2);

Looping

Extending on the last interaction way we introduced. If you use setting index on one of your steps, you could potentially leverage the idea of looping! This can be used when you want to test whether a trainee has fully understood the content (and if not you would like him/her to watch the steps again).

The below is an example of using this idea. Based on the trainee’s answer, we could potentially decide whether to move onto the next step or keep looping the training!

var answer = prompt("This is a place to ask a question");
var correctAnswer = "something"

if (answer==correctAnswer){
    Store.dispatch('steps/next'); //good to go, move onto the next step
}else{ 
    Store.dispatch('steps/setCurrentStepIndex', 2); //go back to a specified training step
}



Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article