[solved] Using a response form with the "question" being randomly generated image

I'm doing a memory study with a rating task for the first sequence of stimuli. Basically I need the stimuli to appear randomly, with a rating option of 1, 2, and 3, with the selection of the number moving the participant on to the next stimuli. I'm brand new to Open Sesame, and so far I've figured out how to produce the random stimuli, and how to create a form, but separately. Is there a way to combine these two? There's no correct response, but I do need to record their answers. There will be no need for instructions or questions for each rating response, because the rules will apply to all stimuli and will be given at the beginning. A shove toward a tutorial would be much appreciated.

Comments

When you say you want your stimuli to appear randomly, you mean you have a pool of stimuli and draw them in a random order, right? If this is the case, you can use the loop item and put some identifier (e.g. the name, some id, or whatever) of your stimuli into the loop table. By default OpenSesame runs the lines in a loop table in random order, so there you get your randomization. Subsequently, you just have to add your form to the loop, maybe embedded in a sequence and choose a generic stimulus name as item to be run. This stimulus name should be identical to the variable name that you specified in the loop table. If everything works out nicely, the current value of the stimulus identifier in the loop table will be updated on every iteration, passed to the form, and a unique stimulus will be drawn.

I don't think there is a way to customize the color of the buttons in the form items. Also, every button you create has an variable that you can create or change in the last statement of the widget:widget 0 0 1 1 button text='Click me!' center='yes' frame='yes' var='response'

Make sure to change the variable for each unique button, otherwise you won't know which button has been pressed.

Alternatively, since you work on a tablet, you could swith the form item for a sketchpad item followed by a touch response item with three columns. This allows you to draw your own 'buttons' in the color you want, one in each of the columns. And it only gives you only one variable (with the value of the column that has been touched) instead of three different variables.

That is definitely something I'm going to try, because the fewer the variables, the better.

I'm trying to get it to run on my tablet now to test it. It automatically wants to find the file on an SD card, which I don't have. I've changed the file location several times and it's still not finding it. Any ideas?

If it asks for the sdcard it probably means that your tablet's default storage directory is called /sdcard. It took me some tries the first time too but i created a new folder in which i put all my experiment /sdcard/Experiments/ and set this as the folder to look for experiments.

You could also use ES File Explorer as an alternative explorer to make sure your .osexp ended up in the right folder. Oh and SD Scanner might also come in handy to force Android to look for new and updated files, such as your experiment.

Turns out I had to be super specific, but I was able to find it. It's nearing completion! The last thing I'm worried about is having a series of math equations for participants to run through, but having it end after a set time instead of completion of the sequence. Haven't looked into it yet though, so maybe it's easy. Onward!

What you want, is to present those equations in a while-loop (inline_script). The idea is that you can keep track of time, by creating a variable using the self.time() function, e.g.: start_time = self.time(). Every iteration through the while loop you can check time by means of current_time = self.time() - start_time. When current_time > time_limit, you break from the while loop.

I'm wondering if I can start this one up again. Josh, that info makes sense in theory to me, but I'm not sure how to implement it, where to put it in the inline script, etc. I'm just too new with this kind of coding. My experiment was just approved though, and I only have a limited time in this area for data collection, so I don't have time to figure it all out myself Is there a specific way to start a while loop? Or is it something you do within the run if function or?

Separately, how necessary are reset feedbacks and how often do we need them? And also do I just need one logger for the whole experiment as long as I've defined all my variables properly?

Now you have a variable that you can use in the loop that presents the equations. Check the advanced options box and insert in the break if line: [break] = True

As for the logging, you'll just need one logger for the whole experiment, just make sure you have a logger item in every sequence you use. The reset feedback items are usefull to prevent collecting unwanted reaction times during, for example, breaks or instructions that could distort your average data. So it's best to use them just in case.

Is there a way I could upload my experiment on here to have someone give it a once over....I feel that the interface is completely functional, but I'm entirely unsure if I've created all the proper variables and if it will record them appropriately.

