Support Home Scripting Types Reference

Types Reference

  • Overview
  • Types
  • ResponseType
  • Response
  • ProcessedResponse

Overview


This page details all the fields in the various data structures that Gorilla uses. Most of the time, these types are passed through to Lifecycle Methods that you are implementing - this guide shows you what properties these structures will have.

Use the menu on the left to browse the full list of types that Gorilla exposes to you.

ResponseType

This is an enumeration of different response types used by Gorilla:

enum ResponseType {
    Response,
    TimedOut,
    Continue,
    Action,
    TooEarly,
    Info
}

Response

This is for actual responses - ideally, your scientific data would just be the Response type metrics with everything else filtered out. Use this for key measures that are likely to be used for primary analysis.

TimedOut

This is used for when the screen times out (usually because a time limit is reached). This might also be used for the 'NoGo' response when implementing Go/NoGo paradigms

Continue

This is reserved for responses which simply advance the screen (e.g. when a continue button is pressed)

Action

This is used for responses which aren't key scientific responses, but other actions by the participant. For example, in tasks that use compound responses such as Digit Spans or Trail Making, the final entered sequence would be a full Response, but the individual presses would be Actions. These do not advance the screen by default.

TooEarly

This is for responses which happen too early (because they were received before the response window was open). These do not advance the screen by default.

Info

This is for events that happen that aren't triggered directly by the participant (e.g. an audio sample started playing). These do not advance the screen by default.


Response

When triggering a response, you can pass the following fields to describe the response:

type Response = {
    responseType: ResponseType;
    response: string;
    tag: string;
    key: string;
    onsetTime: number;
}

Fields

responseType

Should be one of ResponseType

response

The actual response that was given

tag

The response tag for this response

onsetTime

The time, in ms, since the start of the screen when this response started being given (this is used for elements such as text input boxes, where the participant starts interacting with the element some time before the response is actually captured)


ProcessedResponse

When a response is first received, its properties are copied over into a more expansive ProcessedResponse object and some extra properties are calculated automatically. The extra fields are:

type ProcessedResponse = Response & {
    reactionTime: number;
    responseDuration: number;
    correct: boolean;
    componentName: string,
    entityName: string;
    entityUID: string;
    triggeringEntity: Entity;
    shouldAdvance: boolean;
    shouldFinish: boolean;
}

Fields

All the fields in a Response, plus:

reactionTime

The time, in ms, since the start of the screen

responseDuration

The time, in ms, that it took for the participant to perform the response. This only applies for elements such as text input boxes, where the participant takes an amount of time to perform the input

correct

Whether the response was considered correct or incorrect

entityName

The name of the object that triggered this response

entityUID

The UID of the object that triggered this response

triggeringEntity

A reference to the object that triggered this response

shouldAdvance

Whether this response should advance the screen

shouldFinish

Whether this response should finish the task