Millisecond Forums

Countdown timer

https://forums.millisecond.com/Topic32036.aspx

By Kambo - 8/4/2021

Heya,

I am trying to insert a clock timer counting down the 5 last seconds of the trial (30 seconds in total). That works fine, but the problem is that everything else is frozen in the time before that (i.e. not possible to select anything else in the first 25 sec). I realize that this probably has something to do with how I coded the stimulustimes attribute, but how can I get these processes to run simultaneously?

Cheers,

Heidi
By Dave - 8/4/2021

Kambo - 8/4/2021
Heya,

I am trying to insert a clock timer counting down the 5 last seconds of the trial (30 seconds in total). That works fine, but the problem is that everything else is frozen in the time before that (i.e. not possible to select anything else in the first 25 sec). I realize that this probably has something to do with how I coded the stimulustimes attribute, but how can I get these processes to run simultaneously?

Cheers,

Heidi

I'm not sure how to possibly answer that without you providing your code. Please do so.

Please also spell out, in detail, how exactly you want the given trial to work. That would include, among other things, what participants are supposed to be able to do during the first 25 seconds and if the countdown is supposed to be displayed at all if they respond before 25 seconds have elapsed.
By Kambo - 8/4/2021

Dave - 8/4/2021
Kambo - 8/4/2021
Heya,

I am trying to insert a clock timer counting down the 5 last seconds of the trial (30 seconds in total). That works fine, but the problem is that everything else is frozen in the time before that (i.e. not possible to select anything else in the first 25 sec). I realize that this probably has something to do with how I coded the stimulustimes attribute, but how can I get these processes to run simultaneously?

Cheers,

Heidi

I'm not sure how to possibly answer that without you providing your code. Please do so.

Please also spell out, in detail, how exactly you want the given trial to work. That would include, among other things, what participants are supposed to be able to do during the first 25 seconds and if the countdown is supposed to be displayed at all if they respond before 25 seconds have elapsed.
Sure. I am new to this, so someone in here helped with with parts of the code, whereas I have done some myself - i.e. there are probably several issues here.

It is an abstract reasoning matrix trial, where participants should select the item they believe corresponds to the matrix puzzle within 30 seconds. If they haven't selected anything within 25 seconds, a countdown timer should appear, making them aware that there is only 5 seconds left.

Code:
<values>
/ problemnumber = 1
/ correct_x = 0%
/ d1_x = 0%
/ d2_x = 0%
/ d3_x = 0%
</values>

<block matrixblock>
/ trials = [1-3 = matrixtrial]
</block>

<trial matrixtrial>
/ ontrialbegin = [
    values.problemnumber = list.testproblems.nextindex;
    values.correct_x = list.itempositions.nextvalue;
    values.d1_x = list.itempositions.nextvalue;
    values.d2_x = list.itempositions.nextvalue;
    values.d3_x = list.itempositions.nextvalue;
]
/ stimulustimes = [0=clearscreen, fixation; 500=clearscreen, problem, correctitem, distractoritem1, distractoritem2, distractoritem3; 25000 = countdown]
/ validresponse = (correctitem, distractoritem1, distractoritem2, distractoritem3)
/ correctresponse = (correctitem)
/ correctmessage = true(cmsg, 1000)
/ errormessage = true(emsg, 1000)
/ timeout = 30000
/ posttrialpause = 1000
</trial>

<list testproblems>
/ poolsize = 3
/ selectionmode = sequence
</list>

<list itempositions>
/ items = (20%, 40%, 60%, 80%)
/ selectionrate = always
</list>

<list countdown>
/ selectionmode = replace
</list>

<picture problem>
/ items = problemitems
/ position = (50%, 30%)
/ size = (30%, 55%)
/ erase = false
/ select = values.problemnumber
</picture>

<picture correctitem>
/ items = correctitems
/ size = (15%, 15%)
/ hposition = values.correct_x
/ vposition = 85%
/ erase = false
/ select = values.problemnumber
</picture>

<picture distractoritem1>
/ items = distractor1items
/ size = (15%, 15%)
/ hposition = values.d1_x
/ vposition = 85%
/ erase = false
/ select = values.problemnumber
</picture>

<picture distractoritem2>
/ items = distractor2items
/ size = (15%, 15%)
/ hposition = values.d2_x
/ vposition = 85%
/ erase = false
/ select = values.problemnumber
</picture>

<picture distractoritem3>
/ items = distractor3items
/ size = (15%, 15%)
/ hposition = values.d3_x
/ vposition = 85%
/ erase = false
/ select = values.problemnumber
</picture>

