Forum Discussion
Creating a stopwatch event to test reaction time
Hi everyone!
I'm busy with a road safety project. One of the topics is reaction time, and I'm thinking of creating a reaction time test where the user needs to start the test then wait for an object to appear and then click as soon as it appears. Storyline needs to then show the elapsed time between the start of the test and the time the user pressed stop.
I've searched for ways to create a stopwatch which can show the exact time "stop" is pressed but I'm not finding anything, and nothing I've tried has worked so far.
I'm totally clueless when it comes to Java script as well, so no hope there.
Does anyone have any suggestions on how to achieve this?
- MathNotermans-9Community Member
Actually quite simple. Add a timer like this https://codepen.io/cathydutton/pen/xxpOOw
And instead of starting it with a button, start it when showing the Object. Clicking it stops the timer and shows your responsetime.
- GerdaFourie-4b4Community Member
Thank you MathNotermans-9 I will play around with it and see if it works. I did find it on a search I've done but I was not sure if I could simply copy the java script into a trigger. I ended up enrolling into a short course on using java script in Storyline to see if I can learn more about it. That turned out to be a very nice and educational rabbit hole, so I haven't gotten round to testing your suggestion in Storyline to see if it works. I'll definitely try it. Thank you for taking the time to reply!
- MathNotermans-9Community Member
Quickly mocked up something from a timer i had before. Not perfect yet as it limited to seconds and you really need milliseconds for a 'reaction'-type game. But gives you a headstart on how to get a timer working in Storyline.
https://360.articulate.com/review/content/fb31109a-ba2a-4840-a8ac-cb0e19fac158/review
The .story is on Review too.
- NedimCommunity Member
I can't seem to find my post from a while ago, but I created a timed quiz interaction where the learner needed to answer a question correctly within a time limit. The time response was recorded, and if the answer was incorrect, the learner would earn 0 points. If the answer was correct, the learner would earn a varying amount of points depending on how quickly they responded.
If you think this could be useful for your interaction, I can upload my .story file for you. I'll see if I can find some spare time to update it to fit your needs.
Example:- GerdaFourie-4b4Community Member
Nedim thank you so much! Yes this may be helpful as well. It would be great to see the .story file as a reference. As I've told MathNotermans-9 in my previous reply, as soon as I get the game fully working, I will share it here for others to use as well.
- NedimCommunity Member
I experimented with it a bit and managed to display a picture at different points on the timeline each time the Timer button was clicked and the timer started. Then, I used JavaScript to record the time difference between when a picture appeared and when the timer was stopped. The timer can only be stopped after the picture appears. Additionally, I set up triggers in Storyline to reset a few variables and object states, allowing the interaction to restart from the beginning with the timer resetting as well.
Result: