Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

[open] Looping a visual discrimination task while waiting for a key press to terminate trial?

edited November 2013 in OpenSesame

Hi all, I hope this isn't something I could have easily figured out by a good Google search, I just haven't been able to find the correct search terms to get what I'm going for here.

I'm trying to implement a design that's a bit beyond my understanding (most of my experience with OpenSesame has been mostly pretty straight-forward linear presentation stuff). To boil it down to a single trial, I'd like to present a simple visual discrimination task alongside a set of verbal instructions. So for example, at the onset of a trial, a text display would appear providing instructions for a primary task to be performed outside of OpenSesame (these tasks are performed on a motorcycle infotainment system). A short time after the onset of those instructions, the visual discrimination task would begin. So, leaving the instructions on the display, a letter would appear. If this is a key letter, the participant would respond with a key press (well, a foot pedal mapped to a key press "b", but a key press to OpenSesame). If it's not a key letter, then the participant does nothing and the letter disappears.

The part I'm not sure how to accomplish is that after they respond with a key press, I need the discrimination task to repeat itself on average every 5 seconds (so 5 ± 2s, for example) while the text display with the instructions remains the same. After the participant completes the primary task on the motorcycle, a researcher would then press a key to end the trial and move on to the next set of instructions.

So it would look something like this:

image

Does this make sense? Please let me know if I need to provide more information. I'll keep trying different things in the meantime. I hope this doesn't come across as asking to build the whole experiment, I'd just like to know if it's possible to get the two tasks to operate in conjunction like this while recording responses for both (primarily the reaction time for the discrimination task and the total time for the primary task).

Thanks in advance for your time.

Edit: Sorry, I didn't expect the formatting to do that on the example. I'm trying to fix it.

Comments

  • Hi,

    Sorry for the delay! In order to simultaneously wait for participants' keyboard responses on the primary task, as well as for a response from the experimenter to break out of the block loop, you could do something like the following:

    Firstly, build your experiment like normally, but add a 'break-if' statement in the block loop. In the example below, OpenSesame will break out of the block loop when someone (in your case the experimenter) presses 'q'.

    image

    Secondly, add an inline_script item and a logger item (the same one as you use within the trial sequence!!) to the end of your block sequence (see screenshot above). The purpose of these items is to log the total time of the primary task. To achieve this, put something like the following Python code in the Run phase tab of the inline_script:

    primary_task_rt = self.time() - self.get('time_sketchpad_onset')
    exp.set('primary_task_rt', primary_task_rt)
    

    where the sketchpad_onset item is just a dummy item to start the timing for the primary task duration (see screenshot above).

    Finally, to avoid that last trial of a given trial block loop from occurring twice in your output file (since it is logged once in the trial_sequence, and once after the experimenter made the experiment break out of the loop), set the Run-if statement of the logger item in the trial sequence to:

    [response] != q
    

    such that it only logs the keypress (i.e. foot-pedal press) if the keypress is not 'q' (in which case the trial will be logged by the logger in the block sequence).

    image

    I uploaded an example experiment here (download, change the extension to .opensesame, and open as normally):

    I hope this helped!

    Cheers,

    Lotje

    Did you like my answer? Feel free to Buy Me A Coffee :)

  • edited December 2013

    Thanks for the response, very helpful, especially the example. I'm having an issue though. In my program, I keep getting the error:

    "Variable "response" is not set in item (loop's name). You are trying to use a variable that does not exist. Make sure that you have spelled and capitalized the variable name correctly."

    I assume this is referring to the "break if" statement. I used the variable inspector, and "response" is listed as an available variable. I was also running into a similar issue earlier when I defined an ISI variable (using one of your answers to someone else's question here: http://forum.cogsci.nl/index.php?p=/discussion/240/solved-variable-interstimulus-interval-isi/p1), it would say that my ISI variable didn't exist as well (despite showing up in the inspector). I'm using the latest version of OpenSesame on Windows, is there something that I'm missing causing these issues? Your program seems to work just fine, for what it's worth.

  • Hi,

    In my program, I keep getting the error: "Variable "response" is not set in item (loop's name). You are trying to use a variable that does not exist. Make sure that you have spelled and capitalized the variable name correctly."

    I see what you mean! As you may have guessed, this error message means that you're trying to use the variable 'response' before it has been set (i.e., exists and has a starting value).
    In the example I uploaded, this was not the case because a first keyboard response was already collected with the 'instruction' sketchpad (see overview above). As a consequence, the variable 'response' already existed when we were using it in the block loop.

    In your program, this is probably not the case (i.e. you don't collect any responses before the block loop item). Therefore, I think you could simply set the variable 'response', and give it a dummy value, in an inline_script at the very start of your experiment. (This value will never appear in your output file, because it will immediately be overwritten by your first trial.)

    image

    New example:

    I was also running into a similar issue earlier when I defined an ISI variable.

    Could it be that in this case you defined the variable ISI in the Run phase tab rather than the Prepare phase tab, of your inline_script item?

    To familiarise yourself with OpenSesame's prepare-run strategy, perhaps you could read the following:

    Please let us know if you have more questions!

    Cheers,

    Lotje

    Did you like my answer? Feel free to Buy Me A Coffee :)

  • edited 5:27PM

    I think I've got it working. Looks like I'm getting accuracy data, monitoring task RT data, and primary task times (took me awhile to see that you had another sketchpad in there to serve as the onset, and once I got that it fixed my last problem), and the "break if" statement works now as well. I just did a mini-version of the experiment, and everything I want seems to be coming out in the report.

    Thanks a ton for the help. Now all I have to do is make all the conditions/variables for the full experiment.

    As a comment, I'd like to applaud both the developers for OpenSesame and the members of this help forum. Each time I've made an experiment with this program, it's been because I got frustrated with my previous experimental design software. And each time I've asked for help here, I've gotten quick replies that helped me work through to fix the problem. Further, using OpenSesame feels more like a puzzle to be figured out than a chore to be overcome, and I think that should be applauded as well.

  • edited December 2013

    Thank you very much. That's really nice to hear! :)
    Good luck with your experiments!!

    Did you like my answer? Feel free to Buy Me A Coffee :)

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu http://45.77.173.118/ Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games