<item problemitems>
/ 1 = "tf1_1_m_ss3.jpeg"
/ 2 = "tf1_2_m_ss1.jpeg"
/ 3 = "tf1_3_m_ss2.jpeg"
</item>

<item correctitems>
/ 1 = "tf1_1_t1_ss3_md.jpeg"
/ 2 = "tf1_2_t1_ss1_md.jpeg"
/ 3 = "tf1_3_t1_ss2_md.jpeg"
</item>

<item distractor1items>
/ 1 = "tf1_1_t2_ss3_md.jpeg"
/ 2 = "tf1_2_t2_ss1_md.jpeg"
/ 3 = "tf1_3_t2_ss2_md.jpeg"
</item>

<item distractor2items>
/ 1 = "tf1_1_t3_ss3_md.jpeg"
/ 2 = "tf1_2_t3_ss1_md.jpeg"
/ 3 = "tf1_3_t3_ss2_md.jpeg"
</item>

<item distractor3items>
/ 1 = "tf1_1_t4_ss3_md.jpeg"
/ 2 = "tf1_2_t4_ss1_md.jpeg"
/ 3 = "tf1_3_t4_ss2_md.jpeg"
</item>

<item countdown>
/ 1 = "countdown"
</item>


<text fixation>
/ items = ("+")
/ erase = false
</text>

<text cmsg>
/ items = ("✓")
/ txcolor = green
/ erase = false
/ position = (50%, 70%)
</text>

<text emsg>
/ items = ("X")
/ txcolor = red
/ erase = false
/ position = (50%, 70%)
</text>

<clock countdown>
/ mode = timer
/ format = "mm:ss"
/ position = (90%, 5%)
/ timeout = 5000
</clock>
By Dave - 8/5/2021

Kambo - 8/5/2021
Dave - 8/4/2021
Kambo - 8/4/2021
Heya,

I am trying to insert a clock timer counting down the 5 last seconds of the trial (30 seconds in total). That works fine, but the problem is that everything else is frozen in the time before that (i.e. not possible to select anything else in the first 25 sec). I realize that this probably has something to do with how I coded the stimulustimes attribute, but how can I get these processes to run simultaneously?

Cheers,

Heidi

I'm not sure how to possibly answer that without you providing your code. Please do so.

Please also spell out, in detail, how exactly you want the given trial to work. That would include, among other things, what participants are supposed to be able to do during the first 25 seconds and if the countdown is supposed to be displayed at all if they respond before 25 seconds have elapsed.
Sure. I am new to this, so someone in here helped with with parts of the code, whereas I have done some myself - i.e. there are probably several issues here.

It is an abstract reasoning matrix trial, where participants should select the item they believe corresponds to the matrix puzzle within 30 seconds. If they haven't selected anything within 25 seconds, a countdown timer should appear, making them aware that there is only 5 seconds left.

Code:
<values>
/ problemnumber = 1
/ correct_x = 0%
/ d1_x = 0%
/ d2_x = 0%
/ d3_x = 0%
</values>

<block matrixblock>
/ trials = [1-3 = matrixtrial]
</block>

<trial matrixtrial>
/ ontrialbegin = [
    values.problemnumber = list.testproblems.nextindex;
    values.correct_x = list.itempositions.nextvalue;
    values.d1_x = list.itempositions.nextvalue;
    values.d2_x = list.itempositions.nextvalue;
    values.d3_x = list.itempositions.nextvalue;
]
/ stimulustimes = [0=clearscreen, fixation; 500=clearscreen, problem, correctitem, distractoritem1, distractoritem2, distractoritem3; 25000 = countdown]
/ validresponse = (correctitem, distractoritem1, distractoritem2, distractoritem3)
/ correctresponse = (correctitem)
/ correctmessage = true(cmsg, 1000)
/ errormessage = true(emsg, 1000)
/ timeout = 30000
/ posttrialpause = 1000
</trial>

<list testproblems>
/ poolsize = 3
/ selectionmode = sequence
</list>

<list itempositions>
/ items = (20%, 40%, 60%, 80%)
/ selectionrate = always
</list>

<list countdown>
/ selectionmode = replace
</list>

<picture problem>
/ items = problemitems
/ position = (50%, 30%)
/ size = (30%, 55%)
/ erase = false
/ select = values.problemnumber
</picture>

<picture correctitem>
/ items = correctitems
/ size = (15%, 15%)
/ hposition = values.correct_x
/ vposition = 85%
/ erase = false
/ select = values.problemnumber
</picture>

<picture distractoritem1>
/ items = distractor1items
/ size = (15%, 15%)
/ hposition = values.d1_x
/ vposition = 85%
/ erase = false
/ select = values.problemnumber
</picture>

