Combination lock with a dial?

Nov 29, 2021

Hi.

Would it be possible to use a dial to create a combination lock, that requires each of the four digits of a specific year (i.e. 1942) to be dialed in individually, and confirmed with a button click, then once each number has been entered correctly the next slide "unlocks" (becomes available to the user).

Thanks.

4 Replies
Steve Gannon

This is certainly possible, Stuart.

You will likely want to use 5 numeric variables, one for each of the four digits and another to serve as a counter. You can use triggers to check each dialed value as it's selected but I would probably allow the user to select all four values before validating any of them. Increment the counter by 1 as each value is selected. Then, use the counter variable (when it reaches 4) to activate a Submit (or "Check Code") button (alternately, you can omit the counter and just trigger the button when the fourth value is selected). When that button is selected, validate the four dial values and either display a message indicating that the code selected is incorrect or activate the Next/Continue button if it's correct. (Be sure to reset the variables to 0 when the slide starts if you want to allow the user to be able to return to this slide and repeat the interaction.)

To make it realistic, you may want to require the user to rotate the dial to the right first, and then left, and then right, and left once more. For example, the user rotates to "1," then has to continue rotating right past "9" and then back to the left to "9" and so on. To do this, you would need a variable (could be T/F, a numeric variable, or a text variable assigned the value of "left" or "right") to track whether the user is rotating the dial to the left or right. Another numeric variable could assist with this by determining if the dial value is incrementing (rotating right) or decrementing (rotating left).

An important note: Be sure the "Update" field on the Dial Tools Design tab is set to "When learner releases" (otherwise, all they would have to do is rotate the dial beyond the value and it would be captured by your trigger). Provide instructions to the user to release the mouse button momentarily once they turn the dial to the desired value.

You may also want to consider displaying the selected values in four side-by-side boxes.

This all may sound complicated but if you break it into little steps, you will figure out the variables and triggers needed. I'm sure others will have completely different techniques to achieve the same thing.