# Layers and quizzes

May 26, 2015

I would like to build a quiz that exists on layers in a slide, but can't work out how to do it.

I have an image of a security keypad, and I want the trainees to punch in the correct keys in the correct order to disarm it. I've tried layers with triggers and a variable that changes depending on the invisible button the click, but I want to make it so storyline marks it and measures attempts for me.

###### 12 Replies

Hi Amaan,

I was trying for a way to get this to work for you last night and have come up with a solution which can be viewed on my attached story file.

I have set four variables for each separate number position in the keypad entry.

I have then added hotspots above the numbers so that when you click them it sets variables to the number clicked.

I have then added another variable which counts the number of numbers clicked, this variable will decide what number to change when clicking on a number.

The clear button is set to put the number counter back to 0 and to clear the numbers.

The submit button is programmed as a click one free-form quiz, there are two buttons here layered over the top of each other and the correct one will only show when all 4 number variables are correct. In my example I have set the correct answer as 1 2 3 4 however this can easily be changed in the triggers column.

To do this at the top of the triggers column there is one which says change state of enter correct "rectangle" to normal when position changes and number 1 is equal to 1, number 2 is equal to 2, number 3 is equal to 3 and number 4 is equal to 4. To change the number change the equal to numbers to the ones of your choice.

Hope this helps

Jordan

nice work. Thanks for the time you've put into it. I will spend the next day or two looking at it piece by piece so I can get my head around it. Steep learning curve for a newbie...

Thanks again.

So, it looks to me like you have looked at it vertically, not horizontally. You have treated each number as a standing unit, rather than each layer as a unit.

Hopefully this will explain it better for you. Also I would be more than happy to have a look at your source file and see if I could get it working for you.

There are four numbers displayed on the digital display at the top of the keypad.

Each of these displayed numbers are linked to separate variables.

“Number 1”

“Number 2 “

“Number 3”

“Number 4”

There are transparent shapes over all the twelve  buttons which allows you to click them.

When he user first clicks any of the 10 numbered buttons 0-9 the  value of the variable “number 1” will change accordingly. So if the user clicks button 3 the value of the first Variable is set to ‘3’

The selection or each of the displayed numbers in sequence is determined through a  fifth variable “number position” which will add 1 to it. So after the first number is selected the 5th variable increments by  1 to 2 and now looks at  the second digit

( value 2) now when the user clicks on one of the 0-9 buttons it will change the value of the second digit and also increment the 5th variable again so that it now has a value of 3 and looks at the third digit

The clear button again has a transparent box over it. When the user clicks this it changes  the variables “number 1” “number 2” “number 3” and “number 4” to 0 and resets the “number position” variable to 1.

To use the enter button I have used a freeform “pick one” quiz question.

The enter button has two transparent shapes on it. The first which is always there is the incorrect button.

The second correct button is placed above this and it has an original state of hidden. This will only change to normal when “number 1” “number 2” “number 3” and “number 4” are the correct numbers.

The correct sequence is determined by the trigger; change state of enter button correct to normal when variable changes “numberposition” and if “variable 1 is equal to _” and if “variable 2 is equal to _” and if “variable 3 if equal to _” and If “variable 4 is equal to _”

The correct sequence should fit into the blank spaces into the blank spaces.

I really like the model you have used. thank you.

It is much simpler than the one that I created. (I had 6 layers with 16 buttons on each layer.

Now its a matter of applying that thinking to future projects. Looking forward to interacting here again in the future.

You can also use multiplication to update the number. If you multiply by ten each time it offsets the digits, so you could use one variable and check for the final value. This doesn't work with 0 as the first digit if you are including zero, but you could get round that with a special if statement to check for this and manually solve it. Seems like you have a system anyway though.

Thanks, Midi. I really like that idea.

Alternatively, the first number, multiplied by 1000, the second by 100 etc, then have four zeros in the background. then if no number goes in there, it just shows the zero (which would be there from the first number multiplied by 1000)

Hi,

Hoping I can resurrect this thread to find a solution because I am a novice user. I have been looking for a numerical keypad to enter quiz answers. I have used this very excellent keypad but I have one problem...

How do I display an empty text box prior to user entering correct digits? If you examine the attached .jpg, I want to ask math questions regarding times tables but want the text box blank before the user types in correct answer.

One way of doing this could be to replace the number variables used with text variables. Text variables can be left blank unlike number values.

Remember to update all the triggers to refer to the new text variables rather than the number variables. You will also need to update the variable references in the text entry box to reflect the names of the new variables.

Great solution, Jordan. The original .story is ingenious but now I've got this exactly how I want it. Nice work. Thanks for the help.

My issue now is if i have more than one question slide in a quiz, the keypad does not reset itself. It retains the digits from the previous slide's answer. How can I get it to return blank for each new question slide?

You need to add a few triggers at the start of each slide to reset the variables used.

e.g. adjust variable "number1" equal to value "blank" when timeline starts on "This slide".

You will also need to reset the "position" variable to 1 at the start of each slide.