I was just wondering if there was any internal data or a flag which can feedback if an experiment is currently being ran offine (psychopy) or online (pavlovia) ? Something which can be accessed in code to make decisions, and which translates perfectly between both? (i.e. doesn’t have to be re-written for online).
At the moment we’re just simply using a “online” parameter at the start set to 0 or 1 to indicate, but it would be useful to have something that automatically detects - so we can decide if for instance to use an “.mp3” or .“wav” sound file accordingly without having to have separate versions of trial excel files/scripts.
What I do is use a Both code component, for example:
Python: fileName = Sound+’.wav’
Alternatively, you can just have a JS component which does a string replace of .wav to .mp3
Having “online” as a start up parameter allows us to do that to a degree, as we can essentially do:
if online == 1:
extension = “.mp3”
extension = “.wav”
… which translates automatically and perfectly, then just bolt the extension onto the filename where called.
Not a critical issue, just something that would be a nice to have somewhere in in expInfo or similar that is accessible from the off.