OLI Dynamic Questions

OLI Dynamic Questions

  • Docs
  • API
  • Examples
  • Help

›Writing Scripts

Getting Started

  • Overview
  • Requirements

Creating Questions

  • Workflow
  • Referencing Variables

Writing Scripts

  • Script Basics
  • Built-In Functions
  • Third-Party Libraries

Built-In Functions

Question scripts often have similar needs for functions that perform common operations such as conversions, random number generation, etc. OLI provides a set of built-in functions for these common operations. These functions can be accessed by using the OLI module within scripts.

For example:

const myRandomInt = OLI.randomInt(0, 10);

Here the OLI.randomInt will generate a random integer between 0 and 10 and store it in the variable myRandomInt.

Explicit import of this module is not necessary, it is available in every script by default.

Full documentation for the OLI module is available in the API docs.

← Script BasicsThird-Party Libraries →
OLI Dynamic Questions
Docs
Getting StartedWriting Scripts
Community
Course Showcase (Coming soon)OLI Slack
More
OLIOLI Course EditorGitHubStar
Copyright © 2025 Carnegie Mellon University