Move a stimulus


Author
Message
Kevin_Bague
Kevin_Bague
Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)
Group: Forum Members
Posts: 15, Visits: 35
Hello, I need again help to create a trial. 

I would like to create a trial in which participants should move a cursor along a line in pushing a button. However, I don't know how to code that? Do you help me? 
I think I must code dynamic stimuli which move according to the response of the participant. 

Have a nice day  

Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
Kevin_Bague - 2/2/2020
Hello, I need again help to create a trial. 

I would like to create a trial in which participants should move a cursor along a line in pushing a button. However, I don't know how to code that? Do you help me? 
I think I must code dynamic stimuli which move according to the response of the participant. 

Have a nice day  

You need to be more specific about what exactly you want.
Kevin_Bague
Kevin_Bague
Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)
Group: Forum Members
Posts: 15, Visits: 35
Dave - 2/3/2020
Kevin_Bague - 2/2/2020
Hello, I need again help to create a trial. 

I would like to create a trial in which participants should move a cursor along a line in pushing a button. However, I don't know how to code that? Do you help me? 
I think I must code dynamic stimuli which move according to the response of the participant. 

Have a nice day  

You need to be more specific about what exactly you want.

In my experiment I need a trial with this goal : stop a sound(stressor) in moving a shape (square, circle....) along a line.

More specifically, I would like a trial with this sequence :
1) A fixation cross during 20 seconds
2) a red circle to inform song apparition (during 5seconds) + the line and shape which allow to stop the stimulus
3) 5 seconds later, the sound during 5 seconds.

The trial is stopped, if participant put the shape from one side to the other side of line or if it can't respond before the end of the sound.

I don't know if i'm clear.

I'm trying to code it, but I don't manage it in one trial... I put my code below.

Sorry I'm novice in programming







<defaults >
/ screencolor = black
</defaults>

****************************
CURSOR

<shape line>
/ shape = rectangle
/ size = (1500, 50)
/ position = (50, 75)
/ color = white
</shape>

<shape p1>
/ shape = circle
/ size = (50, 50)
/ position = (12.5, 75)
/ color = blue
</shape>

<shape p2>
/ shape = circle
/ size = (50, 50)
/ position = (50, 75)
/ color = blue
</shape>

<shape p3>
/ shape = circle
/ size = (50, 50)
/ position = (87.5, 75)
/ color = green
</shape>

******************************
STIMULI

<item S>
/1 = "3000Hz (5s).wav"
</item>

<sound S>
/ items = item.S
</sound>

<item Alert>
/1 = "Red circle stimuli.png"
</item>

<picture Alert>
/ items = item.Alert
</picture>

<item fixation>
/1 = "fixation cross.png"
</item>

<picture fixation>
/ items = item.fixation
</picture>

<trial alert>
/ stimulusframes = [1=Alert]
/ timeout = 10000
</trial>

<shape cache>
/ shape = circle
/ size = (200, 200)
/ position = (50, 50)
/ color = black
</shape>

************************************

<trial 1>
/ stimulustimes = [0=fixation; 20000= line, p1, cache ; 25000=sound.S]
/ validresponse = ("a")
/ beginresponsetime = 25000
/ branch = [
    if (trial.1)trial.2
]
</trial>

<trial 2>
/ stimulustimes = [0=line, p2, sound.S, cache ]
/ validresponse = ("a")
/ branch = [
    if (trial.2)trial.3
]
</trial>

<trial 3>
/ stimulustimes = [0=line, p3]
/ trialduration = 2000
</trial>

<block cursor>
/ trials = [1-3=1]
/ timeout = 30000
</block>




Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
Kevin_Bague - 2/3/2020
Dave - 2/3/2020
Kevin_Bague - 2/2/2020
Hello, I need again help to create a trial. 

I would like to create a trial in which participants should move a cursor along a line in pushing a button. However, I don't know how to code that? Do you help me? 
I think I must code dynamic stimuli which move according to the response of the participant. 

Have a nice day  

You need to be more specific about what exactly you want.

