How do I stop a variable from adding 1?

Jul 24, 2012

Hello Heroes,

I have a number variable set up to add one when user clicks submit on a quiz. If you want to go recheck your work, it keeps adding one so the home page turns off the completed function that shows the user their score when you go back to check your work. I want the completed function to stay visible once the test is done.

Is there an easy way to shut the variable off after you have clicked submit once? Or is there something that'll stop it from adding the second time you reach the end of the test?

8 Replies
Diane Elkins

There are a number of ways to accomplish this, based on how everything is set up.  Here are a few suggestions, and maybe one of them will be applicable.

1. If you aren't really counting or doing math, then you don't necessarily need a number variable.  Perhaps you can use a true/false variable.  The Submit button would set the variable to true.  The student can click over and over again, but the value stays at true.

2. If there is a set number of points (10 questions, so 10 points added), you can add a condition to the action adding the points.  Set it up so that the action doesn't trigger if the value is 10 or more.

3. Create a separate variable that determines when to start adding points.  If your logic is more complex, maybe you can use another variable to keep track of when the points should stop being added.  Then use the value of that variable to be the condition.

I hope that helps.

Diane Elkins

I'm not quite sure I understand the question, but I'll give it a shot.  Variables apply to the entire project.  So you can modify them, display them, and use them as conditions anywhere in the course.  The only reason you would need multiple variables is if you need to keep track of multiple values.  For example, if you have a pre-test and a post-test, and you want to have a variable that keeps track of each one, that would need to be two separate variables.

Does that answer your question?

Jesse Spinella

Okay, maybe I'm not understanding how to use the true/false variable then. That makes sense, but the problem I'm running into is this:

Home page of test, user clicks test one, goes a few questions in, clicks home to do another test, an Incomplete text box pops up as a label beside test one button. Now, at the end of test one when the user is finished, I want to put a turn "incomplete off" variable so the incomplete text box turns off and displays a layer with the user's score.

Am I able to set the same true/false variable to each of those steps? Or do I need to create a new variable each time I want the true/false variable to activate something else in the test? Do I have to link the new variables to the first variable in order for them follow the progression of incomplete on, no score, incomplete off, display score?

Diane Elkins

I don't think true/false will work because you have three possible values, if I understand correctly: not started, incomplete, and complete.  So you can either use a text or number variable.  Since there isn't math involved, I would lean towards a text variable so that I can more easily remember what everything means. 

Here's what I would do.

Set up a variable called Test1 and make the initial value notstarted.

When the button is clicked, add an action to change the variable to incomplete. (You may want to add a condition so that this action does not trigger if the value is complete--if they come back through the test a second time)

When the test is finished, add an action to change the variable to complete.

How you set up your home page will vary based on how you are displaying the status: states, layers, etc.  I'll write this up as if it is based on states. 

You won't need to do anything to indicate that the test hasn't been started.

For the incomplete message, set the initial state to hidden.  Add an action trigger to the page that changes it to normal if the value of Test1 is incomplete.  Add an action trigger to the page that changes it back to hidden if the value of Test1 is complete.

For the test score, set the initial state to hidden.  Add an action that changes it to normal if the value of Test1 is complete.  You shoud l not need an action to ever change it back to hidden, unless you have a reset function.

This discussion is closed. You can start a new discussion or contact Articulate Support.