Trainerflow Docs trainerflow.com
Core elements › Action

Core elements

Action

Something the athlete can perform, like a back squat or a run, which specifications are attached to.

An Action is one of the core elements of the Coach language. It represents something that can be acted upon, for example a BarbellBackSquat or a Run.

An action does nothing by itself. It is the thing that specifications are about: “do 5 reps of this”.

Definition

To define an action you need the keyword action, a name and a list of properties in square brackets (the list may be empty):

action BackSquat [title: "Back squat"]
action Run []

The name has to start with a letter and may contain letters, digits, _ and ?. The Trainerflow convention is to use a capitalized (PascalCase) name for actions.

Properties

The properties customize how the action is presented to the athlete, in the simulator and on the mobile app.

Property What it does
title The name the athlete sees. Without it, the athlete sees the action’s name as written in the code.
description A longer explanation shown under the title.
video_url A link to a video of the exercise, shown as Exercise video.
action BackSquat [
    title: "Back squat",
    description: "Bar on the upper back, squat below parallel.",
    video_url: "https://example.com/back-squat"
]

You may add any other property you like. The apps ignore properties they do not know about, but they are still part of the action, so your own program can use them to describe an action in more detail.

Inheritance

An action can be derived from another one with <. The new action starts with all the properties of its parent and then adds its own; when both define the same property, the new action’s value wins.

action BackSquat [title: "Back squat", description: "Bar on the upper back."]
action PauseSquat < BackSquat [title: "Pause squat", pause: true]

Here PauseSquat has the title Pause squat, the description of BackSquat and an extra pause property.

This is how the standard library names its exercises. A library declares a general action such as BarbellBenchPress and each call derives a local one from it, with a title that says exactly what this set is, e.g. Close Grip Bench Press. Because the properties can be expressions, an action declared inside an exec can take its title from a parameter:

action BackSquat [title: "Back squat"]
output:number reps []

exec squat(title) {
    action Squat < BackSquat [title: title]
    specify:Squat reps 5
}

squat("Heavy back squat")

Usage

See the specify command.