Script for redoing a trial up to 16 times or untill response

288 views
Skip to first unread message

Julia Gomez

unread,
Apr 23, 2008, 8:12:16 PM4/23/08
to e-p...@googlegroups.com
Hi everyone,

Could anyone help with the following script? I am doing a interrupted visual search task. I am presenting a screen with the stimuli array for the search task followed by another screen with a blank screen. Once a trial has started I would like this trial to repeat (i.e stimuli array and white screen over and over) until a maximum of 16 times or  until the participant responds. I created the following script but is giving me an error. I am not familiar writing scripts in eprime.

Dim count as string
 
count=0

While count<17 ' I need to repeat a trial up to 16 times or until response
   If StimuliArray.RESP = " " Then ' I am not sure how to tell eprime if there is no response.
       Goto ShowStimAgain ' this is a label that I inserted after the fixation cross
   End If
count = count +1
End

Any help would be very appreciated.

Thanks

Julia Gómez

James Keidel

unread,
Apr 23, 2008, 9:10:30 PM4/23/08
to e-p...@googlegroups.com
hey

I'm not sure exactly how to fix the whole script, but for sure you
need to declare the counter as an integer, not a string. you can't
increment a string that way. also, eprime likes variable references
to have a type signifier, so you want to say count% = count% + 1 bc %
means integer. in addition, although it is rather inelegant, you
could just have a single TrialProc with 16 alternating stim arrays and
blanks, where each one had a max duration but the stim arrays also
accepted input and had an end action which jumped to your label.

JK

Michiel Spape

unread,
Apr 23, 2008, 9:27:00 PM4/23/08
to e-p...@googlegroups.com
Hi Julia,

How about this? A bit late, so maybe I'm making a couple of errors myself, but I hope it helps.

Dim count as string ' this should be in the user script, else the count is reset

count=0 ' this should be at the start of the trial, else it starts at 0 every time

'after the StimuliArray... I suppose this is a textDisplay or something?:
if (StimuliArray.Resp = "") AND (count < 17) then 'if no response is given and the number of that happened (count) is smaller than 17
count = count + 1 'then continue counting
goto ShowStimAgain 'and go back AFTER counting (otherwise it never counts because it went to the label before that)
end if 'and to end a while statement, I think e-prime expects you to use WEnd;

Cheers,

Michiel Spapé

________________________________


Hi everyone,

Thanks

Julia Gómez


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
**********************************************************************

winmail.dat

Michiel Spape

unread,
Apr 24, 2008, 3:16:12 AM4/24/08
to e-p...@googlegroups.com
Oh yes, there's something I forgot! Though I never use type signifiers, certainly not if the variable is already declared as an integer (instead of, say, a variant).
Cheers,
Mich

So:

Dim count as integer ' this should be in the user script, else the count is reset



count=0 ' this should be at the start of the trial, else it starts at 0 every time


'after the StimuliArray... I suppose this is a textDisplay or something?:

if (StimuliArray.Resp = "") AND (count < 17) then 'if no response is given and the number of that happened (count) is smaller than 17

count = count + 1 'then continue counting

goto ShowStimAgain 'and go back AFTER counting (otherwise it never counts because it went to the label before that)

end if 'and to end a while statement, I think e-prime expects you to use WEnd;


________________________________

Van: e-p...@googlegroups.com namens James Keidel
Verzonden: do 24-4-2008 3:10
Aan: e-p...@googlegroups.com
Onderwerp: Re: Script for redoing a trial up to 16 times or untill response


hey

I'm not sure exactly how to fix the whole script, but for sure you
need to declare the counter as an integer, not a string. you can't
increment a string that way. also, eprime likes variable references
to have a type signifier, so you want to say count% = count% + 1 bc %
means integer.

winmail.dat

David McFarlane

unread,
Apr 24, 2008, 3:00:03 PM4/24/08
to e-p...@googlegroups.com
Julia,

And here's another way to do it, without using a
counter, and making use of functionality built in to E-Prime objects.

First, I assume that your search task, with
stimulus array and blank screen, is in a
Proc. Let's call that PresentationProc.

Now, put PresentationProc in a list object, let's
call that PresentationList. So PresentationList
has just one row with your PresentationProc in
it, and your structure looks something like this:

PresentationList
PresentationProc
StimArray
BlankScreen
TrialFinishScript

Now comes the fun. To make PresentationProc
repeat, say, 16 times, you can do one of two
things in the PresentationList: (1) Give your
PresentationProc row a weight of 16 (most users
will find this the more natural way), or (2) in
the properties page of the PresentationList, go
to the Reset/Exit tab and set it to exit after 16 cycles (my preferred method).

OK, now your trial will last for 16
presentations. How to get it to stop after a
response? You just need one line of script in TrialFinishScript, e.g.,

If Not(StimArray.InputMasks.IsPending()) Then PresentationList.Terminate

That's it. The .Terminate will make the list exit early.

Now, a bit more to the lesson. There are several
ways for script to detect a response. Here are
four tests that return True if a response has occured to Stim:
- If Not(Stim.InputMasks.IsPending()) Then ...
- If Stim.RT <> 0 Then ...
- If Stim.RTTime <> 0 Then ...
- If Stim.RESP <> "" Then ...

Note that .IsPending() returns False if either it
has received a response or the response time
limit has passed, so it only works while waiting
for a response (i.e., it will not work afterwards
to tell whether or not a response was received
earlier). Other than that, which test you use is largely a matter of taste.

For more information on these, please see the
List Object and InputMask Object topics in the E-Basic online help.

-- David McFarlane, Professional Faultfinder

Julia Gomez

unread,
Apr 27, 2008, 3:53:38 PM4/27/08
to e-p...@googlegroups.com
Dear all,