In my experiment I need a trial with this goal : stop a sound(stressor) in moving a shape (square, circle....) along a line.

More specifically, I would like a trial with this sequence :
1) A fixation cross during 20 seconds
2) a red circle to inform song apparition (during 5seconds) + the line and shape which allow to stop the stimulus
3) 5 seconds later, the sound during 5 seconds.

The trial is stopped, if participant put the shape from one side to the other side of line or if it can't respond before the end of the sound.

I don't know if i'm clear.

I'm trying to code it, but I don't manage it in one trial... I put my code below.

Sorry I'm novice in programming







<defaults >
/ screencolor = black
</defaults>

****************************
CURSOR

<shape line>
/ shape = rectangle
/ size = (1500, 50)
/ position = (50, 75)
/ color = white
</shape>

<shape p1>
/ shape = circle
/ size = (50, 50)
/ position = (12.5, 75)
/ color = blue
</shape>

<shape p2>
/ shape = circle
/ size = (50, 50)
/ position = (50, 75)
/ color = blue
</shape>

<shape p3>
/ shape = circle
/ size = (50, 50)
/ position = (87.5, 75)
/ color = green
</shape>

******************************
STIMULI

<item S>
/1 = "3000Hz (5s).wav"
</item>

<sound S>
/ items = item.S
</sound>

<item Alert>
/1 = "Red circle stimuli.png"
</item>

<picture Alert>
/ items = item.Alert
</picture>

<item fixation>
/1 = "fixation cross.png"
</item>

<picture fixation>
/ items = item.fixation
</picture>

<trial alert>
/ stimulusframes = [1=Alert]
/ timeout = 10000
</trial>

<shape cache>
/ shape = circle
/ size = (200, 200)
/ position = (50, 50)
/ color = black
</shape>

************************************

<trial 1>
/ stimulustimes = [0=fixation; 20000= line, p1, cache ; 25000=sound.S]
/ validresponse = ("a")
/ beginresponsetime = 25000
/ branch = [
    if (trial.1)trial.2
]
</trial>

<trial 2>
/ stimulustimes = [0=line, p2, sound.S, cache ]
/ validresponse = ("a")
/ branch = [
    if (trial.2)trial.3
]
</trial>

<trial 3>
/ stimulustimes = [0=line, p3]
/ trialduration = 2000
</trial>

<block cursor>
/ trials = [1-3=1]
/ timeout = 30000
</block>




Please explain how you want the movement of the circle controlled. By repeated key press? If so, by what increment per key press? By dragging & dropping with the mouse? Something else?

Also, whenever a script you post requires external files to run, please provide those files.
Edited 4 Years Ago by Dave
Kevin_Bague
Kevin_Bague
Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)
Group: Forum Members
Posts: 15, Visits: 35
Dave - 2/3/2020
Kevin_Bague - 2/3/2020
Dave - 2/3/2020
Kevin_Bague - 2/2/2020
Hello, I need again help to create a trial. 

I would like to create a trial in which participants should move a cursor along a line in pushing a button. However, I don't know how to code that? Do you help me? 
I think I must code dynamic stimuli which move according to the response of the participant. 

Have a nice day  

You need to be more specific about what exactly you want.

In my experiment I need a trial with this goal : stop a sound(stressor) in moving a shape (square, circle....) along a line.

More specifically, I would like a trial with this sequence :
1) A fixation cross during 20 seconds
2) a red circle to inform song apparition (during 5seconds) + the line and shape which allow to stop the stimulus
3) 5 seconds later, the sound during 5 seconds.

The trial is stopped, if participant put the shape from one side to the other side of line or if it can't respond before the end of the sound.

I don't know if i'm clear.

I'm trying to code it, but I don't manage it in one trial... I put my code below.

Sorry I'm novice in programming







<defaults >
/ screencolor = black
</defaults>

****************************
CURSOR

<shape line>
/ shape = rectangle
/ size = (1500, 50)
/ position = (50, 75)
/ color = white
</shape>

