[open] Mouse click accuracy
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.

Here is the full script
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
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 ...
... goes wrong, because it assumes that
cursor_xandcursor_yare relative to display center. What you need to do is compensate for this by adding the display center coordinates (xcandycin the script below) to the stimulus coordinates (or subtracting them from the cursor coordinates). Like so:Cheers!
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
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!
I think you are confusing the name of the experimental variable, i.e.
Word5with its value. If you do this ...You will set the experimental variable
Word5to the value'some_word'. Note that there are three layers here, which can make things a bit confusing.Wordvar, which contains the name of the experimental variable (i.e.Word5).Word5, which contains the value'some_word'.'some_word'.Now let's look at a piece from your script:
What you're doing is setting
click_1_word(etc.) toWordvar, which has the value'Word5'. What you actually want to do is set it to the value of the experimental variableWord5, like so:Does that clear things up?
Check out SigmundAI.eu for our OpenSesame AI assistant!
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
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_scriptalso available in otherinline_scripts. So the fact you're working across differentinline_scripts is in itself not a problem:Cheers,
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!