Skip to content

Experiment Block

Tip

For any page in the reference section of the manual, we recommend you to check out the examples at the bottom of every page. These will often give you a better overview of how a particular block can be used. If you click the pencil-in-square icon next to the example, you can even try it out yourself in the Live Editor.

The idea behind the ROLEG DSL is that it allows researchers to create a variety of different experiments by choosing, adjusting and combining simple ‘building blocks’ of code. Every ROLEG experiment has one experiment block at the top level (i.e. no indentation). This experiment block is a container for the building blocks of the experiment.

This structure of the experiment block is summarised below. The block elements are executed in the order in which they are specified and may each occur more than once.

Parameters

fullscreen
Optional, defaults to false.
Boolean that specifies whether the experiment should be run fullscreen. If set to true, the participant is first shown a dialog "The experiment will launch in fullscreen mode when you click the button below." along with the button "Launch Experiment", localised to the experiment language. Upon clicking this button, the browser window enters fullscreen mode and the experiment resumes.
Warning

Be aware the participant can manually exit fullscreen mode anytime as they remain in control of their browser. Also, some browsers may close the fullscreen mode automatically when the permission dialog for audio recording in a speech block is presented. To account for this possibility, you can inform your participants that, when having exited fullscreen mode, they can return to fullscreen mode by pressing F11 on Windows computers or Ctrl+Cmd+F on macOS, or by using their browser's menu.

Members

trial / t
Optional.
trial block that manages a trial and offers interaction between stimuli and responses.
selfpacedreading / spr
Optional.
selfpacedreading block that presents a self-paced reading task to the participant.
include
Optional.
List of Strings specifying the filenames of the include files to use here. See include files for more information.
define_template
Optional.
define_template block that can be defined at the top of the experiment block, to efficiently specify further trials.
font
Optional.
font block that specifies the font used for the trials that follow.
errortext
Optional.
errortext block that specifies the error texts used for the trials that follow.

Shorthands

The ROLEG DSL offers a couple of shorthands to make life easier and type no more code than necessary. These shorthands are specific blocks that can be used instead of writing out the entire code they represent. Using shorthands makes it easier to structure your experiment, as well as providing a clearer overview of everything in your experiment file.

The shorthands that are currently available within the experiment block are as follows.

text

String. This shorthand creates a trial with a text stimulus and a button response. The text parameter of the text block is determined by the specified String. and a button response uses its default, localised text.

Example: text = "The first part will now start"

pause

Integer. This shorthand creates a trial with no stimulus or response. The max_duration of the trial is determined by the specified Integer.

Example: pause = 5000

fixation

Integer. This shorthand creates a trial with a text stimulus and no response. The text parameter of the text block is set to the '+' character. The max_duration of the trial is determined by the specified Integer.

Example: fixation = 5000

Example usage

The code below illustrates how a shorthand in the experiment block might be used.

experiment { 

    text = "Welcome to this experiment."

    // The above shorthand can also be expressed using the full syntax
    trial {
        stimulus {
            text = "We will start with instructing you on the coming task."
        } 
        response {
            button
        }
    }
}
Back to top