<shape p1>
/ shape = circle
/ size = (50, 50)
/ position = (12.5, 75)
/ color = blue
</shape>

<shape p2>
/ shape = circle
/ size = (50, 50)
/ position = (50, 75)
/ color = blue
</shape>

<shape p3>
/ shape = circle
/ size = (50, 50)
/ position = (87.5, 75)
/ color = green
</shape>

******************************
STIMULI

<item S>
/1 = "3000Hz (5s).wav"
</item>

<sound S>
/ items = item.S
</sound>

<item Alert>
/1 = "Red circle stimuli.png"
</item>

<picture Alert>
/ items = item.Alert
</picture>

<item fixation>
/1 = "fixation cross.png"
</item>

<picture fixation>
/ items = item.fixation
</picture>

<trial alert>
/ stimulusframes = [1=Alert]
/ timeout = 10000
</trial>

<shape cache>
/ shape = circle
/ size = (200, 200)
/ position = (50, 50)
/ color = black
</shape>

************************************

<trial 1>
/ stimulustimes = [0=fixation; 20000= line, p1, cache ; 25000=sound.S]
/ validresponse = ("a")
/ beginresponsetime = 25000
/ branch = [
    if (trial.1)trial.2
]
</trial>

<trial 2>
/ stimulustimes = [0=line, p2, sound.S, cache ]
/ validresponse = ("a")
/ branch = [
    if (trial.2)trial.3
]
</trial>

<trial 3>
/ stimulustimes = [0=line, p3]
/ trialduration = 2000
</trial>

<block cursor>
/ trials = [1-3=1]
/ timeout = 30000
</block>




Please explain how you want the movement of the circle controlled. By repeated key press? If so, by what increment per key press? By dragging & dropping with the mouse? Something else?

Also, whenever a script you post requires external files to run, please provide those files.

Both solutions are perfect for me, what is the easiest? In the case of repeated keypress, 2 or 3 press are enough. I think dragging and dropping with the mouse is simpler, no?

Oh sorry, I include these files in this message 


Attachments
fixation cross.png (188 views, 1,022 bytes)
Red circle stimuli.png (191 views, 20.00 KB)
3000Hz (5s).wav.zip (202 views, 3.00 KB)
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
Kevin_Bague - 2/4/2020
Dave - 2/3/2020
Kevin_Bague - 2/3/2020
Dave - 2/3/2020
Kevin_Bague - 2/2/2020
Hello, I need again help to create a trial. 

I would like to create a trial in which participants should move a cursor along a line in pushing a button. However, I don't know how to code that? Do you help me? 
I think I must code dynamic stimuli which move according to the response of the participant. 

Have a nice day  

You need to be more specific about what exactly you want.

In my experiment I need a trial with this goal : stop a sound(stressor) in moving a shape (square, circle....) along a line.

More specifically, I would like a trial with this sequence :
1) A fixation cross during 20 seconds
2) a red circle to inform song apparition (during 5seconds) + the line and shape which allow to stop the stimulus
3) 5 seconds later, the sound during 5 seconds.

The trial is stopped, if participant put the shape from one side to the other side of line or if it can't respond before the end of the sound.

I don't know if i'm clear.

I'm trying to code it, but I don't manage it in one trial... I put my code below.

Sorry I'm novice in programming







<defaults >
/ screencolor = black
</defaults>

****************************
CURSOR

<shape line>
/ shape = rectangle
/ size = (1500, 50)
/ position = (50, 75)
/ color = white
</shape>

<shape p1>
/ shape = circle
/ size = (50, 50)
/ position = (12.5, 75)
/ color = blue
</shape>

<shape p2>
/ shape = circle
/ size = (50, 50)
/ position = (50, 75)
/ color = blue
</shape>

<shape p3>
/ shape = circle
/ size = (50, 50)
/ position = (87.5, 75)
/ color = green
</shape>

******************************
STIMULI

<item S>
/1 = "3000Hz (5s).wav"
</item>

<sound S>
/ items = item.S
</sound>

<item Alert>
/1 = "Red circle stimuli.png"
</item>

<picture Alert>
/ items = item.Alert
</picture>

<item fixation>
/1 = "fixation cross.png"
</item>

<picture fixation>
/ items = item.fixation
</picture>

<trial alert>
/ stimulusframes = [1=Alert]
/ timeout = 10000
</trial>

<shape cache>
/ shape = circle
/ size = (200, 200)
/ position = (50, 50)
/ color = black
</shape>

************************************

<trial 1>
/ stimulustimes = [0=fixation; 20000= line, p1, cache ; 25000=sound.S]
/ validresponse = ("a")
/ beginresponsetime = 25000
/ branch = [
    if (trial.1)trial.2
]
</trial>

<trial 2>
/ stimulustimes = [0=line, p2, sound.S, cache ]
/ validresponse = ("a")
/ branch = [
    if (trial.2)trial.3
]
</trial>

<trial 3>
/ stimulustimes = [0=line, p3]
/ trialduration = 2000
</trial>

<block cursor>
/ trials = [1-3=1]
/ timeout = 30000
</block>




Please explain how you want the movement of the circle controlled. By repeated key press? If so, by what increment per key press? By dragging & dropping with the mouse? Something else?

Also, whenever a script you post requires external files to run, please provide those files.

Both solutions are perfect for me, what is the easiest? In the case of repeated keypress, 2 or 3 press are enough. I think dragging and dropping with the mouse is simpler, no?

Oh sorry, I include these files in this message 


Then I would do something like this:

<defaults >
/ screencolor = transparent
</defaults>

****************************
CURSOR

<shape line>
/ shape = rectangle
/ size = (1500, 50)
/ position = (50, 75)
/ color = white
/ erase = false
</shape>

<shape p1>
/ shape = circle
/ size = (50, 50)
/ hposition = values.x
/ vposition = 75%
/ color = blue
/ erase = false
</shape>

<values>
/ x = 0%
</values>

******************************
STIMULI

<item S>
/1 = "3000Hz (5s).wav"
</item>

<sound S>
/ items = item.S
/ playthrough = false
</sound>

<item fixation>
/1 = "fixation cross.png"
</item>

<picture fixation>
/ items = item.fixation
/ erase = false
</picture>

<shape bg>
/ shape = rectangle
/ color = black
/ size = (100%, 100%)
/ erase = false
</shape>

<text success>
/ items = ("Well done!")
/ txcolor = green
/ erase = false
</text>

<text fail>
/ items = ("Not quick enough.")
/ txcolor = red
/ erase = false
</text>

************************************

<trial fix>
/ stimulustimes = [0=bg,fixation; 20000 = line, p1]
/ validresponse = (0)
/ timeout = 25000
</trial>

<trial move>
/ stimulustimes = [0=line, p1]
/ validresponse = (" ")
/ ontrialend = [
    if (trial.move.response == 57) {
        values.x += 12.5%;
    };
    if (values.x >= 87.5%) {
        shape.p1.color = green;
    };
]
/ branch = [
    if (values.x >= 87.5%) notrial else trial.move;
]
/ recorddata = false
</trial>

<trial success>
/ stimulustimes = [0=line, p1, success]
/ validresponse = (57)
</trial>

<trial fail>
/ stimulustimes = [0=line, p1, fail]
/ validresponse = (57)
</trial>

<block fix>
/ onblockbegin = [
    shape.p1.color = blue;
    values.x = 12.5%;
]
/ trials = [1=fix]
/ timeout = 25000
/ branch = [
    block.sound
]
</block>

<block sound>
/ bgstim = (bg, line, p1, s)
/ trials = [1=move]
/ timeout = 5000
/ branch = [
    if(values.x >= 87.5%) block.success else block.fail
]
</block>

<block success>
/ trials = [1=success]
</block>

<block fail>
/ onblockbegin = [
    shape.p1.color = red;
]
/ trials = [1=fail]
</block>

<expt>
/ blocks = [1-3 = fix]
</expt>


Kevin_Bague
Kevin_Bague
Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)Associate Member (148 reputation)
Group: Forum Members
Posts: 15, Visits: 35
Dave - 2/4/2020
Kevin_Bague - 2/4/2020
Dave - 2/3/2020
Kevin_Bague - 2/3/2020
Dave - 2/3/2020
Kevin_Bague - 2/2/2020
Hello, I need again help to create a trial. 

I would like to create a trial in which participants should move a cursor along a line in pushing a button. However, I don't know how to code that? Do you help me? 
I think I must code dynamic stimuli which move according to the response of the participant. 

Have a nice day  

You need to be more specific about what exactly you want.

In my experiment I need a trial with this goal : stop a sound(stressor) in moving a shape (square, circle....) along a line.

More specifically, I would like a trial with this sequence :
1) A fixation cross during 20 seconds
2) a red circle to inform song apparition (during 5seconds) + the line and shape which allow to stop the stimulus
3) 5 seconds later, the sound during 5 seconds.

The trial is stopped, if participant put the shape from one side to the other side of line or if it can't respond before the end of the sound.

I don't know if i'm clear.

I'm trying to code it, but I don't manage it in one trial... I put my code below.

Sorry I'm novice in programming







<defaults >
/ screencolor = black
</defaults>

****************************
CURSOR

<shape line>
/ shape = rectangle
/ size = (1500, 50)
/ position = (50, 75)
/ color = white
</shape>

<shape p1>
/ shape = circle
/ size = (50, 50)
/ position = (12.5, 75)
/ color = blue
</shape>

<shape p2>
/ shape = circle
/ size = (50, 50)
/ position = (50, 75)
/ color = blue
</shape>

<shape p3>
/ shape = circle
/ size = (50, 50)
/ position = (87.5, 75)
/ color = green
</shape>

******************************
STIMULI

<item S>
/1 = "3000Hz (5s).wav"
</item>

<sound S>
/ items = item.S
</sound>

<item Alert>
/1 = "Red circle stimuli.png"
</item>

<picture Alert>
/ items = item.Alert
</picture>

<item fixation>
/1 = "fixation cross.png"
</item>

<picture fixation>
/ items = item.fixation
</picture>

<trial alert>
/ stimulusframes = [1=Alert]
/ timeout = 10000
</trial>

<shape cache>
/ shape = circle
/ size = (200, 200)
/ position = (50, 50)
/ color = black
</shape>

************************************

<trial 1>
/ stimulustimes = [0=fixation; 20000= line, p1, cache ; 25000=sound.S]
/ validresponse = ("a")
/ beginresponsetime = 25000
/ branch = [
    if (trial.1)trial.2
]
</trial>

<trial 2>
/ stimulustimes = [0=line, p2, sound.S, cache ]
/ validresponse = ("a")
/ branch = [
    if (trial.2)trial.3
]
</trial>

<trial 3>
/ stimulustimes = [0=line, p3]
/ trialduration = 2000
</trial>

<block cursor>
/ trials = [1-3=1]
/ timeout = 30000
</block>




Please explain how you want the movement of the circle controlled. By repeated key press? If so, by what increment per key press? By dragging & dropping with the mouse? Something else?

Also, whenever a script you post requires external files to run, please provide those files.

Both solutions are perfect for me, what is the easiest? In the case of repeated keypress, 2 or 3 press are enough. I think dragging and dropping with the mouse is simpler, no?

Oh sorry, I include these files in this message 


Then I would do something like this:

<defaults >
/ screencolor = transparent
</defaults>

****************************
CURSOR

<shape line>
/ shape = rectangle
/ size = (1500, 50)
/ position = (50, 75)
/ color = white
/ erase = false
</shape>

<shape p1>
/ shape = circle
/ size = (50, 50)
/ hposition = values.x
/ vposition = 75%
/ color = blue
/ erase = false
</shape>

<values>
/ x = 0%
</values>

******************************
STIMULI

<item S>
/1 = "3000Hz (5s).wav"
</item>

<sound S>
/ items = item.S
/ playthrough = false
</sound>

