Ok downloading now.
You need to do something in the Python side of your Auto block to wake up the auto translate. The translation should appear in the JS side.
Delete the import commands and the random seed section. Iâm guessing you come from a MATLAB background. Python and JavaScript both seed randomly by default.
Are you using random, math or time elsewhere? If so, youâll need to rewrite your Python code.
Thank you after I removed the import command and random seed sections the code did translate. However I do use the random function in some other sections of the task, how would I trigger this now?
Here is what it looks like.
random()*100 is I believe the same as your random uniform command.
Your code component is showing as Py not Auto.
Have you seen randint on my crib sheet?
Yes, does randint also select the number from a uniform distribution of values?
Also this is what I receive now when I leave the random function untouched, would this work? I believe it only converted the round function to Java but Iâm not certain.
Please have a read through my crib sheet.
I think you want randint (which is a uniform distribution) but youâve also missed that all loops in JS have to be addressed as trials
Ok so it should be something like this? I am not seeing it translating the randint function.
Also, when you state do not use a $ for specifying a variable for nReps, this would mean I would just remove the $ for all loops like the one below?
Remove the dollar sign
Remove random. from randint
Ok thank you that fixed it. So my last question is for this last piece of code in the same component. It also wonât translate and Iâm not sure what needs to be edited. These are the two primary sections of code. Thank you so much for your help btw.
Nevermind I figured this out. I will be testing running it in a minute.
By âit wonât translate â what do you mean? It looks like you havenât clicked into the Python side to activate the translation
Yes I realized it after I had sent the message. So a first run through on my desktop crashed when it tried to close my practice game loop, which had initially been named âpracloopâ. It says âtrialsâ isnât defined. I have another game loop in the task and both loops canât be named trials so how would I work around this? Or can this version of the task only work through Pavlovia and Javascript?
After youâve done the auto translation switch auto to both and change the loop names to trials in the JS side only
Thank you. I have made additional adjustments to the task based on your crib sheet and now when I run the task the visual stimuli are pulled from the excel file now! The only issue is that the event.clearEvents() function isnât clearing my previous responses for the game. Is event.clearEvents() supposed to translate into something else when in JS format?
clearEvents just clears the keyboard buffer.
Do you have a bunch of variables that need to be reset in Begin Routine?
No just one keyboard response from the participant for every round of the game.
Here is what it looks like (key_decision is the name of the keyboard response component).
Well hold on, there are a couple of other variables but the issue primarily seems to be with resetting the keyboard response.
Is the problem that the routine starts as soon as the previous routine has finished and therefore the key is still pressed. Do you have an ISI to allow the participant to lift their finger?
Yes my âISIâ periods are points in which the participant is anticipating a response from their partner.
Taking a look at the flowchart at the bottom of the image, decisions are made in the âDecisionPracâ routine of the loop, then one of the âAntiâ loops is triggered and one of the âFeedâ loops is triggered, all sequentially, before returning to DecisionPrac.