Howdy, Stranger!

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

Supported by

Setting duration based on a calculation with variables


I'm creating a test on inhibition of responses. In the first part the participant completes a number of trials responding as quickly as possible to say whether an arrow is pointing left or right.

In the next block of trials I introduce a 'stop signal' in half of the trials. When they hear the stop signal the participant shouldn't respond. The problem I'm having is that I want to set the timing of the stop signal based on the participants reaction time in the first block of trials - so for example, if their reaction time had been 850ms, then I'd like the stop signal to be given 400ms before that. I've tried defining this as [avg_rt] - 400 but that doesn't seem to work - do you have any suggestions?




  • Hi Jonathan,

    What part does not work? Please provide more details, then we can help you better. So, what did you try, what do you see, are there error messages, etc.



  • Hi Eduard,

    I have set up the trial as follows:

    • Sketchpad showing an arrow pointing to the left or right
    • In half the trials this is then followed by a sound which signals that the participant shouldn't respond
    • At the moment they hear the stop sound 100ms after they see the arrow - I have set this using the duration for the sketchpad
    • However I would like to set the duration based on the participants reaction time in a previous block of trials, and tried to set the duration as [[avg_rt] - 200]
    • When I run the experiment I get the message - "Invalid duration: [493.8 - 200]" - the 493.8 is clearly the avg_rt, but it's not preforming the calculation that I would like it to!

    I hope that makes sense, just in case I've also attached the version of the experiment that isn't working:



  • Hi Jonathan,

    There is probably a way to do it like you intend to, but I don't remember exactly what the syntax is supposed to be. A way to get around it, is to add an inline script before that sketchpad, in whose prepare phase you define the duration first. (e.g. var.dur = var.avg_rt- 200), then you can add [dur] as duration in the sketchpad and it should work. If you want the avg_rt to keep on updating during the experiment, you do it on every trial (so in the block loop), or if it should stay constant for a block, you do it before the loop.

    Good luck,


Sign In or Register to comment.