Howdy, Stranger!

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

Supported by

using cursor_roi

Hi all and merry Christmas,

Does anyone have a simple script showing how to use cursor_roi? What I want is quite simple. I have a sketchpad (empty_array in the screenshot) with two squares on it. Then I add an inline to collect a mouse response. I could play with the x,y coordinates of the mouse response to figure out which square was clicked on but I think that the cursor_roi does this automatically, no? But, how do I do it? Plus, I don't see how the variable can return names of objects on the sketchpad when the objects are not named (both my squares are inserted as the same jpg). Any ideas?


Comments

  • Hi,

    I am not an expert on the mousetrap plugin, but I think if you don't have named objects on a sketchpad, you can't use the cursor_roi. @Pascal can you give us some insight here?


    Eduard

    Buy Me A Coffee

  • Hi Eduard and thanks for the response. I didn't realize that coursor_roi uses the mousetrap plugin. I'm not using that plugin at all, just some simple code to use the mouse. Also, how can you name anything on a sketchpad?? If I draw a square on a sketchpad, does it have a name? I only see a line of code that draws a square!

  • edited January 2020

    Hi,

    you can name elements on the sketchpad by selecting the corresponding element and then entering a value in the name field that is displayed in the row above the sketchpad preview (the default value is auto, i.e., unspecified I think).

    Once you've done that, the name argument will be displayed in the OpenSesame script of the element, e.g.:

    draw rect color=white fill=0 h=160 name=myrectangle1 penwidth=1 show_if=always w=320 x=-448 y=-256 z_index=0

    If you want to do mouse-tracking via the mousetrap plugin, I would recommend that you draw the elements separately using two rect elements, name them (as described above) and then use a mousetrap_response item to implement the mouse-tracking and react to the clicks on the rectangles.

    The mousetrap-os item is documented here: https://github.com/PascalKieslich/mousetrap-os

    A preprint of a book chapter that includes a tutorial can be found here: https://psyarxiv.com/zuvqa/

    However, the cursor_roi procedure should also work once you've named the elements.

    Best,

    Pascal

  • Dear Pascal,

    Thank you very much for this! It makes sense now. I'll try out the mousetrap plugin as well and read the preprint.

    Cheers,

    marios

  • Hi Pascal,

    First off, I should say that the chapter is fantastic. Thanks for sharing. Now, I have installed mousetrap and tried to use the mousetrap_response item after a sketchpad but I get an unexpected error when I run the experiment (AttributeError: 'Xpyriment' object has no attribute 'w'). I tried different backends but I get the same thing. I attach a screeenshot with the debug window.

    Also, is there a way to have more than 4 buttons as options? For this experiment I'm not so much interested in tracking. I just want to know which box was clicked (out of hopefully 9-10 boxes).


  • Hi Marios,

    I think the problem is that the mousetrap plugin only supports rect elements. If you inserted the buttons as pictures, you would have to draw an additional rect element around them and label this element to get the click in the respective area of interest (AOI). More than four buttons are possible if you use the Python implementation of the plugin (see mousetrap_response_python.osexp example at https://github.com/PascalKieslich/mousetrap-os/tree/master/examples#example-experiments). But if you are not interested in the mouse movements and want to use the pictures, then you could also probably try using the cursor_roi implementation of OpenSesame - I think this implementation should also support pictures as AOIs.

    Best

    Pascal

  • Pascal, me again. I have redrawn the buttons and it now works. Don't know what was wrong before but now it's fine. The only thing now is whether there is a workaround in terms of the numbers of buttons I can have. Any ideas?

    Thanks,

    marios

  • Thanks for your response Pascal. We must have been writing at the same time and saw it after I posted mine. I will try the Python implementation as I know I will be using the Mousetrap plugin for other experiments that will require mouse tracking. About the cursor_roi implementation....I have no idea how to use it. That was in fact my initial post. I just can't find any example of that anywhere. You can see my inline script attached on my first post which shows how I use the mouse. But, no idea how to use cursor_roi and it seems to me that there's a straightforward way!

    m

  • Hi Marios,

    Te cursor_roi functionality is unrelated to Mousetrap (although Mousetrap uses it). Here's a simple video tutorial that should show you the basics of how it works!

    Cheers,

    Sebastiaan

  • Thanks Sebastiaan. That was even more simple than I thought!

    m

  • Hi,

    I can use cursor roi when I set my variables in logger. However when I run the experiment in online I can not see cursor roi names in Jatos results. it says cursor_roi is ''null'. Can you help me?

    Thank you very much

  • edited November 2020

    Hi @cicek ,

    This functionality is simply not supported in OSWeb at the moment:

    As an alternative, depending on what exactly you want to do, you can either simply look at the mouse coordinates (cursor_x and cursor_y ) or write an inline_javascript item that determines which element the participant clicked on based on a) where the participant clicked, and b) where the stimuli were shown on the sketchpad .

    Not as convenient, but definitely possible!

    — Sebastiaan

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