Howdy, Stranger!

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

Supported by

[open] Mouse click accuracy

edited February 2014 in OpenSesame

Hi,

I am trying to make this experiment where in a single trial, 5 letters will be presented in random locations. Participants have to click at all the letters that they saw in a grid shown earlier. I am trying to record the mouse clicks and the letters that appear at the location of the clicks. I have two inline scripts here: SetPos for setting the position and letters to be displayed (this part works fine) and GetClicks gather the mouse click and stores the letter being clicked (in Wordvar variable) (This is the problematic part) . I am using the sketchpad DisplayStim to display the five letters.
image

Here is the full script

http://pastebin.com/xxL4X86x

Right now, the letters get displayed in random locations, but the mouse clicks are not recorded. The screen just freezes at the display.

Any pointers and suggestion will be much appreciated.

Thanks,
Asma

Comments

  • edited 12:39AM

    Hi Asma,

    It's a bit uninituitive, I know, but mouse clicks are reported relative to the top-left, and not relative to the display center. So your error calculation ...

    err = sqrt((xvar-cursor_x)**2+(yvar-cursor_y)**2)
    

    ... goes wrong, because it assumes that cursor_x and cursor_y are relative to display center. What you need to do is compensate for this by adding the display center coordinates (xc and yc in the script below) to the stimulus coordinates (or subtracting them from the cursor coordinates). Like so:

    # Get the coordinates of the display center
    xc = self.get('width')/2
    yc = self.get('height')/2
    # Determine the click error, while taking into account that the mouse
    # clicks are reported relative to top-left, and sketchpad coordinates
    # relative to the display center.
    err = sqrt((xvar+xc-cursor_x)**2+(yvar+yc-cursor_y)**2)
    

    Cheers!
    Sebastiaan

  • edited 12:39AM

    Thanks for the reply Sebastiaan,
    Adding the center coordinates did the trick for collecting mouse response.

    I am still struggling with the accuracy part. Right now, clicks get recorded but the word variable contains the last variable created in SetPos inline script ie 'Word5'

    Here are the two inline scripts:
    For randomizing positions and words: http://pastebin.com/naRujVqz
    For getting mouse click accuracy: http://pastebin.com/t1dQ1wP7

    I am still trying to get a better handle at programming. Any pointers about what is the error in the logic of the program will help greatly.

    Thanks!

  • edited 12:39AM

    I think you are confusing the name of the experimental variable, i.e. Word5 with its value. If you do this ...

    Wordvar = 'Word5'
    exp.set(Wordvar, 'some_word')
    

    You will set the experimental variable Word5 to the value 'some_word'. Note that there are three layers here, which can make things a bit confusing.

    • The Python variable Wordvar, which contains the name of the experimental variable (i.e. Word5).
    • The experimental variable Word5, which contains the value 'some_word'.
    • The value 'some_word'.

    Now let's look at a piece from your script:

    exp.set ('click_%d_word' % n_click, Wordvar)
    

    What you're doing is setting click_1_word (etc.) to Wordvar, which has the value 'Word5'. What you actually want to do is set it to the value of the experimental variable Word5, like so:

    exp.set ('click_%d_word' % n_click, self.get(Wordvar))
    

    Does that clear things up?

  • edited 12:39AM

    Hi Sebastiaan,

    That makes sense but does not work for me. If I use self.get it gives me an error that Wordvar is not set in the script-- which is understandable because I am generating Wordvar in SetPos script and not in GetClick script. Even using exp.get gives me 'a' (the last word (Word5) generated) in all the words clicked (click_%d_word).

    I am not sure how to integrate the information generated in SetPos and GetClick scripts.

    Thanks,
    Asma

  • edited 12:39AM

    Hi Asma,

    Could you paste the exact (line of) script and the error message that is triggered? In general (and in recent versions of OpenSesame), variables that are defined one inline_script also available in other inline_scripts. So the fact you're working across different inline_scripts is in itself not a problem:

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