Howdy, Stranger!

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

Supported by

Mouse Trap - Assigning buttons to variables

Hi,

I am quite new to OpenSesame and programming in general so this may be a dumb question.

I am presenting three pictures and want participants to click on of these three. If it is incorrect they will be shown an error screen and will be shown the images again. If they are correct I want to show a correct screen and they can move on to the next part of the experiment.

I have created graphics of the three images and what I want them to look like and insertedthese as an image in sketchpad. I decided to use MouseTrap plugin as it looked like a good option for defining areas of the pictures.

Following this tutorial https://github.com/PascalKieslich/mousetrap-os/blob/master/plugins/mousetrap_response/mousetrap_response.md I have drawn borders around my buttons using rect elements. The next part of the tutorial says "Insert the button labels using textline elements. You may either use a constant string or an experimental variable (e.g., '[CategoryLeft]')." I am not exactly sure how to do this...its probably really obvious but in the sketchpad do I go into the script and define them there (if so what would that look like) or would I put the whole thing into a loop and define variable there or both?


Sorry if this is really obvious.

Thanks in advance.

Matt

Comments

  • Hi Matt,

    the quoted part relates to inserting the actual labels as text on the screen. What you mean is naming the rect elements, i.e., what is described afterwards:

    "If in the following variant 3a is used to define buttons (the easier and preferred variant as of OpenSesame 3.2), an additional step is required: To make the button borders identifiable, the rect elements are labeled using the Name field in the top row of the sketchpad options (this field is available after selecting the rect element). Each button border is named using the corresponding variable name from the previous step 2 (e.g., '[CategoryLeft]')."

    You can also have a look at the preprint of a book chapter that describes this and contains a screenshot (Figure 2):

    https://psyarxiv.com/zuvqa/

    When naming the elements, you can either use text, e.g., "Image1", "Image2" etc. However, in case you have several trials and your images vary you can also use variables. All of this depends on how you have set up the general structure of your experiment. If you have several trials with different images, you probably want to use a loop where you create variables that specify the name of the image files (e.g. ImageFile1, ImageFile2 etc.). Then you use these variables to define your images and also to name the rectangles as explained above (entering "[ImageFile1]", "[ImageFile2]", etc.

    However, in you case it could also make sense to use OpenSesame's form plugins and the ImageButton widget (https://osdoc.cogsci.nl/3.2/manual/forms/widgets/#image_button-imagebutton)

    Hope this helps. Let me know if you have additional questions.


    Best,


    Pascal

  • Hi Pascal,

    Sorry for the late reply. Thanks for the help and the link to the pre-print! I have managed to now assign the three different sections of my images to three different buttons.

    So now I am trying to run certain images that will appear if the click one of the three buttons but I am having problems and the wrong images are being produced after my clicks. I am not sure if I am giving the correct "run if" statements for the feedback images.

    Just to explain I have three different questions with images that are identical they all have the same buttons (a left, a middle and a right button) but the correct response will different depending on the question (I have used the looper to define CategoryCorrect as either CategoryLeft, CategoryMiddle, CategoryRight)

    My experiment is laid out as so

    • A Looper (defining the 3 different buttons and three different questions)
    • A sequence that contains the three questions
    • The three question sequences

    My question sequences looks like this:

    • Sketchpad (with three buttons)
    • Mousetrap response
    • Correct Feedback Image
    • Incorrect Feedback Image one
    • Incorrect Feedback Image two
    • Repeat cycle (to repeat this sequence if incorrect response given)
    • Logger

    I have tried using the run if statement for correct: "[correct] = 1" . For the incorrect ones I have tried telling it to present the image when the incorrect response is played and gave coordinates so it knows which of the two incorrect images to display: "[correct] = 0 and x > 64.

    This is not giving me the correct feedback images that correspond to mouse clicks. This is probably very easy but is there another mouse response variable that I should be using for the run if section?

    Sorry this is probably a very easy problem but I haven't found a solution yet!

    Best,

    Matthew

  • Hi,

    Sorry I have since found a solution to my problem above.

    I used a bit of python code in the 'run if' statement that has made things work.

    I created a sequence after the mousetrap response item that contained the three response pictures I wanted to show. In the 'run if' column I used a response_mouse variable to tell the programme when to play which feedback picture.

    For example, if my participants clicked on the second button and I wanted that picture to flash I used this run if statement:

    " =var.response_mouse1=='Character2' "

    That was probably obvious for some of you but I hope that's helpful for anyone else running a similar design.

    Best,

    Matthew

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