Description of the problem:I am calibrating the stimulus size using wakecarter’s screen scale code.
I want to then pass the x_scale and y_scale values to a second experiment using the completion URL along with the participant code.
Knowing that the completion URL is generated at the begining of the code before any variables generated during the running of the experiment would exist as described here: CompletedURL / IncompleteURL - #18 by lnnrtwttkhn
I am using the recomended command in a code component after the x_scale and y_scale variables have been populated.
I get no errors when generating the javascript and I am redirected to the next experiment at the end of the first, however when it comes time for the second experiment to use the x_scale and y_scale variables I get an error message stating that it was unable to convert the variable to numerical value since it was a NaN.
If I paste the completion url directly into a browser without specifying the values of x_scale and y_scale I get the same error message at the same point. However if I directly specify the values in the url when pasting it into a browser, and without using the $ before the value then the experiment runs properly.
I tried removing the $ in the completion url but I get the same error message as originally.
All this leads me to believe that the values are not being properly sent to the second experiment.
It is passing along expInfo['PROLIFIC_PID'] just fine, but the Conds variable is not being added and shows us up as “undefined” in the output URL. What is confusing is that the Conds variable is being added fine to the Pavlovia output file with this thisExp.addData('Conds',Conds), which is in a code component, Begin Routine tab, within a loop.
Any idea of what might be happening? All I want to do is add a variable I define in my study to my URL.
The completion URL is set at startup (after the expInfo dialogue box has been submitted).
If you want to add variables during the experiment the you need to set something in Experiment Settings and then redirect in a code component. I can’t remember the actual code off the top of my head but it’s something like PsychoJS.redirectURLs(mycompletedurl,mycancelledurl)
Perfect, thank you! Do you know if I can modify the expInfo variables during the experiment, or are those “fixed”? For example, could I re-write expInfo['Condition'] after it’s set at startup?