Howdy, Stranger!

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

Supported by

[solved] Accuracy based on mouse location

edited September 2014 in OpenSesame

Hi everyone!

I'm a relatively new user of OpenSesame, I've only built 2 experiments so far. However I find it awesome!

I'm currently building an experiment in which, after a presentation of 5 geometrical shapes and sounds appearing in 5 successive 3x3 matrices, the subjects would be asked to relocate a shape or a sound in an empty matrix thanks to the mouse.

I'm only working with screen coordinates. Here is a diagram showing what it looks like:

image

When the subjects clicks, the program is supposed to return a number (1 through 9) according to the location of the click. Assuming that it couldn't be done with the mouse_response element, I've added an inline_script.

I've already coded something, but when OpenSesame comes to the answer screen, it freezes and I must exit manually.

Here's my code:

        from openexp.mouse import mouse
        my_mouse = mouse(exp, buttonlist = ([1]), visible = True)


        n_click = 0
        max_click = 1


        while n_click < max_click:

      position = my_mouse.get_click()
      x,y = position

      if x>518 and x<813 and y<299:
          exp.set("answer", 1)

      if x>813 and x<1108 and y<299:
          exp.set("answer", 2)

      if x>1108 and x<1403 and y<299:
          exp.set("answer", 3)  

      if x>518 and x<813 and y>299 and y<598:
          exp.set("answer", 4)


      if x>813 and x<1108 and y>299 and y<598:
          exp.set("answer", 5)


      if x>1108 and x<1403 and y>299 and y<598:
          exp.set("answer", 6)


      if x>518 and x<813 and y>598 and y<897:
          exp.set("answer", 7)


      if x>813 and x<1108 and y>598 and y<897:
          exp.set("answer", 8)


      if x>1108 and x<1403 and y>598 and y<897:
          exp.set("answer", 9)

      n_click += 1 

It's not really fancy but I thought it might work. I'm stuck, the rest of the experiment is ready, and that's the only thing that keeps me from moving on. I'm sure I'm missing something, like with the "canvas" function or something, but I'm not sure.

So I'm asking for your help! Please?

Comments

  • edited 10:23AM

    Hi,

    Your script looks ok, assuming that the indentation is correct (but I guess that got messed up when pasting it here on the forum). But there's a plug-in for this very purpose: the touch_response. So it will probably be easier to use that.

    See also:

    Good luck!
    Sebastiaan

  • edited 10:23AM

    Thanks! That's great! I didn't know it existed. I should have looked harder. I'm trying this out as soon as I get enough time to! Looking to the description, I'm sure it will fit!
    I'll keep you posted!

    Thanks again!

    Yojimbanima.

  • edited 10:23AM

    Hi again!

    I've tried the touch_response plug-in, though it doesn't exactly fit to my expectations, I've incorporated it in my experiment and drawn a grid corresponding to the touch_response boundaries.

    Unfortunately, a problem remains. The program crashes during the parallel plug-in named "Reponse" which includes a inline_script named "Grille" and touch_response plug-in named "Response_Matrix".

    Here's a link to download my experiment:

    https://onedrive.live.com/redir?resid=54E977011C3388B0!818

    Do you have any idea why this happens?

    By the way, I'd like to apologize if I made any typing mistake. As you can see in my experiment, English is not my native language.

  • edited 10:23AM

    Hi Yojimbanima,

    I cannot download your experiment, but the parallel plug-in is known to be unstable. What happens exactly? Does OpenSesame crash completely, or do you see a Python stacktrace in the debug window? (If so, please post.)

    By the way, I'd like to apologize if I made any typing mistake. As you can see in my experiment, English is not my native language.

    Don't worry and welcome to the club ;-)

    Cheers,
    Sebastiaan

  • edited 10:23AM

    Hi!

    Opensesame crashes completely or acts as if the experiment was over.

    This new link should solve the download problem:

    https://onedrive.live.com/redir?resid=54E977011C3388B0!820&amp;authkey=!AFDS1xK32ZXpEqU&amp;ithint=file,gz

    Thanks for your help!

    Yojimbanima.

  • edited 10:23AM

    Hi Yojimbanima,

    The parallel plug-in is best avoided, because, as I mentioned above, it can be unstable. But in your case it doesn't seem to be necessary at all. You use the parallel for two purposes, neither of which require true parallelism:

    1. Playing a sound and showing a stimulus simultaneously. This is not necessary because sound will play in the background if you set the duration to 0.
    2. Showing a canvas and collecting a response. This is not necessary, because you can simply show the canvas first and collect the response after (i.e. sequentially).

    So I think you should be fine if you just avoid the parallel plug-in.

    Hope this helps!

    Sebastiaan

  • edited 10:23AM

    Hi!

    Thank you so much for your help. I'll work on that. I'll keep you informed.

    Take care!

    Yojimbanima.

  • edited October 2014

    Hi again!

    I got rid of all the occurrences of the parallel plug-in. Then, I aslo got rid of the touch_response plug-in that didn't quite match my expectations.

    I used an in-line script to draw an empty grid (which dimensions correspond to my presentation matrix) in which the subjects would have to relocate the geometrical shapes or the sources of the sounds they heard.

    The accuracy is based on the location of the mouse when it gets clicked returning a number corresponding to the different locations in the empty grid.

    Again, thank you so much for your help and your availability! Keep on doing such a good job!

    Yojimbanima.

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