Thank you very much for you help! I have the eprime programe almost done! (thanks to your advices!).

I came across with a couple of more problems:

(1) Measuring RT from the first display.

As I as previously explained, I present a visual array of stimuli followed by a blank screen upto 16 times or until response (stimArray+Blank, stimArray+Blank, and so on). The RT measure I get is just from the last stimArray+Blank ( the one you respond to, instead of being from the first one). I would like to have a measure of the RT from the first display until response (whether is one or 16 displays). Is there a way to do this?

(2) Set one stimuli from the distractor list to be target for just that session.

I have a set of targets in a list and the distractors in a separate nested lists. For the baseline condition, I would be ideal if I could call randomly one of the distractors and set it to be one of the targets (for only that session and in the following session it will become again a distractor, and, of course, in that session is never seen as a distractor).


Any help is very appreciated.

Thanks in advance

Julia


2008/4/24 David McFarlane <mcfa...@msu.edu>:

David McFarlane

unread,
Apr 28, 2008, 2:51:52 PM4/28/08
to e-p...@googlegroups.com
Julia,

>(1) Measuring RT from the first display.
>
>As I as previously explained, I present a visual array of stimuli
>followed by a blank screen upto 16 times or until response
>(stimArray+Blank, stimArray+Blank, and so on). The RT measure I get
>is just from the last stimArray+Blank ( the one you respond to,
>instead of being from the first one). I would like to have a measure
>of the RT from the first display until response (whether is one or
>16 displays). Is there a way to do this?

There are several ways to do this. Here is one, for example. You
will have to add some script to the start and end of your
PresentationList, so the structure might now look like this:

RTStartScript


PresentationList
PresentationProc
StimArray
BlankScreen
TrialFinishScript

RTFinishScript

RTStartScript contains script like this:
Dim TrialT0 as Long
TrialT0 = Clock.Read

RTFinishScript contains script like this:
StimArray.RT = StimArray.RTTime - TrialT0

This assumes that you want to allow a response only during the
presentation of each StimArray. If you want to allow a response any
time during the PresentationList loop, there are other techniques,
which I could explain if asked.

Once again, for more information you can look at the Clock Object and
InputMask Object topics in the online E-Basic help.


I do not have an answer for your second request, I will leave that to
others more talented than me.

David McFarlane

unread,
Jan 5, 2010, 11:00:55 AM1/5/10
to e-p...@googlegroups.com, Ariana Rubin
Ariana/Mbecs,

Your message found me just as I got hit with the
double-whammy of the holidays and a major
project, and by now you have either found your
own solution or moved on to something else, but I
will attempt a reply now anyway.

You bring up three issues:

(1) how to have every response logged when
responses are allowed at any time during the PresentationList loop

(2) allowing a response at any time during the PresentationList loop

(3) what TrialT0 refers to

As to (1), the original problem as posed by Julia
Gómez (see
http://groups.google.com/group/e-prime/browse_thread/thread/5e712b8b726ea0de
) took only one response during the
PresentationList loop, and then exited the
loop. So you are asking for something rather
different here, and I would need more details before I could answer.

As to (3), TrialT0 is just a variable that holds
the start time of the trial (i.e., the
PresentationList loop). I suppose most folks
would name it something more like TrialStartTime,
but I have a background in physics and math so
something like t0 (that's "t-zero") seems a more
natural symbol for an intiial time.

Finally, issue (2) seems to strike more at what I
promised to explain if asked, so I will belabor
this a bit and propose two approaches.

First, one could simply use Extended Input (see
Appendix C of the User's Guide that came with
E-Prime) with StimArray in the example. I.e.,
set the Time Limit of StimArray to (infinite),
and then the subject can enter a response at any
time during the loop. Everything else would work without change.

Second, one could instead use Extended Input with
a Wait object before PresentationList. Now the structure would look like

TrialRespWait


PresentationList
PresentationProc
StimArray
BlankScreen
TrialFinishScript

TrialRespWait is a Wait object with Duration = 0
and an Input Mask with Time Limit =
(infinite). One would then remove the Input Mask
from StimArray. Finally, TrialFinishScript would
be modified to refer to TrialRespWait, thus,

If TrialRespWait.RT Then PresentationList.Terminate

or one of the other forms for detecting a
response in script (also see
http://groups.google.com/group/e-prime/browse_thread/thread/f565dc7d0d507a3
for how to terminate any running List without
knowing the List name, which coincidentally I also answered for you :) ).

Now the subject can respond at any time during
the PresentationList loop, the response will go
to the TrialRespWait object, and if TrialRespWait
has End Action set to Terminate then the response
will terminate either StimArray or
BlankScreen. Note that we no longer need
RTStartScript and RTFinishScript, since
TrialRespWait.RT automatically has the desired
RT. (In general, Wait objects are not so much
useful for "waiting" as they are for introducing silent/invisible Input Masks.)

Note that for both of these approaches, if a
response comes in during StimArray then the loop
will still complete the BlankScreen. If one
wanted to skip the BlankScreen then one might use
an End Action of Jump in the first approach, or
would have to add a bit more script for the second approach.

Regards,


-- David McFarlane, Professional Faultfinder


At 11/20/2009 11:19 AM Friday, Ariana Rubin and Mbecs wrote:
>Hi David,
>
>I would love to know how to have every response logged when responses
>are allowed at any time during the PresentationList loop. I have been
>working on a project similar to this one, and this is my last holdup.
>I am very new to EPrime and scripting, and was also wondering in this
>example what TrialT0 refers to.
>
>Thank you so much in advance!
>-AR
>-Mbecs

Reply all
Reply to author
Forward
0 new messages