jump or if then?

2,935 views
Skip to first unread message

jotapan

unread,
Apr 19, 2011, 8:33:55 PM4/19/11
to E-Prime
Hi to all,
I have what I believe o be a simple task to program, but I just not
being able to do it since I'm a beginner in e-prime.

I have two tasks:
1) task 1: responses A and B
2) and task 2: responses 1, 2, and 3

I want task 2 to be presented to the participant only if he responds A
in task 1; if he responds B he should just gets the next trial of task
1.
I tried looking into the "jump" of the stimulus property, but from
what I understood it works independently of what response is given to
that stimulus.
Another idea I had was just to create a script with an if then rule,
which I don't know how to do :( the idea would be something like (with
proper coding)

If response to task 1 = A,
then task B,
else Task A
end if

Any help would be very appreciated! thanks
Jotapan

Michiel Spape

unread,
Apr 20, 2011, 4:23:36 AM4/20/11
to e-p...@googlegroups.com
Hiya,
If it's as simple as you think it is, you should be able to do it after having read the "getting started guide". In this case, you would be right - and if the getting started guide may not do it for you, I'd suggest working through our little bit of freely available course material (www.cognitology.eu, about me, underneath everything else), because, ultimately, you cannot use E-Prime 'instantly' (at least, very few students seem to, even though there are some talented 'coders-to-be'). So, despite me answering this question, try to give it a go anyway.

