How can i create instances of a routine instead of copies? A copy preserves all the components such that if i want to copy a routine and change something in it thereafter, it changes the previous one. I want to copy out as an instance rather than a pointer. Any advice on how this can be done? It would be an absolute horror if i had to rewrite each copy.
thanks
OS (e.g. Win10): mac sierra PsychoPy version (e.g. 1.84.x): 2020.2.3 Standard Standalone? (y/n) If not then what?: scratch build
You can insert multiple copies of the same routine into the experiment flow or you can repeat a routine using a loop. I try to do one of these two methods rather than making a copy of the routine itself whenever possible, so that if I need to make an edit, I only make it once.
I canât really tell from your post what it is that you want to do, but you can repeat a routine using a loop and change some parts of the routine using a conditions sheet for your loop.
If I understand you correctly, you should go to the âExperimentâ menu and choose âCopy routineâ. Then go back to the âExperimentâ menu and choose âPaste routineâ. You will be asked to provide a name for the new version of the routine. All of its components will be automatically be re-named and so can be changed independently of the originals.
There is an issue with terminology here perhaps: in Builder terms, âcopyâ in this case does mean make a new instance, using the original as a template (as if it was a class definition), rather than a pointer to the original. What you refer to as âcopyingâ is represented in the Builder interface as âinsertingâ a routine into the flow, which effectively clones the original multiple times.
I think your approach is that of someone who naturally conceptualises things from an object-oriented-programming point of view. Builder was originally made for non-programmers, so, oddly, aspects of it can sometimes be harder for experienced programmers to get to grips with.
Insert Routine -> Experiment (Copy Routine) -> Experiment (Paste Routine).
I rename the routine.
I change a componentâs name. It is reflected in the earlier components in the original routine I copied from.
So the steps mentioned above do not work. Copying is not creating an instance. It is acting like a pointer.
I noticed in the video, the Insert Routine goes at the end. This is not an option for me. After âCopy Routineâ, you are expected to name the routine. As a result, picking the name goes first before Experiment (Copy Routine) -> Experiment (Paste Routine).
You understood my problem precisely . Thank You!! However what you suggested (same as Becca and wakecarter) does not work as I explained in my comments above.
Can one clear the componentâs queue at the beginning of the routine?
If I copy the routine in a way that they are not instances, can I clear the component so that it forgets anything that it did in the original routine ?
Part of the problem i ran into was a routine remembering what it did in the first one.
This is obviously not a problem if i create genuine instance (thanks for all the recommendations above) but then I have a billion different names for the same routine such as routine, routine_2, routine_3, ⌠I want to avoid some of this redundancy by using a pointer-like copy with a cache clearing mechanism in the beginning.
It sounds like you are fighting against Builderâs design. Perhaps it would be best if you describe what you actually trying to achieve in terms of a concrete experimental procedure â it generally shouldnât be necessary to have a proliferation of routines.
Other echoices that are available: never, any click
Save mouse state on : on click
Other choices that are available: final , every frame, never
It works now. I removed additional processing i was doing post click that recorded the clicked_name[0] and turned the color of the stimuli to a different one if it was clicked. I have no idea why that would cause problems, but its presence was a problem some of the time.