<picture distractoritem2>
/ items = distractor2items
/ size = (15%, 15%)
/ hposition = values.d2_x
/ vposition = 85%
/ erase = false
/ select = values.problemnumber
</picture>

<picture distractoritem3>
/ items = distractor3items
/ size = (15%, 15%)
/ hposition = values.d3_x
/ vposition = 85%
/ erase = false
/ select = values.problemnumber
</picture>

<item problemitems>
/ 1 = "tf1_1_m_ss3.jpeg"
/ 2 = "tf1_2_m_ss1.jpeg"
/ 3 = "tf1_3_m_ss2.jpeg"
</item>

<item correctitems>
/ 1 = "tf1_1_t1_ss3_md.jpeg"
/ 2 = "tf1_2_t1_ss1_md.jpeg"
/ 3 = "tf1_3_t1_ss2_md.jpeg"
</item>

<item distractor1items>
/ 1 = "tf1_1_t2_ss3_md.jpeg"
/ 2 = "tf1_2_t2_ss1_md.jpeg"
/ 3 = "tf1_3_t2_ss2_md.jpeg"
</item>

<item distractor2items>
/ 1 = "tf1_1_t3_ss3_md.jpeg"
/ 2 = "tf1_2_t3_ss1_md.jpeg"
/ 3 = "tf1_3_t3_ss2_md.jpeg"
</item>

<item distractor3items>
/ 1 = "tf1_1_t4_ss3_md.jpeg"
/ 2 = "tf1_2_t4_ss1_md.jpeg"
/ 3 = "tf1_3_t4_ss2_md.jpeg"
</item>

<item countdown>
/ 1 = "countdown"
</item>


<text fixation>
/ items = ("+")
/ erase = false
</text>

<text cmsg>
/ items = ("✓")
/ txcolor = green
/ erase = false
/ position = (50%, 70%)
</text>

<text emsg>
/ items = ("X")
/ txcolor = red
/ erase = false
/ position = (50%, 70%)
</text>

<clock countdown>
/ mode = timer
/ format = "mm:ss"
/ position = (90%, 5%)
/ timeout = 5000
</clock>

The all you need to do is allow for the trial to accept responses at the time you wish it to start accepting responses. By default, a trial will only start accepting responses once it's entire stimulus presentation sequence has finished.

<trial matrixtrial>
/ ontrialbegin = [
    trial.matrixtrial.resetstimulusframes();
  values.problemnumber = list.testproblems.nextindex;
  values.correct_x = list.itempositions.nextvalue;
  values.d1_x = list.itempositions.nextvalue;
  values.d2_x = list.itempositions.nextvalue;
  values.d3_x = list.itempositions.nextvalue;
]
/ stimulustimes = [0=clearscreen, fixation; 500=clearscreen, problem, correctitem, distractoritem1, distractoritem2, distractoritem3; 25000 = countdown]
/ validresponse = (correctitem, distractoritem1, distractoritem2, distractoritem3)
/ beginresponsetime = 500
/ correctresponse = (correctitem)
/ correctmessage = true(cmsg, 1000)
/ errormessage = true(emsg, 1000)
/ timeout = 30000
/ posttrialpause = 1000
</trial>
By Kambo - 8/6/2021

Dave - 8/5/2021
Kambo - 8/5/2021
Dave - 8/4/2021
Kambo - 8/4/2021
Heya,

I am trying to insert a clock timer counting down the 5 last seconds of the trial (30 seconds in total). That works fine, but the problem is that everything else is frozen in the time before that (i.e. not possible to select anything else in the first 25 sec). I realize that this probably has something to do with how I coded the stimulustimes attribute, but how can I get these processes to run simultaneously?

Cheers,

Heidi

I'm not sure how to possibly answer that without you providing your code. Please do so.

Please also spell out, in detail, how exactly you want the given trial to work. That would include, among other things, what participants are supposed to be able to do during the first 25 seconds and if the countdown is supposed to be displayed at all if they respond before 25 seconds have elapsed.
Sure. I am new to this, so someone in here helped with with parts of the code, whereas I have done some myself - i.e. there are probably several issues here.

It is an abstract reasoning matrix trial, where participants should select the item they believe corresponds to the matrix puzzle within 30 seconds. If they haven't selected anything within 25 seconds, a countdown timer should appear, making them aware that there is only 5 seconds left.

Code:
<values>
/ problemnumber = 1
/ correct_x = 0%
/ d1_x = 0%
/ d2_x = 0%
/ d3_x = 0%
</values>

<block matrixblock>
/ trials = [1-3 = matrixtrial]
</block>

