Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Resetting a Variable

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I've been having trouble resetting a variable to zero in order to use it again later with a new value.

I'm using the PercentCorrect variable at the end of short quizzes in numerous areas in the program. My problem is...when the program calculates the percentcorrect for the second quiz, it includes the score from the first quiz. Which is not what I want because these are separate entities in the program. How do I fix this?
 
Unfortunately PercentCorrect (as well as several other variables) is global for the entire file (by design). Therefore, you have a few options:

1)separate your quizzes into separate files
2)Create your own variables and do the percent calculation manually.

The first option is probably easier and it is more in line with how Authorware was designed to work. However, if you create your own variables, you can use the Initialize function to reset them to whatever default value you have defined (you can also just say MyVariable=0 if you wish). Initialize allows you to reset up to ten variables. However, it doesn't work on most "system" variables.

Initialize([variable1, variable2, ..., variable 10])

I'll be glad to help further if you need more details on creating your own method manually.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top