Looping through sets in order

David Vaughan drvaughan55 at mac.com
Sat Aug 10 16:10:01 EDT 2002


Kristy

You could keep the data in an array quizSets with one entry for each set 
with the values 0...N quizzes.
So the value of quizSets[set] is zero to the number of quizzes in that 
set, indicating the last one done. It is now easy to know how many sets 
you have, whether any quizzes in it have been attempted and which was 
the last one done for that set. A saved variable or custom property can 
hold which was the last set attempted.

If you have varying counts of quizzes in sets then you can test for the 
possibility of another one using "if there is..." on a file name. If you 
allow people to take quizzes randomly in a set then extend the array to 
two keys [set,quiz] with value done or not done.

The principles here are much the same as Kurt's suggestion but the code 
may be a little more compact and is quite general in what it will handle.

You may need to split and combine the array if writing/reading to file 
data. I tend to keep these sorts of things in a custom property of a 
saveable stack.

regards
David

On Saturday, August 10, 2002, at 10:32 , Kurt Kaufman wrote:

> How about a combination of methods, such as (pseudo-script):
>
> --upon successfully completing a quiz:
> global gLastQuizDone
> append the number of the last completed quiz to the file data
> put its name into gLastQuizDone
>
> --somewhere else:
> global gLastQuizDone
>
> if gLastQuizDone is empty then startAtBeginning
>
> if gLastQuizDone is in set 1(1.1,1.2,1.3,1.4)
> flag which quizzes of set 1 have already been completed
> then offer one of the others in set 1
>
> if gLastQuizDone is in set 2(2.1,2.2,2.3,2.4)
> etc.
>
> (you could set this up as as a switch also, I suppose)
> ---------------
> Depending on the number of quiz sets, this still could be a large 
> script. I'll bet someone else on this list knows a more efficient way 
> of doing this.
>
>
> -Kurt
>
>
>
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>




More information about the use-livecode mailing list