<item fixation>
/1 = "fixation cross.png"
</item>

<picture fixation>
/ items = item.fixation
/ erase = false
</picture>

<shape bg>
/ shape = rectangle
/ color = black
/ size = (100%, 100%)
/ erase = false
</shape>

<text success>
/ items = ("Well done!")
/ txcolor = green
/ erase = false
</text>

<text fail>
/ items = ("Not quick enough.")
/ txcolor = red
/ erase = false
</text>

************************************

<trial fix>
/ stimulustimes = [0=bg,fixation; 20000 = line, p1]
/ validresponse = (0)
/ timeout = 25000
</trial>

<trial move>
/ stimulustimes = [0=line, p1]
/ validresponse = (" ")
/ ontrialend = [
    if (trial.move.response == 57) {
        values.x += 12.5%;
    };
    if (values.x >= 87.5%) {
        shape.p1.color = green;
    };
]
/ branch = [
    if (values.x >= 87.5%) notrial else trial.move;
]
/ recorddata = false
</trial>

<trial success>
/ stimulustimes = [0=line, p1, success]
/ validresponse = (57)
</trial>

<trial fail>
/ stimulustimes = [0=line, p1, fail]
/ validresponse = (57)
</trial>

<block fix>
/ onblockbegin = [
    shape.p1.color = blue;
    values.x = 12.5%;
]
/ trials = [1=fix]
/ timeout = 25000
/ branch = [
    block.sound
]
</block>

<block sound>
/ bgstim = (bg, line, p1, s)
/ trials = [1=move]
/ timeout = 5000
/ branch = [
    if(values.x >= 87.5%) block.success else block.fail
]
</block>

<block success>
/ trials = [1=success]
</block>

<block fail>
/ onblockbegin = [
    shape.p1.color = red;
]
/ trials = [1=fail]
</block>

<expt>
/ blocks = [1-3 = fix]
</expt>


Thank you !!!!!!

I have just 2 questions :
1) If I don't give a response, trial is failed, but the next trial does not come automatically, can I do it ?
2) As a likert scale, is it possible to summarize data for one trial, that is the latency to stop the sound (without fixation cross) 
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
Kevin_Bague - 2/4/2020
Dave - 2/4/2020
Kevin_Bague - 2/4/2020
Dave - 2/3/2020
Kevin_Bague - 2/3/2020
Dave - 2/3/2020
Kevin_Bague - 2/2/2020
Hello, I need again help to create a trial. 

I would like to create a trial in which participants should move a cursor along a line in pushing a button. However, I don't know how to code that? Do you help me? 
I think I must code dynamic stimuli which move according to the response of the participant. 

Have a nice day  

You need to be more specific about what exactly you want.

In my experiment I need a trial with this goal : stop a sound(stressor) in moving a shape (square, circle....) along a line.

More specifically, I would like a trial with this sequence :
1) A fixation cross during 20 seconds
2) a red circle to inform song apparition (during 5seconds) + the line and shape which allow to stop the stimulus
3) 5 seconds later, the sound during 5 seconds.

The trial is stopped, if participant put the shape from one side to the other side of line or if it can't respond before the end of the sound.

I don't know if i'm clear.

I'm trying to code it, but I don't manage it in one trial... I put my code below.

Sorry I'm novice in programming







<defaults >
/ screencolor = black
</defaults>

****************************
CURSOR

<shape line>
/ shape = rectangle
/ size = (1500, 50)
/ position = (50, 75)
/ color = white
</shape>

<shape p1>
/ shape = circle
/ size = (50, 50)
/ position = (12.5, 75)
/ color = blue
</shape>

<shape p2>
/ shape = circle
/ size = (50, 50)
/ position = (50, 75)
/ color = blue
</shape>

<shape p3>
/ shape = circle
/ size = (50, 50)
/ position = (87.5, 75)
/ color = green
</shape>

******************************
STIMULI

<item S>
/1 = "3000Hz (5s).wav"
</item>

<sound S>
/ items = item.S
</sound>