1. Stimulus1 is a textdisplay saying "Do you want to do task 2? A = yes, B = no", allowable response ab. That's just about what you want, no?
2. After that is an inline saying
IF Stimulus1.RESP = "b" THEN goto Dontwanttodotask2
3. Stimulus2 is a textdisplay saying "Select response 1, 2 or 3" (or whatever you'd like).
4. Then insert a label, call it Dontwanttodotask2

That's basically it. Note that I use no else, since Stimulus2 will follow anyway, unless b is selected. After 4 is the end of the trial, so it should continue with your task1.
Best,
Mich

Michiel Spapé
Research Fellow
Perception & Action group
University of Nottingham
School of Psychology
www.cognitology.eu

--
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-p...@googlegroups.com.
To unsubscribe from this group, send email to e-prime+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/e-prime?hl=en.

This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.

This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.

jotapan

unread,
Apr 20, 2011, 6:33:17 AM4/20/11
to E-Prime
Hi Michiel,

Thank you so much for your reply and for the link to your e-prime
guide. It will be very helpful!

I have been able to jump task 2 when participants responds B in task 1
using your suggestion, but I now have a problem in the response and RT
data logging. I was expecting the program not to save any information
for the task2 trials when they are not presented to the participant
(i.e., when it just jumps to task 1 again not presenting task2).
However, the program is simply repeating whatever response is given
the first time task 2 is presented on the following trials when task 2
is not presented; these data only change the next time task 2 is
presented again and another response is given to the task.

Jotapan

On Apr 20, 9:23 am, Michiel Spape <Michiel.Sp...@nottingham.ac.uk>
wrote:
> For more options, visit this group athttp://groups.google.com/group/e-prime?hl=en.

Michiel Spape

unread,
Apr 20, 2011, 6:55:10 AM4/20/11
to e-p...@googlegroups.com
Hi Jotapan,
It shouldn't, as far as I can see. Do you have the most typical E-Prime structure here, or are you, in fact, jumping to and fro, indeed adding even another goto to my suggestion? That is to say, for E-Prime, it makes sense to stop thinking about "go to task 1, then goto task 2, followed by task 1" but instead see it as:
In the beginning, there is a trial.
In one trial, we present either one or two stimuli (or tasks, if you will).
This means that there is no "going back to task 1" but rather, at the end of the trial, the procedure is repeated. In which case, Stimulus1.RESP as well as Stimulus2.RESP should be cleared.

If this shot in the dark totally misses, however, you can just ignore me and use some work-around. I like to store my dependent variables as "Y_" followed by the type - so they all are stored at the end of your .edat file. This also gives you a little bit of flexibility in storing your data as you would like to analyse it. I'd say pick the correct lines and store your favourite responses at your favourite moment by doing something like
c.SetAttrib "Y_RESP2", Stimulus2.RESP
or, which shouldn't be necessary, at the very end:
IF Stimulus1.RESP = "a" then c.SetAttrib "Y_RESP2", Stimulus2.RESP else c.SetAttrib "Y_RESP2", ""

Best,
Mich

Hi Michiel,

Jotapan

For more options, visit this group at http://groups.google.com/group/e-prime?hl=en.

jotapan

unread,
Apr 20, 2011, 7:24:55 AM4/20/11
to E-Prime
Hi Michiel,
Thank you so much for this new input. I think I have the right
structure in my procedure. Here is what I have in my procedure:
> Slide 1 : allowed responses a & b
> InLIne: If slide1.RESP="b" THEN goto donttask2
> Slide 2: allowed responses 1, 2, & 3
> Label: donttask2

Indeed at the end of this sequence it moves on to the next trial on
the list. Am I missing something?

I'll try you suggestion as well,
Best,
Jotapan

On Apr 20, 11:55 am, Michiel Spape <Michiel.Sp...@nottingham.ac.uk>
wrote:
> Hi Jotapan,
> It shouldn't, as far as I can see. Do you have the most typical E-Prime structure here, or are you, in fact, jumping to and fro, indeed adding even another goto to my suggestion? That is to say, for E-Prime, it makes sense to stop thinking about "go to task 1, then goto task 2, followed by task 1" but instead see it as:
> In the beginning, there is a trial.
> In one trial, we present either one or two stimuli (or tasks, if you will).
> This means that there is no "going back to task 1" but rather, at the end of the trial, the procedure is repeated. In which case, Stimulus1.RESP as well as Stimulus2.RESP should be cleared.
>
> If this shot in the dark totally misses, however, you can just ignore me and use some work-around. I like to store my dependent variables as "Y_" followed by the type - so they all are stored at the end of your .edat file. This also gives you a little bit of flexibility in storing your data as you would like to analyse it. I'd say pick the correct lines and store your favourite responses at your favourite moment by doing something like
> c.SetAttrib "Y_RESP2", Stimulus2.RESP
> or, which shouldn't be necessary, at the very end:
> IF Stimulus1.RESP = "a" then c.SetAttrib "Y_RESP2", Stimulus2.RESP else c.SetAttrib "Y_RESP2", ""
>
> Best,
> Mich
>
> Michiel Spapé
> Research Fellow
> Perception & Action group
> University of Nottingham

jotapan

unread,
Apr 20, 2011, 7:19:55 AM4/20/11
to E-Prime
Hi Michiel,
Thanks for your new suggestion.
I think I'm using the right structure, but I might be missing
something :(

Here's what I'm doing in this procedure:
> Slide 1 : allowed responses A & B
> InLIne 1: If slide1.RESP="b" THEN goto donttask2
> Slide 2: allowed responses 1 & 2 & 3
> Label: donttask2

I'll be trying your suggestion,
Best,
Jotapan

On Apr 20, 11:55 am, Michiel Spape <Michiel.Sp...@nottingham.ac.uk>
wrote:
> Hi Jotapan,
> It shouldn't, as far as I can see. Do you have the most typical E-Prime structure here, or are you, in fact, jumping to and fro, indeed adding even another goto to my suggestion? That is to say, for E-Prime, it makes sense to stop thinking about "go to task 1, then goto task 2, followed by task 1" but instead see it as:
> In the beginning, there is a trial.
> In one trial, we present either one or two stimuli (or tasks, if you will).
> This means that there is no "going back to task 1" but rather, at the end of the trial, the procedure is repeated. In which case, Stimulus1.RESP as well as Stimulus2.RESP should be cleared.
>
> If this shot in the dark totally misses, however, you can just ignore me and use some work-around. I like to store my dependent variables as "Y_" followed by the type - so they all are stored at the end of your .edat file. This also gives you a little bit of flexibility in storing your data as you would like to analyse it. I'd say pick the correct lines and store your favourite responses at your favourite moment by doing something like
> c.SetAttrib "Y_RESP2", Stimulus2.RESP
> or, which shouldn't be necessary, at the very end:
> IF Stimulus1.RESP = "a" then c.SetAttrib "Y_RESP2", Stimulus2.RESP else c.SetAttrib "Y_RESP2", ""
>
> Best,
> Mich
>
> Michiel Spapé
> Research Fellow
> Perception & Action group
> University of Nottingham

David McFarlane

unread,
Apr 21, 2011, 1:51:38 PM4/21/11
to e-p...@googlegroups.com
I would have you go with Mich's approach
here. But as an academic exercise, here is how
to accomplish the same thing using Jump and no inline.

Trial proc structured same as before, but no inline:
- Slide 1 : allowed responses A & B
- Slide 2: allowed responses 1 & 2 & 3
- Label: donttask2

On Slide 1, set Jump Label to donttask2. Then
add *two* keyboard input masks. For one of them,
set Allowable to A, and End Action to Jump; for
the other, set Allowable to B and End Action to
(terminate). That should do it.

Using multiple input masks and Jump is an art
suitable to only a few, most will find If-Then in an inline more manageable.

-- David McFarlane, Professional

João Ferreira

unread,
Jun 7, 2016, 7:17:57 AM6/7/16
to E-Prime

João Ferreira

unread,
Jun 7, 2016, 7:18:11 AM6/7/16
to E-Prime, mcfa...@msu.edu
Hello!

In an example like this, how do you make the program jump if the participant doesn't reply in the given time?

So, let's say you have slide A followed by slide B. But slide B only appears if a specific response is given on slide A (for example "B"). If another response is given on slide A (let's say "A"), then the program jumps (using a Label) to the next part of the procedure. What if i want the program to go to do that same jump (so, we're skipping slide B) if participants don't respond in the given time to slide A?

Thanks in advance

David McFarlane

unread,
Jul 19, 2016, 2:26:16 PM7/19/16
to e-p...@googlegroups.com
Please see https://groups.google.com/d/topic/e-prime/mWqfMZRFaHM .

-- David McFarlane
Reply all
Reply to author
Forward
0 new messages