how can I time 3 blocks together? | XM Community
Solved

how can I time 3 blocks together?

  • 24 March 2019
  • 9 replies
  • 4 views

I am buliding a survey and wish to set time for 3 separte blocks. How can I do this?
I can't make it all in one block because I need to randomize.
my goal is that participants will roll 3 dices in 30 seconds all thourgh the computer.
I build each block out of 6 questions - 6 numbers on the dice and randomized it so it will be similar to a real dice roll.
now I want the participants to roll 3 times the dice in 30 seconds.
thank you for the help
Inbal
icon

Best answer by TomG 25 March 2019, 15:46

View original

9 replies

Userlevel 5
Badge +6
Hi @inbalr333,
I don't understand what exactly you want to achieve.
What is "rolling dice"? Do you want to show participants a random number/question after 30 seconds or something else? And why is problem to do the same three tiimes?
Generally, you can use `setTimeout()` method in JavaScript or to delay something. You might find this discussion useful.
If you want to randomize almost the same questions, you can use Loop&merge. If you add there a code, it will be executed in each loop again.
Hi @fleb,

thank you for the help.
I want participant to roll a dice (want it to look like a real dice using images), 3 times separately and to do all of this in 30 seconds. So I would like to put timer (that they will see) on this 3 separte dice rolls. meaning the participant will have 30 seconds (and not longer) to roll 3 dices and write the result of one of this tosses.
So I don't want to set delay time...
Do you know how can I do that?

Thank you again.
Inbal
Userlevel 7
Badge +33
For dice roll code, refer below link

https://codepen.io/Pyremell/pen/eZGGXX/
@bansalpeeyush29 thank you
can you make it that instead of rolling a dice and seeing a number like "6" you will see this photo? !

I want to make it look like a real dice
Userlevel 7
Badge +33
I have found below code it will helps, first picture you can use as with 6:-

http://www.javascriptkit.com/script/script2/dice.shtml
@bansalpeeyush29 wow amazing!!!!
thank you!
How do I put the code in the survey?
Userlevel 7
Badge +27
> @inbalr333 said:
> Hi @fleb,
>
> thank you for the help.
> I want participant to roll a dice (want it to look like a real dice using images), 3 times separately and to do all of this in 30 seconds. So I would like to put timer (that they will see) on this 3 separte dice rolls. meaning the participant will have 30 seconds (and not longer) to roll 3 dices and write the result of one of this tosses.
> So I don't want to set delay time...
> Do you know how can I do that?
>
> Thank you again.
> Inbal
You'll need to write JavaScript to do this. Set an embedded variable "timeRemaining" to equal 30 before the randomizer. Put each of your blocks under a branch that checks to make sure timeRemaining > 0. Then in each of your blocks add a question with to the top fo the block wihth a `<span>` or `<div>` to display the timeRemaining (this question should always be displayed along with one of your other six random questions). Pipe timeRemaining into your JavaScript and use setInterval to update the timeRemaining embedded variable and the contents for your timeRemaining span/div every second. When timeRemaining hits zero click the NextButton.
hey @TomG
thank you so much for the help! sounds like this is going to solve my problem.
I'm new at this and need more instructions step by step.
1. How do I write the JavaScript?
2. I set embedded variable "timeRemaining" to equal 30 before the randomizer
3. "Put each of your blocks under a branch that checks to make sure timeRemaining > 0 "- I put each block but what does it mean " that checks to make sure timeRmaining 0?"
4. how can I make each question wihth a <span> or <div> to display the timeRemaining?

the rest I also dont know how to do....
could we skype and get your help?

thank you
Inbal
Userlevel 7
Badge +27
@inbalr333,

Sorry, but I don't have the time to walk you through it step by step.

Leave a Reply