<item Alert>
/1 = "Red circle stimuli.png"
</item>

<picture Alert>
/ items = item.Alert
</picture>

<item fixation>
/1 = "fixation cross.png"
</item>

<picture fixation>
/ items = item.fixation
</picture>

<trial alert>
/ stimulusframes = [1=Alert]
/ timeout = 10000
</trial>

<shape cache>
/ shape = circle
/ size = (200, 200)
/ position = (50, 50)
/ color = black
</shape>

************************************

<trial 1>
/ stimulustimes = [0=fixation; 20000= line, p1, cache ; 25000=sound.S]
/ validresponse = ("a")
/ beginresponsetime = 25000
/ branch = [
    if (trial.1)trial.2
]
</trial>

<trial 2>
/ stimulustimes = [0=line, p2, sound.S, cache ]
/ validresponse = ("a")
/ branch = [
    if (trial.2)trial.3
]
</trial>

<trial 3>
/ stimulustimes = [0=line, p3]
/ trialduration = 2000
</trial>

<block cursor>
/ trials = [1-3=1]
/ timeout = 30000
</block>




Please explain how you want the movement of the circle controlled. By repeated key press? If so, by what increment per key press? By dragging & dropping with the mouse? Something else?

Also, whenever a script you post requires external files to run, please provide those files.

Both solutions are perfect for me, what is the easiest? In the case of repeated keypress, 2 or 3 press are enough. I think dragging and dropping with the mouse is simpler, no?

Oh sorry, I include these files in this message 


Then I would do something like this:

<defaults >
/ screencolor = transparent
</defaults>

****************************
CURSOR

<shape line>
/ shape = rectangle
/ size = (1500, 50)
/ position = (50, 75)
/ color = white
/ erase = false
</shape>

<shape p1>
/ shape = circle
/ size = (50, 50)
/ hposition = values.x
/ vposition = 75%
/ color = blue
/ erase = false
</shape>

<values>
/ x = 0%
</values>

******************************
STIMULI

<item S>
/1 = "3000Hz (5s).wav"
</item>

<sound S>
/ items = item.S
/ playthrough = false
</sound>

<item fixation>
/1 = "fixation cross.png"
</item>

<picture fixation>
/ items = item.fixation
/ erase = false
</picture>

<shape bg>
/ shape = rectangle
/ color = black
/ size = (100%, 100%)
/ erase = false
</shape>

<text success>
/ items = ("Well done!")
/ txcolor = green
/ erase = false
</text>

<text fail>
/ items = ("Not quick enough.")
/ txcolor = red
/ erase = false
</text>

************************************

<trial fix>
/ stimulustimes = [0=bg,fixation; 20000 = line, p1]
/ validresponse = (0)
/ timeout = 25000
</trial>

<trial move>
/ stimulustimes = [0=line, p1]
/ validresponse = (" ")
/ ontrialend = [
    if (trial.move.response == 57) {
        values.x += 12.5%;
    };
    if (values.x >= 87.5%) {
        shape.p1.color = green;
    };
]
/ branch = [
    if (values.x >= 87.5%) notrial else trial.move;
]
/ recorddata = false
</trial>

<trial success>
/ stimulustimes = [0=line, p1, success]
/ validresponse = (57)
</trial>

<trial fail>
/ stimulustimes = [0=line, p1, fail]
/ validresponse = (57)
</trial>

<block fix>
/ onblockbegin = [
    shape.p1.color = blue;
    values.x = 12.5%;
]
/ trials = [1=fix]
/ timeout = 25000
/ branch = [
    block.sound
]
</block>

<block sound>
/ bgstim = (bg, line, p1, s)
/ trials = [1=move]
/ timeout = 5000
/ branch = [
    if(values.x >= 87.5%) block.success else block.fail
]
</block>

<block success>
/ trials = [1=success]
</block>

<block fail>
/ onblockbegin = [
    shape.p1.color = red;
]
/ trials = [1=fail]
</block>

<expt>
/ blocks = [1-3 = fix]
</expt>


