Post by jasonmax on Jul 18, 2024 10:05:24 GMT
Hello community,
I am trying to implement a part of my experiment where you can click numbers to choose how much you agree with a certain phrase, and you can change numbers until the enter key is pressed. Currently, however, I can only have this work where I get one number press and no changes, or I can get multiple number presses, but then you can't force the progression on the enter key. Here is the code:
while $finish_selection != 1
readmouse l 1 99999 range $range_begin $range_end
if UNDER_MOUSE > $range_begin
if $previous_stimulus != -1
clear -1
## Restore the previous bitmap by iterating through bitmap positions
set $i 1
while $i <= &&bitmap_positions.size
if &&bitmap_positions[$i] == $previous_stimulus
set $bitmap_name &&bitmap_positions[$i]
set $bitmap_x &&bitmap_positions[$i+1]
set $bitmap_y &&bitmap_positions[$i+2]
show bitmap $bitmap_name $bitmap_x $bitmap_y
set $i expression $i - 3
fi
while-end
fi
set $previous_stimulus UNDER_MOUSE
set &&digit_chosen clear
set &&digit_chosen append UNDER_MOUSE
set $clicked_stimulus_x getx UNDER_MOUSE
set $clicked_stimulus_y gety UNDER_MOUSE
set $previous_x $clicked_stimulus_x
set $previous_y $clicked_stimulus_y
show circle $clicked_stimulus_x $clicked_stimulus_y 40 355 400 400
delay 100
clear -1
show bitmap mask $clicked_stimulus_x $clicked_stimulus_y
fi
keys enter
readkey 1 999999
if STATUS == CORRECT
set $finish_selection 1
fi
while-end
If I change the timing I can theoretically change this to keep looping until you hit the numbers in their specific timing gap, but I really want to know if there is a way where you can loop this until the person decides to hit the enter key, and they can select as many numbers as they want until they feel their value is adequate. Let me know thanks.
I am trying to implement a part of my experiment where you can click numbers to choose how much you agree with a certain phrase, and you can change numbers until the enter key is pressed. Currently, however, I can only have this work where I get one number press and no changes, or I can get multiple number presses, but then you can't force the progression on the enter key. Here is the code:
while $finish_selection != 1
readmouse l 1 99999 range $range_begin $range_end
if UNDER_MOUSE > $range_begin
if $previous_stimulus != -1
clear -1
## Restore the previous bitmap by iterating through bitmap positions
set $i 1
while $i <= &&bitmap_positions.size
if &&bitmap_positions[$i] == $previous_stimulus
set $bitmap_name &&bitmap_positions[$i]
set $bitmap_x &&bitmap_positions[$i+1]
set $bitmap_y &&bitmap_positions[$i+2]
show bitmap $bitmap_name $bitmap_x $bitmap_y
set $i expression $i - 3
fi
while-end
fi
set $previous_stimulus UNDER_MOUSE
set &&digit_chosen clear
set &&digit_chosen append UNDER_MOUSE
set $clicked_stimulus_x getx UNDER_MOUSE
set $clicked_stimulus_y gety UNDER_MOUSE
set $previous_x $clicked_stimulus_x
set $previous_y $clicked_stimulus_y
show circle $clicked_stimulus_x $clicked_stimulus_y 40 355 400 400
delay 100
clear -1
show bitmap mask $clicked_stimulus_x $clicked_stimulus_y
fi
keys enter
readkey 1 999999
if STATUS == CORRECT
set $finish_selection 1
fi
while-end
If I change the timing I can theoretically change this to keep looping until you hit the numbers in their specific timing gap, but I really want to know if there is a way where you can loop this until the person decides to hit the enter key, and they can select as many numbers as they want until they feel their value is adequate. Let me know thanks.