How to fully ramdomize positions of targets?


Author
Message
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: 13K, Visits: 104K
Then you need to set up e.g. three <list>s, each representing the items applicable to the N-level.

Suppose you have

<item shapes>
/ 1 = "N1_1.gif"
/ 2 = "N1_2.gif"
/ 3 = "N1_3.gif"

/ 4 = "N2_1.gif"
/ 5 = "N2_2.gif"
/ 6 = "N2_3.gif"

/ 7 = "N3_1.gif"
/ 8 = "N3_2.gif"
/ 9 = "N3_3.gif"
</item>

i.e., three items per N-level (1-3 for N=1; 4-6 for N=2; 7-9 for N=3). Then you need

<list n1notargetlist>
/ items = (1,2,3)
/ not = (values.currenttarget)
/ select = replace
</list>

<list n2notargetlist>
/ items = (4,5,6)
/ not = (values.currenttarget)
/ select = replace
</list>

<list n3notargetlist>
/ items = (7,8,9)
/ not = (values.currenttarget)
/ select = replace
</list>

with

<values>
...
/ notargetitem = 1
...
</values>

<picture nontargetshape>
/ items = shapes
/ select = values.notargetitem
...
</picture>

and

<trial nontarget>
/ ontrialbegin = [if (values.N==1) {values.mytrialduration = 500; values.notargetitem=list.n1notargetlist.nextvalue}]
/ ontrialbegin = [if (values.N==2) values.mytrialduration = 1000; values.notargetitem=list.n2notargetlist.nextvalue}]
/ ontrialbegin = [if (values.N==3) values.mytrialduration = 2000; values.notargetitem=list.n2notargetlist.nextvalue}]
...
/ trialduration = values.mytrialduration
...
</trial>

You need to adapt the target-logic analogously.

Finally, I would *strongly* recommend you first work through the original / unchanged script until you sufficiently understand how it works (pay attention to the comments throughout). That will make it easier for you to adapt it to your needs / modify it.

AmandaChina123
AmandaChina123
Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)
Group: Forum Members
Posts: 9, Visits: 12
Hello, I just got new questions.... 
I'm trying to use different key stimuli under different durations (500ms, 1000ms, 2000ms), do you know how to define N=1,2,3 to stand for different key stimuli? For example, under N=1 and duration=500ms, the key stimuli are some numbers; Under N=2 and duration=1000ms, the key stimuli are simple equations; Under N=3 and duration=2000ms, the key stimuli are complex equations.
Thank you very much!
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: 13K, Visits: 104K
Have a nice evening, too!

AmandaChina123
AmandaChina123
Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)
Group: Forum Members
Posts: 9, Visits: 12
Thank you very much for your kind help! I solved all my problems now.

Thank you! Have a good night!
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: 13K, Visits: 104K
You need to distinguish between two different things:

#1 is the display duration of the target or non-target stimulus. In the original that's hardcoded to 500ms:

<trial nontarget>
/ stimulustimes = [0 = nontargetshape; 500 = eraser]
...
</trial>

nontargetshape is displayed at t0 and is overwritten by <shape eraser> 500ms later.

#2 is the <trial> element's *overall* duration, which is *unrelated* to #1 above and fixed at 3000ms in the original:

<trial nontarget>
...
/trialduration = 3000
</trial>

If you want to vary that depending on the N-level, you need to introduce a new <values> entry

<values>
...
/ mytrialduration = 500
...
</values>

and set values.mytrialduration to the desired value depending on N-level:

<trial nontarget>
/ ontrialbegin = [if (values.N==1) values.mytrialduration = 500]
/ ontrialbegin = [if (values.N==2) values.mytrialduration = 1000]
/ ontrialbegin = [if (values.N==3) values.mytrialduration = 2000]
...
/ trialduration = values.mytrialduration
...
</trial>

AmandaChina123
AmandaChina123
Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)
Group: Forum Members
Posts: 9, Visits: 12
Thank you very much! But the trialduration is always the same. I just want it to be 500ms, 1000ms or 2000ms. However, if I delete the trialduration, it doesn't run at all....

*start trial runs N-times (unless N = 0, then it runs N = 1 time)
<trial start>
/ ontrialbegin = [if (values.N==1) trial.start.insertstimulustime(shape.eraser, 500)]
/ ontrialbegin = [if (values.N==2) trial.start.insertstimulustime(shape.eraser, 1000)]
/ ontrialbegin = [if (values.N==3) trial.start.insertstimulustime(shape.eraser, 2000)]
/ ontrialend = [trial.start.resetstimulusframes()]
/ stimulustimes = [0 = startshape]
/ validresponse = (noresponse, 30)
/ correctresponse = (noresponse)
/ ontrialbegin = [
{if (values.N == 1) values.currenttarget = values.minus1};
{if (values.N == 2) values.currenttarget = values.minus2};
{if (values.N == 3) values.currenttarget = values.minus3};
{if (values.N == 4) values.currenttarget = values.minus4};
values.starttrialcounter += 1;
]
/ ontrialend = [
{if (values.N == 0) values.currenttarget = picture.startshape.currentitemnumber};
values.minus4 = values.minus3;
values.minus3 = values.minus2;
values.minus2 = values.minus1;
values.minus1 = picture.startshape.currentitemnumber
]
/ responsetime = 0
/trialduration = 3000
/branch = [if (values.starttrialcounter < values.N) trial.start]
</trial>


