| Reference | Downloads | Github

Order of execution of components within a routine

Does the order in which components are added to a routine not matter? I thought that this order is the baseline for determining the order in which the different components are executed, with any start/stop rules within individual components merely overwriting this baseline order. There is after all a “move up/down” command for each component, which suggests this order matter.

The reason why I ask this: I have a sound component followed by a text component, and I expected the text to just appear after the sound finishes playing. Instead it is displayed from the beginning. This would imply that, in order to control the order of components (make them appear in series), one would have to condition the start of each one upon the end of another, for instance in my case, define sound.status==FINISHED as the start condition of my text component. And then repeat this logic in a chain for all components of a routine.

Am grateful for any clarification of how this in fact works!

OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): 3.1.0

The order of display/onset/offset of stimuli is controlled explicitly within the components, using the start/stop fields. The vertical ordering of components has no influence upon this at all. There is no concept of an “order” of appearance: the times or other conditions must be specified explicitly, rather than some sort of implicit “this comes after that”.

The vertical ordering is for two purposes:

  • for aesthetic/display purposes: so you can make the vertical ordering match the timings in a logical or consistent way if desired, or just group things together in ways that otherwise make sense to you.
  • for code components, the vertical order does matter. e.g. if you want to refer to a variable that is created in a code component, that code component needs to be executed first before any other components that refer to it, so the code component needs to be above any components that refer to it.

All clear now, thank you!