Thank you !!!!!!

I have just 2 questions :
1) If I don't give a response, trial is failed, but the next trial does not come automatically, can I do it ?
2) As a likert scale, is it possible to summarize data for one trial, that is the latency to stop the sound (without fixation cross) 

1) If I don't give a response, trial is failed, but the next trial does not come automatically, can I do it ?

The script I posted will run a total of three "trials" (actually blocks) regardless of whether you fail or succeed.

<expt>
/ blocks = [1-3 = fix]
</expt>

If you want the next trial to start automatically after the success or fail message, set the /validresponse in <trial success> and <trial fail> to 0 and give those trials a suitable /trialduration.

<trial success>
/ stimulustimes = [0=line, p1, success]
/ validresponse = (0)
/ trialduration = 2000
</trial>

<trial fail>
/ stimulustimes = [0=line, p1, fail]
/ validresponse = (0)
/ trialduration = 2000
</trial>


2) As a likert scale, is it possible to summarize data for one trial, that is the latency to stop the sound (without fixation cross)

Yes. You can just log the sound block's elapsedtime at the point the circle reaches its endpoint / destination. Something like this:

<defaults >
/ screencolor = transparent
</defaults>

****************************
CURSOR

<shape line>
/ shape = rectangle
/ size = (1500, 50)
/ position = (50, 75)
/ color = white
/ erase = false
</shape>

<shape p1>
/ shape = circle
/ size = (50, 50)
/ hposition = values.x
/ vposition = 75%
/ color = blue
/ erase = false
</shape>

<values>
/ x = 0%
/ stop_latency = ""
</values>

******************************
STIMULI

<item S>
/1 = "3000Hz (5s).wav"
</item>

<sound S>
/ items = item.S
/ playthrough = false
</sound>

<item fixation>
/1 = "fixation cross.png"
</item>

<picture fixation>
/ items = item.fixation
/ erase = false
</picture>

<shape bg>
/ shape = rectangle
/ color = black
/ size = (100%, 100%)
/ erase = false
</shape>

<text success>
/ items = ("Well done!")
/ txcolor = green
/ erase = false
</text>

<text fail>
/ items = ("Not quick enough.")
/ txcolor = red
/ erase = false
</text>

************************************

<trial fix>
/ stimulustimes = [0=bg,fixation; 20000 = line, p1]
/ validresponse = (0)
/ timeout = 25000
</trial>

<trial move>
/ stimulustimes = [0=line, p1]
/ validresponse = (" ")
/ ontrialend = [
    if (trial.move.response == 57) {
        values.x += 12.5%;
    };
    if (values.x >= 87.5%) {
        shape.p1.color = green;
    };
]
/ branch = [
    if (values.x >= 87.5%)
    {    
        values.stop_latency = block.sound.elapsedtime;
        notrial;
    } else trial.move;
]
/ recorddata = false
</trial>

<trial success>
/ stimulustimes = [0=line, p1, success]
/ validresponse = (0)
/ trialduration = 2000
</trial>

<trial fail>
/ stimulustimes = [0=line, p1, fail]
/ validresponse = (0)
/ trialduration = 2000
</trial>

<block fix>
/ onblockbegin = [
    shape.p1.color = blue;
    values.x = 12.5%;
    values.stop_latency = "";
]
/ trials = [1=fix]
/ timeout = 25000
/ branch = [
    block.sound
]
/ recorddata = false
</block>

<block sound>
/ bgstim = (bg, line, p1, s)
/ trials = [1=move]
/ timeout = 5000
/ branch = [
    if(values.x >= 87.5%) block.success else block.fail
]
</block>

<block success>
/ trials = [1=success]
</block>

<block fail>
/ onblockbegin = [
    shape.p1.color = red;
]
/ trials = [1=fail]
</block>

<expt>
/ blocks = [1-3 = fix]
</expt>

<data>
/ columns = (date time subject group blocknum blockcode trialnum trialcode values.x values.stop_latency)
/ separatefiles = true
</data>



GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search