Howdy, Stranger!

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

Supported by

Add a variable to mesure error click


I am benning in Opensesam. I am programming a serial reaction time task with mousetrap. In this task, a stimulus appears on the screen, you have to click on as quickly as possible with mouse. Then, the next stimulus appears. This stimulus can appear in 4 differents places. The order of localisation is not random but follows a sequence repeated several times. So the participant implicitly learns the locations and responds more and more quickly to the localisation of the stimulus.

I managed to make this program but I will want to add a variable. When the subject clicks outside the target, he must correct himself and click on the target for the next stimulus to appear. I would like to keep this rule but record the false click as a false error

If it is not clear, i can send my programm




  • Hi Elodie,

    I am also using OS for SRTs. Did you check for the intertrial intervals?

    If you use the items, the pictures are loaded just before they are presented. Hence, there may be a time lag between your response and the next stimulus.

    If you use inline_scripts you can preload all the items of a block of stimuli (a sequence), so there is no time lag.

    Just in case that you use inline_scripts, you would need a while loop that asks for a response. In case it is a correct response (break) continue with the next stimulus. In case it is not a correct response, give an error feedback, log the response, and keep on asking for a response on that stimulus. That's it :)

    Best regards,


  • Hi Stephan,

    Thanks for your answer. I have no problem with the inter interval. I used the items for my SRTT. But now I need to use inline_scripts to create an "error" variable. This is exactly what you explain:

    in case it is a correct reponse i would continue with the next stimulus. In case it is not a correct response, i want log this "error" response, and keep on asking for a response on that stimulus.

    I tried this (but I don't know python at all and i'm benning in OS ...)

    from openexp.mouse import mouse
    from openexp.canvas import canvas
    my_mouse = mouse(exp, visible=True)
    my_canvas = canvas(exp)
    prescount = 0
    exp.set("mouseclick_count", prescount)
    while True :
    button, position, timestamp = my_mouse.get_click()
    button_clicked == 1
    var.Error== 0
    else :
    var.Error= "mouseclick_count"

    The following message appears: canvas not found.

    And i think my code is false. Have you an idea ?



  • Hi Elodie,

    Maybe you want to use the cursor_roi feature? Like that, you can check whether the response of a participant was on the correct item, and set a variable if it was outside. If you wish you can share your experiment here, then I can see what the simplest way to implement that function would be.

    But maybe this discussion is already a help to you:


    Buy Me A Coffee

  • Hi Edouard,

    This task is a Serial Reaction Time task.

    • Block S is played 4 times, it proposes a sequence of 10 stimuli proposed 10 times per block.
    • Block R5 is played once, it proposes 100 random stimuli.
    • Block 6 is played once, they propose again the same sequence of 10 stimuli proposed 10 times.

    I used the 'mousetrap_response' item and only one button is defined, the correct button is a click on the stimulus.

    But as a consequence the variable "accuracy" is always at 100% (even when participants clicked several times next to the stimulus before correcting themselves and clicking on the stimulus).

    - I would like the variable "accuracy" to take into account when the participant makes a mistake and clicks out of the stimulus.

    - or create a variable to count number of click (and so know number of error).

    This is my experience:



  • Hi Elodie,

    Unfortunately, I have trouble installing the mousetrap plugin myself, so I can't test your experiment. Perhaps @Pascal can help out?

    I am not sure whether these two features you request are implemented in the mousetrap plugin. I would expect that they would, though. If not, you would have set it up without the plugin, and a "regular" mouse response. But as I said in my previous post, the cursour_roi functionality should be all that you need. If you go for this option, I can write you a little script that demonstrates the general principles, so that you can adapt it to your experiment. However, combing regular mouse response with the mousetrap plugin isn't a good idea and won't work.

    btw, sorry for the late response! If you managed to sort things out already by yourself, please let us know.



    Buy Me A Coffee

  • Hi all,

    1) Regarding the installation of the mousetrap plugin for OpenSesame 3.3.0 or later (@eduard):

    When using OpenSesame 3.3.0 or later, you need to install the development version of the mousetrap plugin (as described here: That is, you enter the following code in OpenSesame's debug window for installation:

    !pip install

    2) Regarding the collection of multiple clicks using the mousetrap response plugin:

    In the normal implementation via the graphical user interface, the mousetrap_response plugin continuously records mouse movements but only records the final click (i.e., the click on one of the response buttons). In your case, if you only define one button that is "clickable" and that this is the correct answer, you are completely correct in that this will always result in a 100 % accuracy (when using the built-in accuracy variable of OpenSesame).

    One work-around similar to Elodie's second solution ("create a variable to count number of clicks") could be to switch to the Python based implementation of the mousetrap_response item via the MT_response class (see example experiment here:, which allows you to set the track_clicks argument to True in the _exec function and treat a trial as incorrect if there was more than one click recorded (which can only be the case if the first clicks were outside the response button area). However, this is more complex to implement - in the example experiment, you would replace the lines:

    # Track mouse
    button_clicked, response_time, initiation_time, timestamps, xpos, ypos = mouse_tracking._exec(
       reset_mouse=True, start_coordinates=(0,280))


    # Track mouse
    button_clicked, response_time, initiation_time, timestamps, xpos, ypos, clicks, clicks_timestamps = mouse_tracking._exec(
       reset_mouse=True, start_coordinates=(0,280), track_clicks=True)

    But I completely agree with Eduard in that you can also use OpenSesame's built-in cursor_roi functionality.



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 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