[open] Does a variable have to be defined in loop table to be called as [' '] in sketchpad?
HI there,
i am trying to set sketchpad duration as the value of a variable that will be given a value half way through a sequence. I am creating a delay which will add a bit of time after a participant responds. I want to do this to make sure all my trials are the same length.
resp_time= exp.get('response_time_gamepad_response')
exp.set('delay', 2000 -int(resp_time))
in my sketchpad i have put [delay]. If i do not include a variable called delay in the loop variable table, then it gets confused and cannot locate a variable 'delay'. If i do include it, and just fill it with dummy values e.g. zeros, then change the value of 'delay' to the script above, it keeps with the original value (zero) and does not change the value of delay depending on how fast a participant responded. Please help!
Many thanks,
Josh

Comments
Hi Josh,
I think the problem here lies in the internal order, in which the elements of a
sequenceare called. Asketchpadis set up in theprepare phase, that means, that every variable that you want use in that particularsketchpadhas to be defined before. Response time sampling occurs in the run_phase and won't have any influence onsketchpads of thatsequence. Do you see, what I mean?As a solution, you can try a small "trick". Instead of adjusting the duration of the current
sketchpad, you can add a newsequencewith a singlesketchpadinside, that runs only once for a duration you can use your variable[delay]for.Let me know if you need more help.
Good luck,
Eduard
Edit: I adjusted the title of this discussion, because it would be too long otherwise