/**************************************** 
 * Conditional_Resources_From_List Test *
 ****************************************/
import { core, data, sound, util, visual, hardware } from './lib/psychojs-2023.1.1.js';
const { PsychoJS } = core;
const { TrialHandler, MultiStairHandler } = data;
const { Scheduler } = util;
//some handy aliases as in the psychopy scripts;
const { abs, sin, cos, PI: pi, sqrt } = Math;
const { round } = util;
// store info about the experiment session:
let expName = 'conditional_resources_from_list';  // from the Builder filename that created this script
let expInfo = {
    'participant': `${util.pad(Number.parseFloat(util.randint(0, 999999)).toFixed(0), 6)}`,
    'group': ["a", "b"],
};
// Start code blocks for 'Before Experiment'
// Run 'Before Experiment' code from init_resources_code
var resource_list = [];
// init psychoJS:
const psychoJS = new PsychoJS({
  debug: true
});
// open window:
psychoJS.openWindow({
  fullscr: false,
  color: new util.Color([0,0,0]),
  units: 'height',
  waitBlanking: true
});
// schedule the experiment:
psychoJS.schedule(psychoJS.gui.DlgFromDict({
  dictionary: expInfo,
  title: expName
}));
const flowScheduler = new Scheduler(psychoJS);
const dialogCancelScheduler = new Scheduler(psychoJS);
psychoJS.scheduleCondition(function() { return (psychoJS.gui.dialogComponent.button === 'OK'); }, flowScheduler, dialogCancelScheduler);
// flowScheduler gets run if the participants presses OK
flowScheduler.add(updateInfo); // add timeStamp
flowScheduler.add(experimentInit);
const init_resources_loopLoopScheduler = new Scheduler(psychoJS);
flowScheduler.add(init_resources_loopLoopBegin(init_resources_loopLoopScheduler));
flowScheduler.add(init_resources_loopLoopScheduler);
flowScheduler.add(init_resources_loopLoopEnd);
flowScheduler.add(resource_checker_pbRoutineBegin());
flowScheduler.add(resource_checker_pbRoutineEachFrame());
flowScheduler.add(resource_checker_pbRoutineEnd());
flowScheduler.add(resource_download_completeRoutineBegin());
flowScheduler.add(resource_download_completeRoutineEachFrame());
flowScheduler.add(resource_download_completeRoutineEnd());
const show_images_loopLoopScheduler = new Scheduler(psychoJS);
flowScheduler.add(show_images_loopLoopBegin(show_images_loopLoopScheduler));
flowScheduler.add(show_images_loopLoopScheduler);
flowScheduler.add(show_images_loopLoopEnd);
flowScheduler.add(never_ending_routineRoutineBegin());
flowScheduler.add(never_ending_routineRoutineEachFrame());
flowScheduler.add(never_ending_routineRoutineEnd());
flowScheduler.add(quitPsychoJS, '', true);
// quit if user presses Cancel in dialog box:
dialogCancelScheduler.add(quitPsychoJS, '', false);
psychoJS.start({
  expName: expName,
  expInfo: expInfo,
  resources: [
    // resources:
    {'name': 'default.png', 'path': 'https://pavlovia.org/assets/default/default.png'},
    {'name': 'group_a_stim.csv', 'path': 'group_a_stim.csv'},
    {'name': 'group_b_stim.csv', 'path': 'group_b_stim.csv'},
  ]
});
psychoJS.experimentLogger.setLevel(core.Logger.ServerLevel.EXP);
var currentLoop;
var frameDur;
async function updateInfo() {
  currentLoop = psychoJS.experiment;  // right now there are no loops
  expInfo['date'] = util.MonotonicClock.getDateStr();  // add a simple timestamp
  expInfo['expName'] = expName;
  expInfo['psychopyVersion'] = '2023.1.1';
  expInfo['OS'] = window.navigator.platform;
  // store frame rate of monitor if we can measure it successfully
  expInfo['frameRate'] = psychoJS.window.getActualFrameRate();
  if (typeof expInfo['frameRate'] !== 'undefined')
    frameDur = 1.0 / Math.round(expInfo['frameRate']);
  else
    frameDur = 1.0 / 60.0; // couldn't get a reliable measure so guess
  // add info from the URL:
  util.addInfoFromUrl(expInfo);
  
  
  psychoJS.experiment.dataFileName = (("." + "/") + `data/${expInfo["participant"]}_${expName}_${expInfo["date"]}`);
  return Scheduler.Event.NEXT;
}
var init_resourcesClock;
var stim_file;
var resource_checker_pbClock;
var resource_checker_text;
var resource_pb_bg;
var resource_pb_fg;
var resource_download_completeClock;
var resource_download_complete_text;
var resource_download_complete_keys;
var show_imagesClock;
var show_image;
var never_ending_routineClock;
var never_ending_text;
var globalClock;
var routineTimer;
async function experimentInit() {
  // Initialize components for Routine "init_resources"
  init_resourcesClock = new util.Clock();
  if ((expInfo["group"] === "a")) {
      stim_file = "group_a_stim.csv";
  } else {
      if ((expInfo["group"] === "b")) {
          stim_file = "group_b_stim.csv";
      }
  }
  
  console.log("Stim file: " + stim_file)
  // Initialize components for Routine "resource_checker_pb"
  resource_checker_pbClock = new util.Clock();
  resource_checker_text = new visual.TextStim({
    win: psychoJS.window,
    name: 'resource_checker_text',
    text: 'Please wait; resources are still downloading.',
    font: 'Open Sans',
    units: undefined, 
    pos: [0, 0], height: 0.05,  wrapWidth: undefined, ori: 0.0,
    languageStyle: 'LTR',
    color: new util.Color('white'),  opacity: undefined,
    depth: 0.0 
  });
  
  resource_pb_bg = new visual.Rect ({
    win: psychoJS.window, name: 'resource_pb_bg', 
    width: [0.5, 0.02][0], height: [0.5, 0.02][1],
    ori: 0.0, pos: [0, (- 0.3)],
    anchor: 'center',
    lineWidth: 1.0, 
    colorSpace: 'rgb',
    lineColor: new util.Color('white'),
    fillColor: new util.Color('white'),
    opacity: undefined, depth: -2, interpolate: true,
  });
  
  resource_pb_fg = new visual.Rect ({
    win: psychoJS.window, name: 'resource_pb_fg', 
    width: [1.0, 1.0][0], height: [1.0, 1.0][1],
    ori: 0.0, pos: [(- 0.25), (- 0.3)],
    anchor: 'center-left',
    lineWidth: 1.0, 
    colorSpace: 'rgb',
    lineColor: new util.Color('white'),
    fillColor: new util.Color('blue'),
    opacity: undefined, depth: -3, interpolate: true,
  });
  
  // Initialize components for Routine "resource_download_complete"
  resource_download_completeClock = new util.Clock();
  resource_download_complete_text = new visual.TextStim({
    win: psychoJS.window,
    name: 'resource_download_complete_text',
    text: '',
    font: 'Open Sans',
    units: undefined, 
    pos: [0, 0], height: 0.05,  wrapWidth: undefined, ori: 0.0,
    languageStyle: 'LTR',
    color: new util.Color('white'),  opacity: undefined,
    depth: -1.0 
  });
  
  resource_download_complete_keys = new core.Keyboard({psychoJS: psychoJS, clock: new util.Clock(), waitForStart: true});
  
  // Initialize components for Routine "show_images"
  show_imagesClock = new util.Clock();
  show_image = new visual.ImageStim({
    win : psychoJS.window,
    name : 'show_image', units : undefined, 
    image : 'default.png', mask : undefined,
    anchor : 'center',
    ori : 0.0, pos : [0, 0], size : [0.5, 0.5],
    color : new util.Color([1,1,1]), opacity : undefined,
    flipHoriz : false, flipVert : false,
    texRes : 128.0, interpolate : true, depth : 0.0 
  });
  // Initialize components for Routine "never_ending_routine"
  never_ending_routineClock = new util.Clock();
  never_ending_text = new visual.TextStim({
    win: psychoJS.window,
    name: 'never_ending_text',
    text: "This routine never ends, so that Pavlovia doesn't consume a credit.\n\nPress escape to exit.",
    font: 'Open Sans',
    units: undefined, 
    pos: [0, 0], height: 0.05,  wrapWidth: undefined, ori: 0.0,
    languageStyle: 'LTR',
    color: new util.Color('white'),  opacity: undefined,
    depth: 0.0 
  });
  
  // Create some handy timers
  globalClock = new util.Clock();  // to track the time since experiment started
  routineTimer = new util.CountdownTimer();  // to track time remaining of each (non-slip) routine
  
  return Scheduler.Event.NEXT;
}


Can you update this script so instead selecting a or b, we can choose 1- 20 and load "observer_1.csv" to "observer_20.csv" instead of the section below:
async function experimentInit() {
  // Initialize components for Routine "init_resources"
  init_resourcesClock = new util.Clock();
  if ((expInfo["group"] === "a")) {
      stim_file = "group_a_stim.csv";
  } else {
      if ((expInfo["group"] === "b")) {
          stim_file = "group_b_stim.csv";
      }
  }