Millisecond Forums

I need script to automatically end after stimulus or a continue button appears after stimulus plays through

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

By bkorsmo - 10/19/2018

Hi,

I want this script to automatically go to next script in batch at the end of the sound stimulus. Meanwhile I would like subjects to be able to quit at anytime during sound stimulus. I either want the script to automatically go to next script at end of sound or have a continue button appear only at the end of sound.

<html meditate>
/items = ("body scan during recording.html")
/ size = (90%,85%)
/ vposition = 40
</html>
**************************************
Response Buttons
**************************************
<text continue>
/items = ("Continue")
/ hposition = 84.5
/ vposition = 91.5
/ fontstyle = ("Arial", 5%, false, false, false, false, 5, 1)
/ txcolor = (white)
/txbgcolor = (dodgerblue)
/size = (30%, 15%)
/ vjustify = center
</text>

<text quit>
/items = ("Quit")
/ hposition = 15.5
/ vposition = 91.5
/ fontstyle = ("Arial", 5%, false, false, false, false, 5, 1)
/ txcolor = (white)
/txbgcolor =(darkturquoise)
/size = (30%, 15%)
/vjustify = center
</text>

<trial Consent>
/inputdevice = mouse
/stimulusframes = [1 = meditate, continue, quit, hi,timer]
/validresponse = (continue, quit)
/monkeyresponse = ("continue")
/ontrialend = [if (trial.Consent.response == "disagree") script.abort()]
</trial>


<sound hi>
/items= ("test.mp3")
/ playthrough = false
</sound>

<clock timer>
/ mode = timer
/ resetrate = block
/ erase = false
/ txcolor = (black)
/ txbgcolor = (white)
/timeout=5000
/ position = (50%,93%)
/ format = "mm:ss"
/ fontstyle = ("arial", 7%, false)
</clock>
**************************************
Consent Block
**************************************
<block Consent>
/trials = [1 = Consent]
By Dave - 10/19/2018

bkorsmo - Friday, October 19, 2018
Hi,

I want this script to automatically go to next script in batch at the end of the sound stimulus. Meanwhile I would like subjects to be able to quit at anytime during sound stimulus. I either want the script to automatically go to next script at end of sound or have a continue button appear only at the end of sound.

<html meditate>
/items = ("body scan during recording.html")
/ size = (90%,85%)
/ vposition = 40
</html>
**************************************
Response Buttons
**************************************
<text continue>
/items = ("Continue")
/ hposition = 84.5
/ vposition = 91.5
/ fontstyle = ("Arial", 5%, false, false, false, false, 5, 1)
/ txcolor = (white)
/txbgcolor = (dodgerblue)
/size = (30%, 15%)
/ vjustify = center
</text>

<text quit>
/items = ("Quit")
/ hposition = 15.5
/ vposition = 91.5
/ fontstyle = ("Arial", 5%, false, false, false, false, 5, 1)
/ txcolor = (white)
/txbgcolor =(darkturquoise)
/size = (30%, 15%)
/vjustify = center
</text>

<trial Consent>
/inputdevice = mouse
/stimulusframes = [1 = meditate, continue, quit, hi,timer]
/validresponse = (continue, quit)
/monkeyresponse = ("continue")
/ontrialend = [if (trial.Consent.response == "disagree") script.abort()]
</trial>


<sound hi>
/items= ("test.mp3")
/ playthrough = false
</sound>

<clock timer>
/ mode = timer
/ resetrate = block
/ erase = false
/ txcolor = (black)
/ txbgcolor = (white)
/timeout=5000
/ position = (50%,93%)
/ format = "mm:ss"
/ fontstyle = ("arial", 7%, false)
</clock>
**************************************
Consent Block
**************************************
<block Consent>
/trials = [1 = Consent]

#1: You need to use <video> -- not <sound> -- with MP3 files, otherwise your script won't work across platforms. Use <sound> exclusively with WAV files, nothing else.

#2: If you want the script to automatically end after the audio is done playing, set the /playthrough attribute to true, set the <trial> to accept no response and give it a short /timeout.


<trial Consent>
/stimulusframes = [1 = meditate, hi, timer]
/ validresponse = (0)
/ timeout = 1000
</trial>

<video hi>
/items= ("test.mp3")
/ playthrough = true
</video>

#3: If you want response options only to be displayed after the sound is done playing, use the trial's /stimulustimes to display the response options only at that time. I.e. if your audio is 30 seconds long, do

<trial Consent>
/inputdevice = mouse
/stimulustimes = [0 = meditate, hi,timer; 30000= continue, quit]
/validresponse = (continue, quit)
/monkeyresponse = ("continue")
/ontrialend = [if (trial.Consent.response == "disagree") script.abort()]
</trial>

#4: If you want subjects to *both* terminate the script at any time during the sound and allow continuation only after playthrough, display only the continue button at the end of the sound per /stimulustimes, but allow for the quit button from the start

<trial Consent>
/inputdevice = mouse
/stimulustimes = [0 = meditate, hi,timer, quit; 30000= continue]
/validresponse = (continue, quit)
/ beginsresponsetime = 0
/monkeyresponse = ("continue")
/ontrialend = [if (trial.Consent.response == "disagree") script.abort()]
</trial>

<video hi>
/items= ("test.mp3")
/ playthrough = false
</video>

#5: If you want automatic continuation after playthrough of the sound, but only want to provide a quit option, set either the <trial>'s or  the <block>'s  /timeout to the duration of the audio and only allow for a quit response during the trial:

<trial Consent>
/inputdevice = mouse
/stimulustimes = [0 = meditate, hi,timer, quit]
/validresponse = (quit)
/ beginsresponsetime = 0
/ timeout = 30000
/ontrialend = [if (trial.Consent.response == "disagree") script.abort()]
</trial>

<video hi>
/items= ("test.mp3")
/ playthrough = false
</video>