Description of the problem:
Hello all. I’m now about to finish building my first experiment using Pavlovia, and I have a problem that I am not sure how to debug since it’s online.
I am trying to set one of my loops to start in a different row in any iterations. The loop stops after K repetitions, when K is the number of loops until the subject response. (it sounds stimulus 0, stimulus 1, stimulus 2, 3 until response) so I don’t know exactly when will the next loop will start. I want to make it start in stimulus K, so if the subject heard stimuli 0-4 he will now hear stimulus 5.
I’ve set a counter called “bad_count” and the syntax there seems to be OK so it increases in 1 each time the routines in the loop end (I’ve saved it in the log to make sure it happens). However, when I write in the selected rows “(USD sign)bad_count:55” I get a syntax error (“Initializing the experiment…”). I tried to remove the $ sign and the experiment runs but always starts the loop from row 0.
how do I get it to address a different starting point for the selected rows each time I loop?
EDIT: for some reason I can’t show the USD sign used to mark code. Now it appears…
Try putting a $ prefix there to indicate that this is a code expression and a not a literal value:
$bad_count:55
Note that the labels for the fields in this dialog vary in whether they contain a $ (indicating that the field defaults to expecting a non-literal value) or not. The “Selected rows” field does not have one, so you need to specify it when required.
Something has just gotten a little pathological for you. The only way I can replicate something like this is to intentionally put in a syntax error, leading to the red error message, and then correct it. But the error message remains, so one needs to push “cancel” and try again.
If cancelling doesn’t work, I’d then suggest simply deleting the loop and reinserting it.
Otherwise, push the “compile script” button and look for the block of code that starts like:
name_of_your_loop = data.TrialHandler(
and copy and paste the entire contents of that function call here for us to see.
Cancelling didn’t fix it unfortunately. I tried deleting the loops and reinserting them, that also didn’t fix the issue.
I even created a new builder experiment, recreating just two components, however, the loop still has the same issue.
I found that $SelectRows:10 will work, but $0:SelectRows won’t work for whatever reason. I managed to fix the syntax error by creating a new variable in a code component that = 0, and putting that as the first value in my index ($NewVariable:SelectRow).
Thank you for the assistance!
The $ sign doesn’t help. also setting both ending and start of loop as variable var1:var2 doesn;t help. with the sign i get a syntax error (stuck “initializing…”) and without it I just get a regular loop for 0 to the end.
Is there something in my code specifically that made this happen? I tried to move this part of the code to the begining of the routine or it’s ending but it doesnt help. I also tried to save it in my log file that i download from pavlovia and I see that it does add 1 to the counter each time and in the right places. so my conclusion here is that there is something in the “selected rows” arguement itself that caused the error. here is the JS implementation of it:
Hi - We are 9 months and 100 bugs later, so I am having trouble to remember whats going on here. The final version I have used doesn’t look like that, so I tend think I gave up on this issue and did something else.