referring to PCIbex code in separate files

PennController for IBEX Forums Support referring to PCIbex code in separate files

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #7953
    bgardner
    Participant

    Is there a way to create trials in a different script file, then refer to them from main.js? Ideally, I’d like to create separate files for pieces that stay the same for every experiment (e.g. my demographics form), so I can keep my main script a manageable length. From what I understand/have tried, there’s Function element or adding a file to the Modules section, but those are for creating new functions in actual javascript. But I don’t want (/don’t know how) to add something new via javascript; I’m just trying to keep my main PCIbex script from being a 2000-line monstrosity.

    #7956
    Jeremy
    Keymaster

    Hi,

    Just create another .js script under Scripts, and start coding there. When the experiment is run, the files in Scripts are concatenated into a single .js file, in an alpha-numeric order, ie. the content of main.js will come after the content of abc.js, so place PennController.ResetPrefix(null) at the top of the first script file (or at the top of all script files would work too)

    It doesn’t matter which file your Sequence command is in, it will see all the trials you create from all the .js files in Scripts

    Jeremy

    #7968
    bgardner
    Participant

    Oh this is so much more straightforward that I thought, thanks!!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.