Doubt with loops and sequences
Hi all,
I have a question related to the loops. I’m a beginner using OpenSesame so, to make this clear, I firstly explain what I want to see once the experiment is running. I have short stories divided into different sentences. I want each sentence to appear on a separate screen. The experimental subject will read each sentence and press space bar once the sentence has been read. Finally, the stories will be followed by a comprehension question. Importantly, the stories contain different number of sentences (min. 2 sentences and max. 5 sentences), but I will always have the first sentence (context sentence) and the target sentence. However, if the story contains more than two sentences,I will add more context sentence in the middle.
Therefore, I created an excel file with several columns. These columns are called: Context_1; Context_2; Context_3; Context_4; Target. The thing is that the columns Context_1 and Target always contain sentences, but the other columns are filled or not depending on the length of the story. When I was creating the experiment, I had the intention of creating a loop with a sequence containing several sketchpads + keyboard responses corresponding to the different columns (i.e., Context_1, Context_2, etc). The problem is that when I’m running the experiment, a black screen appears for cells that do not contain information and I have to press space bar to continue up to the comprehension question. My question is: Is there a way to say that cells in the excel file which do not contain information should be skipped? Or maybe should I reconsider the way I wanted to build my experiment?
Thank you so much!
Comments
Hi @T_Q,
Based on your description, it sounds as if your did not set the "Run if" property of the appropriate sketchpads and keyboard objects to the content of Context_2, Context_3 and Context_4. As a result, your task runs them all, even if the sentence to be displayed is empty.
There are several ways of achieving what you're after. I'm describing here the easiest.
Here's how to do it, based on an example I just programmed. Let's imagine that this is the structure of task, and some dummy stimuli, just for the illustration:
As you can see, we have Context1 to Context4 and Target as the variables containing the sentences. Notice that some cells are empty. These correspond to sentences that should not be displayed and for which no response should be taken.
The trick is to condition the appearance of certain object to the content of the sentence. I understand that the first sentence and the target sentence are always to be shown, so the corresponding sketchpads and keyboard objects should always be executed. In contrast, the sketchpads and keyboard objects for the other sentences should only be executed if the content of these sentence is not empty.
To condition the presentation of any object in a sequence, use the "Run if" property:
An object will always be executed if its default "always" state is used. Here, I've conditioned the execution of the sketchpads and keyboard objects for sentences 2 to 4 to the content of these respective sentences (as featured in the loop). So for example, we only want C2 and R2 to be presented is the [Context2] is not empty, hence we can write the following condition:
[Context2]!=""
. The operator "!=" means "different from". Just apply the same method to the other objects as required and the task will now only show non-empty sentences and only take keyboard responses for those.Note that the data log will provide you with the responses and RTs for all sentences. They will be contained in the following columns in the data log:
response_R1
response_R2
response_R3
response_R4
response_RTarget
response_time_R1
response_time_R2
response_time_R3
response_time_R4
response_time_RTarget
There would be other ways to achieve the same thing that I'd describe as more elegant or efficient, but this method has the advantage of being easy and simple and it should be suitable to you if you're beginning with Open Sesame.
I attach my example so that you can explore it:
Hope this helps!
Fabrice.
Hi Fabrice!
Thank you so much for your detailled explanation. I tried it and it works! It runs what I exactly need. I am very grateful for your help, you were so kind!
Teresa
@T_Q
Hi Teresa,
You're welcome! Glad I could help and that your experiment is now working! Thank you very much for the coffee!, that was very nice of you! 🙂
Good luck with your research!
Fabrice.