mousetrap_response coordinates don't match
Question 1:
I have made a mousetrap_response thing with buttons with the coordinates that opensesame shows when you look at the sketchpad grid. The buttons kind of work, but the coordinates don't seem to exactly match. The buttons only work if you click on a certain spot, rather than anywhere in the button.
For example, I have coordinates:
x=-288 y=192 w=-224 h=256
This represents a square button with the coordinates (-288, 192), (-288, 256), (-224, 192), (-224, 256), right?
But it isn't working like that. Do you know why? How can I fix it?
Question 2:
Can you make over 4 buttons using mousetrap_response?
I know that in the "control" view of it, there are only 4 buttons, however if you add buttons in the "script", can they work?
Mine don't, but I'm having issues with the coordinates anyway..
This is what I have in the script:
__warning_message__
draw textline text="Please start moving" x=0 y=0 sketchpad=example
__end__
set update_feedback no
set timeout infinite
set start_coordinates "0;280"
set skip_item no
set save_trajectories yes
set reset_mouse no
set number_of_buttons 5
set mouse_buttons_allowed "left_button;right_button"
set max_initiation_time 1000
set logging_resolution 10
set description "Tracks mouse movements"
set correct_button lila
set click_required yes
set check_initiation_time no
set button5 "x=288 y=-224 w=352 h=-160 name=grün"
set button4 "x=-352 y=-224 w=-288 h=-160 name=gelb"
set button3 "x=224 y=192 w=288 h=256 name=hellblau"
set button2 "x=-32 y=192 w=32 h=256 name=lila"
set button1 "x=-288 y=192 w=-224 h=256 name=rot"
set boundaries "upper=no lower=no left=no right=no"
I just edited the script to make it have 5 buttons instead of 4.
Question 3
If you cannot make more than 4 buttons using mousetrap_response, is there any way to change the format of mousetrap_form buttons?
I want my buttons to be an image of a colour. I've successfully made 6 buttons using mousetrap_form, but I can't figure out how to insert an image onto the button. Is there any way to do that?
Appreciate any feedback on any of these questions.
Thank you!
Comments
Seems like a question for @Pascal!
Check out SigmundAI.eu for our OpenSesame AI assistant!
Thanks, @sebastiaan, just was looking at it
Re Question 1:
The coordinates
x=-288 y=192 w=-224 h=256
represent a button with the coordinates (-288, 192), (-288, 192+256), (-288-224, 192), (-288-224,192+256), i.e., (-288, 192), (-288, 448), (-512, 192), (-512,448), as the width (w) and height (h) get added to x and y respectively.
The idea is that you can draw a rect element on a sketchpad that represents the button borders and extract the relevant coordinates from its OpenSesame script.
Re Question 2:
If you would like to have more than 4 buttons and want to use a sketchpad / canvas for presenting them, you cannot add them to a mousetrap_response item by modifying its OpenSesame script. Instead, you would use the MT_response class in Python. You can find an example experiment here. It is called "mousetrap_response_python.osexp".
Re Question 3:
If you would like to use images as buttons on a form, you can use an image_button widget.
You can add this using OpenSesame script to a mousetrap_form item. However, if you are not interested in the mouse-tracking data, you could also use just the standard form_base item.
Alternatively, if your images are really just colored rectangles, you can also create them using filled rect elements on a sketchpad, e.g., like this:
draw rect color=green fill=1 h=128 penwidth=1 show_if=always w=160 x=-352 y=-256 z_index=0
You can also vary the color using an experimental variable:
draw rect color=[button1_color] fill=1 h=128 penwidth=1 show_if=always w=160 x=-352 y=-256 z_index=0