<trial nontarget>
/ ontrialbegin = [if (values.N==1) trial.nontarget.insertstimulustime(shape.eraser, 500)]
/ ontrialbegin = [if (values.N==2) trial.nontarget.insertstimulustime(shape.eraser, 1000)]
/ ontrialbegin = [if (values.N==3) trial.nontarget.insertstimulustime(shape.eraser, 2000)]
/ ontrialend = [trial.nontarget.resetstimulusframes()]
/ stimulustimes = [0 = nontargetshape]
/validresponse = (noresponse, 30)
/ correctresponse = (noresponse)
/ ontrialbegin = [
{if (values.N == 1) values.currenttarget = values.minus1};
{if (values.N == 2) values.currenttarget = values.minus2};
{if (values.N == 3) values.currenttarget = values.minus3};
{if (values.N == 4) values.currenttarget = values.minus4}
]
/ ontrialend = [
values.minus4 = values.minus3;
values.minus3 = values.minus2;
values.minus2 = values.minus1;
values.minus1 = picture.nontargetshape.currentitemnumber;
values.CorrReject = values.CorrReject + trial.nontarget.correct;
values.FalseA = values.FalseA + trial.nontarget.error;
values.TotalFA = values.TotalFA + trial.nontarget.error;
values.DV = (values.TotalHits - values.TotalFA)/values.TotalBlocks;

]
/ responsetime = 0
/ trialduration = 3000
</trial>


**if target, press the letter "A" (code: 30)
<trial target>
/ ontrialbegin = [if (values.N==1) trial.target.insertstimulustime(shape.eraser, 500)]
/ ontrialbegin = [if (values.N==2) trial.target.insertstimulustime(shape.eraser, 1000)]
/ ontrialbegin = [if (values.N==3) trial.target.insertstimulustime(shape.eraser, 2000)]
/ ontrialend = [trial.target.resetstimulusframes()]
/ stimulustimes = [0 = targetshape]
/validresponse = (noresponse, 30)
/ correctresponse = (30)
/ ontrialbegin = [
{if (values.N == 1) values.currenttarget = values.minus1};
{if (values.N == 2) values.currenttarget = values.minus2};
{if (values.N == 3) values.currenttarget = values.minus3};
{if (values.N == 4) values.currenttarget = values.minus4};
]
/ ontrialend = [
values.minus4 = values.minus3;
values.minus3 = values.minus2;
values.minus2 = values.minus1;
values.minus1 = picture.targetshape.currentitemnumber;
values.Hits = values.Hits+ trial.target.correct;
values.Misses = values.Misses + trial.target.error;
values.TotalHits = values.TotalHits + trial.target.correct;
values.DV = (values.TotalHits - values.TotalFA)/values.TotalBlocks;
]
/ responsetime = 0
/ trialduration = 3000


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: 13K, Visits: 104K
No, you don't necessarily need to define additional <trial> elements. You can change

<trial nontarget>
/ stimulustimes = [0 = nontargetshape; 500 = eraser]
...
</trial>

to

<trial nontarget>
/ ontrialbegin = [if (values.N==1) trial.nontarget.insertstimulustime(shape.eraser, 500)]
/ ontrialbegin = [if (values.N==2) trial.nontarget.insertstimulustime(shape.eraser, 1000)]
/ ontrialbegin = [if (values.N==3) trial.nontarget.insertstimulustime(shape.eraser, 2000)]
/ ontrialend = [trial.nontarget.resetstimulusframes()]
/ stimulustimes = [0 = nontargetshape]
...
</trial>

to achieve different display durations depending on the N-level. (Do the same for the target trials.)

AmandaChina123
AmandaChina123
Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)
Group: Forum Members
Posts: 9, Visits: 12
Thank you very much for your prompt reply.
Would you mind helping me with one more question?
Since the practice trials have three levels, I want to change the show time of each level. For example, for N=1, show time is 500ms, for N=2, show time is 1000ms and 2000ms for N=3. I was wondering that I need to define more trials, right?
Thank you very much again!
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: 13K, Visits: 104K
> Sorry for that. I will try to contact someone to delete the whole code.

No worries, you can leave it as it is. The reasons why attaching files is preferable:
- Massive portions of code make a post hard to follow / read.
- Pasting code into the editor may introduce mistakes not present in the actual script or obscure errors present in the actual script. Attaching the actual file ensures that others are seeing exactly what you are seeing.
- It makes the code very hard to examine and work with (you have to select it all, copy it, paste it into Inquisit Lab, etc.).

Edited 9 Years Ago by Dave
AmandaChina123
AmandaChina123
Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)
Group: Forum Members
Posts: 9, Visits: 12
Sorry for that. I will try to contact someone to delete the whole code.

Thank you very much, I finally did it!


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search