The responses I need are:
study responses (with the response being either 1,2,3, through a button press)
distractor responses (typed # response)
test responses (responses are new and old, through button response)
demographic responses (combo of multiple choice and text input)

Somehow I'm still completely useless at implementing the while loop I think I'm just too novice with inline script.
I've tried creating a variable for "break", but it keeps automatically changing back to "never".

Related to this: the text input form is set to return_accept: yes, which is all good and fine on the computer, but I'm going to be collecting data on an android...so how does that translate? Just with the enter button on the virtual keyboard?

Not 100% necessary, but preferred, would be to have one form display next in a sequence only if the answer on the previous form was "yes". The question is "Do you have any experience with other languages" with multiple choice answer of "yes" or "no". The next question asks which languages and how much experience, as a text input form. Obviously, it would make the most sense if this was displayed only if participants responded with "yes" to the former question. I think I understand that I need to change the "run if" statement in the sequence window to something involving "response=yes", but I'm not sure exactly what wording to use or if there are prior steps needed (this kind of goes back with my not being sure about variables) . This is in the demographic sequence.

Maybe some of this won't make sense until I have the file available. I'm working on that now!

I went over your experiment a couple of times and what i've noticed is that your experiment doesn't actually store anything:

What you should do to store all variables, and maybe i wasn't clear enough in my previous post, sorry for that, is insert one copy of the same logger item within a sequence. So for example in your first loopstudy_buffer_loop you'd want to insert a sequence that contains your form and a copy of your logger. You can do this for every loop you created that presents stimuli.

Furthermore, the current response for the familiarity of the symbol is impossible to trace because the three options are all linked to the same variable (e.g. var=buffer1_response), therefore the answer will always be 'yes' but you can never retrace which of the buttons has been pressed. What you can do is replace them with unique variables (e.g. var=buffer_response_1). Alternatively, you can swap the form for a touch_response item that presents the symbols. Set the amount of columns to three and the item will store which column (or button) has been pressed, instead of checking three different variables.

As for the while loop, you can swap the form that presents the equation with an inline_script that creates the form in the prepare phase and executes it in the run phase. Prior to the dist_test_loop there should be another inline_script with

var.break_seq = 'no'
total_time = 0

And then an inline_script instead of the dist_test_form with in the prepare phase:

# Import the widgets library
from libopensesame import widgets
# Create form, there are three rows now instead of two
# When you use the keyboard for text input it overlaps with the input box
form = widgets.form(self.experiment, cols=[1], rows=[2,2,2],
margins=(50,50,50,50), spacing=10)
# Here it should pull the correct image from the file pool
image = widgets.image(form, path=pool["6.png"])
text_input = widgets.text_input(form, var='equation_response',return_accepts=True)
form.set_widget(image,(0,0))
form.set_widget(text_input,(0,1))

The loop is somewhat different than the original idea, and it needs some work as well to check if the timing is correct. Furthermore, i wasn't able to pull the correct .png file from the pool to present on the form. Now it is substituted with a static equation ('6.png') to test the form execution. Maybe @sebastiaan knows the correct syntax to retrieve the equation image variable?

Thank youuuuu!! I've fixed the loggers and the variables for the rating task. I'm working on the loop. I've added an inline script item and copied what you have into it, but am getting a lot of red. Is it because it's in the python format, and it's expecting the inline script format, do you think?

lol nope. So I think I modified the prepare page to be ok, but I'm getting a lot of red dots and what not in the run page. The experiment also crashes at this point in a test run, yet cheerfully tells me that the experiment successfully finished lol

Sorry for the confusion, i forgot to paste a few lines in my previous comment. I've edited now with the correct content

The while loop still needs work though, i just don't know the correct syntax. Maybe you can leave it unchanged (stick with the old forms and no timer) until someone knows the answer. Meanwhile, perhaps you can do a few test runs to see if all your variables are stored as they should?

As for the form creation, an inline_script only accepts Python script while the original form was created in the OpenSesame script. The part that goes into the prepare phase is a form created in Python. Check this page for more info about the difference.

Ok, so the image display works! It's bringing up random equations, which is perfect. However, the timing mechanism isn't working properly. What I've found is that it will only run through all of the 'equation' images twice (so a total of 118 equations) within 5 minutes (so I was just hitting enter repeatedly) and stopped then instead of at the 5 minute mark. If I let it run for 5 minutes without entering anything, then entered one (at this point it should stop), it would run through 59 images (1 each of the equations). Does that make sense?

Ok, so the dist_loop was set to 2 cycles. I've changed it to 1, which makes the distractor task end after 59 equations, regardless of the time. The dist_test_loop has 59 cycles, because that's how many options there are in the variable. Both dist_loop and dist_test_loop are set for 1 "repeat each cycle 1 time". So it still isn't relying on the time for when to end.

And did you insert the break_seq variable into the Break If line under advanced options?

As for the multiple choice forms, for some reason OpenSesame doesn't recognize them as standard forms (like your text input forms) and therefore doesn't automatically log the variables. If you manually add the custom variables in the logger item they should be logged correctly.