The PsyToolkit Experiment script is an important part of PsyToolkit (not to be confused with the survey scripts). The experiment script tells the computer exactly when and how to show stimuli, how to measure responses, and how to write the data to a data file.

Experiment scripting is like computer programming. You can only learn it by doing, looking at examples, and by being patient. In the end, it is much more flexible and easier to use than point-and-click programmes. In the beginning, it can look much more difficult, though.

Definition of a script

A script is essentially a simple text document. It contains all information it needs to run an experiment. When you use PsyToolkit in the browser, the script will be shown in a textbox (see image below). Just like in a regular text editor, you can save the file. If you work using the browser, the file will actually be saved on the PsyToolkit server, and you can access the file anywhere in the world.
Example script
If you work offline using Linux, you can edit your scriptfile in a text editor, such as gedit or kate or emacs.

Typical steps in making an experiment

You will go through a number of steps. PsyToolkit comes into play after step 2 below.

  1. Design your experiment on paper.

    • Think about the experimental conditions you have

    • Think about the instructions and the stimuli there are

    • Write the events that happen in your experiment (when and how should they happen, what is expected from participants, etc)

  2. Create the stimuli as bitmaps and/or audio files

    • It is recommended that you create stimuli as image files (e.g., png, bmp, jpg format). Recommended software is www.inkscape.org

  3. Write the PsyToolkit code. Usually, each line in PsyToolkit corresponds to an event in the previous steps. The code can be written within a browser or in a text editor. The PsyToolkit code is just a text file combined with the stimulus files.

  4. Compile the PsyToolkit code into a runnable experiment. If you compile on a Linux computer, you can run the code on a local computer and even use special external hardware, such as Cedrus keyboards. If you compile in a browser, you can run the code within a browser and even ask people to participate online.