<trial matrixtrial>
/ ontrialbegin = [
    values.problemnumber = list.testproblems.nextindex;
    values.correct_x = list.itempositions.nextvalue;
    values.d1_x = list.itempositions.nextvalue;
    values.d2_x = list.itempositions.nextvalue;
    values.d3_x = list.itempositions.nextvalue;
]
/ stimulustimes = [0=clearscreen, fixation; 500=clearscreen, problem, correctitem, distractoritem1, distractoritem2, distractoritem3; 25000 = countdown]
/ validresponse = (correctitem, distractoritem1, distractoritem2, distractoritem3)
/ correctresponse = (correctitem)
/ correctmessage = true(cmsg, 1000)
/ errormessage = true(emsg, 1000)
/ timeout = 30000
/ posttrialpause = 1000
</trial>

<list testproblems>
/ poolsize = 3
/ selectionmode = sequence
</list>

<list itempositions>
/ items = (20%, 40%, 60%, 80%)
/ selectionrate = always
</list>

<list countdown>
/ selectionmode = replace
</list>

<picture problem>
/ items = problemitems
/ position = (50%, 30%)
/ size = (30%, 55%)
/ erase = false
/ select = values.problemnumber
</picture>

<picture correctitem>
/ items = correctitems
/ size = (15%, 15%)
/ hposition = values.correct_x
/ vposition = 85%
/ erase = false
/ select = values.problemnumber
</picture>

<picture distractoritem1>
/ items = distractor1items
/ size = (15%, 15%)
/ hposition = values.d1_x
/ vposition = 85%
/ erase = false
/ select = values.problemnumber
</picture>

<picture distractoritem2>
/ items = distractor2items
/ size = (15%, 15%)
/ hposition = values.d2_x
/ vposition = 85%
/ erase = false
/ select = values.problemnumber
</picture>

<picture distractoritem3>
/ items = distractor3items
/ size = (15%, 15%)
/ hposition = values.d3_x
/ vposition = 85%
/ erase = false
/ select = values.problemnumber
</picture>

<item problemitems>
/ 1 = "tf1_1_m_ss3.jpeg"
/ 2 = "tf1_2_m_ss1.jpeg"
/ 3 = "tf1_3_m_ss2.jpeg"
</item>

<item correctitems>
/ 1 = "tf1_1_t1_ss3_md.jpeg"
/ 2 = "tf1_2_t1_ss1_md.jpeg"
/ 3 = "tf1_3_t1_ss2_md.jpeg"
</item>

<item distractor1items>
/ 1 = "tf1_1_t2_ss3_md.jpeg"
/ 2 = "tf1_2_t2_ss1_md.jpeg"
/ 3 = "tf1_3_t2_ss2_md.jpeg"
</item>

<item distractor2items>
/ 1 = "tf1_1_t3_ss3_md.jpeg"
/ 2 = "tf1_2_t3_ss1_md.jpeg"
/ 3 = "tf1_3_t3_ss2_md.jpeg"
</item>

<item distractor3items>
/ 1 = "tf1_1_t4_ss3_md.jpeg"
/ 2 = "tf1_2_t4_ss1_md.jpeg"
/ 3 = "tf1_3_t4_ss2_md.jpeg"
</item>

<item countdown>
/ 1 = "countdown"
</item>


<text fixation>
/ items = ("+")
/ erase = false
</text>

<text cmsg>
/ items = ("✓")
/ txcolor = green
/ erase = false
/ position = (50%, 70%)
</text>

<text emsg>
/ items = ("X")
/ txcolor = red
/ erase = false
/ position = (50%, 70%)
</text>

<clock countdown>
/ mode = timer
/ format = "mm:ss"
/ position = (90%, 5%)
/ timeout = 5000
</clock>

The all you need to do is allow for the trial to accept responses at the time you wish it to start accepting responses. By default, a trial will only start accepting responses once it's entire stimulus presentation sequence has finished.

<trial matrixtrial>
/ ontrialbegin = [
    trial.matrixtrial.resetstimulusframes();
  values.problemnumber = list.testproblems.nextindex;
  values.correct_x = list.itempositions.nextvalue;
  values.d1_x = list.itempositions.nextvalue;
  values.d2_x = list.itempositions.nextvalue;
  values.d3_x = list.itempositions.nextvalue;
]
/ stimulustimes = [0=clearscreen, fixation; 500=clearscreen, problem, correctitem, distractoritem1, distractoritem2, distractoritem3; 25000 = countdown]
/ validresponse = (correctitem, distractoritem1, distractoritem2, distractoritem3)
/ beginresponsetime = 500
/ correctresponse = (correctitem)
/ correctmessage = true(cmsg, 1000)
/ errormessage = true(emsg, 1000)
/ timeout = 30000
/ posttrialpause = 1000
</trial>

Thank you!