Howdy, Stranger!

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

Supported by

[solved] mouse response images and shapes

edited January 2013 in OpenSesame

Hello,

I am new to Opensesame and have a few problems. I'm trying to figure out a way to record mouse/joystick responses based on images and shapes on the sketchpad. I am using Opensesame .27.

Basically, subjects see a math problem either using numbers (text on a circle, ex 5 + 4) or dot arrays (bmp file, ex picture of 5 dots + picture of 4 dots) for 2 seconds then another sketchpad for 4 seconds showing 5 answer choices in the same format of either a circle with text or picture of dots, arranged in a circle around screen.

I would like to make it so the mouse click on the image or circle is recorded according to the circle or image file. I assume the best way to do this for the picutres in the dot condition is with widgets using something like:

widget 0 0 1 1 image_button path='5+4_9.bmp' var='response'

Where do I put this and is it possible to use a variable rather than specifying the exact file (ie 5+4_9.bmp)?

For the condition showing numbers written on shapes, do I need to create image files for all of these rather than using the shapes and text on the sketchpad or is there a way to make these shapes a widget?

Also, with the timing, is it possible to not have the trial end when a response is made so that the answer choices are displayed for 4 seconds (or some intermediate screen is shown for the duration of the 4 seconds) regardless of how quickly the subject responds?

Sorry for the very basic questions- perhaps I am missing something quite simple.

Thanks!

Comments

  • edited January 2013

    Hi Elizabeth,

    I would like to make it so the mouse click on the image or circle is recorded according to the circle or image file. I assume the best way to do this for the picutres in the dot condition is with widgets using something like:

    widget 0 0 1 1 image_button path='5+4_9.bmp' var='response'

    Where do I put this and is it possible to use a variable rather than specifying the exact file (ie 5+4_9.bmp)?

    You can drag a form_base plug-in into your experiment and click on the edit script button in the top right of the tab. Then you can edit the script as explained here. To use variables rather than static values, you can do things like (note the [square brackets]):

    widget 0 0 1 1 image_button path=[my_bitmap_var] var='response'

    For more information about using variables, see this article.

    For the condition showing numbers written on shapes, do I need to create image files for all of these rather than using the shapes and text on the sketchpad or is there a way to make these shapes a widget?

    Well, that kind of depends on how you want to implement this.

    • If you want to use forms without Python scripting, then yes, you would need to create separate bitmaps for each combination of numbers and shapes.
    • If you want to use forms, but don't mind a bit of Python scripting, you could create custom bitmaps on the fly in your experiment using a library such as PIL. You could then use the bitmaps that you have generated in a form as usual.
    • If you want to use a sketchpad instead of a form, you could just put two bitmaps on top of each other (make sure they have transparency!). The downside of this approach is that you don't have any buttons, so you would need to log the coordinates of the mouse click and parse these afterwards during the analysis (that's probably not too hard though).
    Also, with the timing, is it possible to not have the trial end when a response is made so that the answer choices are displayed for 4 seconds (or some intermediate screen is shown for the duration of the 4 seconds) regardless of how quickly the subject responds?

    Sure, you could add an advanced_delay plug-in to the end of the trial_sequence. Or do you mean that you want the response buttons to stay on the screen for a fixed amount of time, regardless of when the response is given?

    Hope this helps a bit, and let us know if you have any more questions!

    Cheers!

  • edited 7:47PM

    Thank you, I think I may just log the mouse coordinates. Will these be the same as seen on the sketchpad? Do they change depending on screen resolution? (sorry, coming from biology side of neuroscience so some of the experiment creation, stimulus display is very new to me : )

  • edited 7:47PM

    Hi Elizabeth,

    Will these be the same as seen on the sketchpad?

    No. Mouse coordinates have their origin (0,0) at the top left corner, whereas for sketchpads (0,0) is the center.

    Do they change depending on screen resolution?

    The size one pixel (the unit of both the mouse and the sketchpad coordinates) refers to does not change depending on the resolution. But the way you will have to convert the location of the stimulus to the mouse coordinates (or vice versa) does.
    For example, for a display with a resolution of 1024 x 768 the center is at (512,384), whereas for a 1280 x 1024 display the center is at (640,512). Does that make sense?

    I hope this helps. Please let us know if you have any more questions!

    Best,

    Lotje

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

  • edited 7:47PM

    Excellent, thank you! Everything is working well except that occasionally there is a negative x-value for the mouse coordinates...if the origin is at the upper left corner, why would there be a negative x-value?

    Thanks!

  • edited 7:47PM

    Hi Elizabeth,

    Are you using the PsychoPy back-end for your experiment? I forgot to mention that with PsychoPy (0,0) is at centre for the mouse coordinates. But in contrast to the sketchpad item, coordinates above centre are negative.

    If you're not using the PsychoPy back-end the mouse coordinates shouldn't be negative. So if this is the case, perhaps you could provide us with some more information about your experiment, for example by uploading the script?

    Best wishes,

    Lotje

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

  • edited 7:47PM

    Hi Lotje,

    I was using PsychoPy as the back-end and actually still didn't get negative coordinates and checked everything (assuming 0,0 was at the top left) and it worked perfectly. I switched to xpyriment back-end due to some issues with OpenGL on the exp. computer, and it still works. I am not sure why it was working with the PsychoPy back-end though. That's a bit strange.

    Thank you for the update, I'll check again but I think its working fine.

  • edited January 2013

    Hi Elizabeth,

    I think we figured it out! PsychoPy indeed uses the notation as described earlier, but for the sake of consistency between backends, the psycho backend in OpenSesame then converts this to coordinates with their origin at the top left.

    This all works well, except when the actual resolution of the screen does not correspond to the resolution as specified in the experiment. When this happens, (0,0) is the top left of the "screen" in the real screen.

    More schematically, this looks like this:

    image

    Could that explain your earlier experience with the negative values?

    Best wishes,

    Lotje

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

  • edited 7:47PM

    Yes, that does explain the negative values when the outer edges were clicked (but not for the images where subjects were supposed to click), which was with the PsychoPy back-end. That explains it : )

    Thank you so much for your help, I really appreciate it!

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