ati
Regular
Posts: 22
|
Post by ati on Jun 2, 2021 12:43:50 GMT
Hello!
I have a really clear code like this, but, the problem is that the overall duration should be 10 seconds. Basically, stimuli and rating scale should be presented at the same time for 10 second in total. If they repond by rating, the rating scale can be gone, it is not a problem. But, stimuli should continue to be presented, but not 10 seconds more, overall should be 10 seconds. So, if they respond at 10 seconds, overall duration goes to 20 seconds weirdly, which I don't want. If they do not respond, again it is 20 seconds. But, if they respond earlier, it is response time + 10 seconds, which exceeds the total duration again.
Summary:
When no response, 10 seconds for rating scale, then it disappears. 10 seconds more for stimuli without rating scale. Total is 20 seconds.
When there is a response, response time + 10 seconds more for stimuli without rating scale. For instance, if a participant gives his/her response at the 3rd second, the total
will be 3 + 10 = 13. If gives the response at the 9th, it will be 9 + 10 = 19 seconds.
How can I separate them?
table my_table "img_19" img_19 "img_20" img_20 "img_21" img_21 "img_22" img_22 "img_23" img_23
task rate_negative show bitmap @2 0 -50 rate option pos 0 260 rate option labels left right rate option items selection_item rate 10000 9 delay 10000 save @1 RATE RATE_RT RATE_STATUS
block test message instruction mouse tasklist rate_negative 5 all_before_repeat random end
|
|
silk
Experienced
Posts: 32
|
Post by silk on Jun 11, 2021 16:39:30 GMT
Hey there, If I understood correctly, each trial should last exactly 10 seconds. This can be done with a simple condition that checks if there is still time between the participant's answer and the end of the trial. If so, we will put a delay that is the difference between the maximum duration of a trial and the response time. Have a look at the following code: task rate_negative show bitmap @2 0 -50 rate option pos 0 260 rate option labels left right rate option items selection_item rate 10000 9 set $time_to_wait 0 #<-- Set a new variable where the remaining time to wait will be stored, our default value is 0 if RATE_RT < 10000 #<-- Condition that checks if the response time is below 10 seconds (10 000ms) show text "Please Wait" 0 100 # <-- If so, show a text to tell the participant to wait set $time_to_wait expression 10000 - RATE_RT # <-- Store the difference between the maximum duration of a trial and the response time delay $time_to_wait # <-- Indicates that this difference is the time to wait in milliseconds fi #<-- End of the conditional statement save $time_to_wait RATE RATE_RT RATE_STATUS #<-- Save the time waited I hope this will help If you want to play with time you can also have a look at timestamps in the documentation, it can be useful.
|
|
ati
Regular
Posts: 22
|
Post by ati on Jun 28, 2021 21:00:39 GMT
Thank you very much. It works very good. However, interestingly, when there is no response, the scale disappears, but stimulus shows 10 seconds more. For instance, it calculates if there is a response and it does not exceed 10 seconds in total. But, if there is no response in 10 seconds, as I said, scale disappears but stimulus shows 10 seconds more without response option.
|
|
silk
Experienced
Posts: 32
|
Post by silk on Jun 29, 2021 10:11:10 GMT
I just noticed this problem as well. I think it happens because when there is a timeout response (= no response) the default value for RATE_RT is 0. Here we need to ignore the conditional statement that adds more time if there is a timeout response. This can be done by making our conditional statement a bit more complex. The RATE_STATUS variable returns numerical values that indicate if the participant gave an answer or not (1 if they answered, 3 if there is a timeout response). We are going to use this variable in the condition. Have a look at the following code : The code in blue says that RATE_STATUS has to be different from 3 (i.e. a timeout response). The whole condition says that if we are below the maximum allowed time ( RATE_RT < 10000) and ( &&) there is no timeout answer ( RATE_STATUS != 3), then tell the participant to wait. Actually there are many ways to fix this problem, but this one is the simplest I found. I hope it will help
|
|
ati
Regular
Posts: 22
|
Post by ati on Aug 6, 2021 14:12:57 GMT
Thank you very much for a detailed explanation. It worked well. But, in that case, what if the response time is under 10 seconds and the response status is 3?
|
|