Action Reference

A guide to actions you can insert into your scenes.

Audio

The audio action plays an audio file, which you load via the src property. mp3 is the recommended format for Choicelab.

  • src: required Path to an audio file, stored in your story folder.
  • alt: Text describing the audio for closed captions.
[audio src="media/path_explainer_02.mp3" alt="You're standing on the beach..."]

CSS Beat

Targets an onscreen element, letting you add or remove classes. Useful for animating elements — like text or images — using CSS.

  • selector: required The element to change. You can use any CSS selector, but if the selector applies to multiple elements, only the first element will be selected.
  • addClass: Classes to add. Separate classes with spaces.
  • removeClass: Classes to remove. Separate classes with spaces.
[beat selector="h1.big" addClass="color-blue" removeClass="color-red"]

Continue Button

A continue button holds the current scene until pressed, at which point the scene will end. Continue buttons are automatically inserted into text-only scenes that don't feature any timing.

  • text: Text for the button. Defaults to "Continue" if unspecified.
[continue text="And then..."]

Event

Creates a custom event that can be listened to in an external script. See Custom events for more details.

  • name: required The name of the event.
[event name="myCustomEvent"]

Image

The image action loads an image file, which you specify via the src property. Most file types are supported, but JPEG or PNG are recommended.

  • src: required Path to an image file, stored in your story folder.
  • alt: Text describing the image for closed captions.
[image src="images/door.jpg" alt="The door in front of you."]

Response Audio

The response audio action can play an audio file after a player presses a certain button. You can specify multiple response audio actions, corresponding to different buttons. As with the audio action, mp3 files are recommended.

  • value: The value of the corresponding input button.
  • src: required Path to an audio file.
  • alt: Alternate text for the audio, which will appear automatically in closed captions.

~~

You wake up with a spring in your step. It's a new day, and you're gonna seize it.

What do you do first?

[whatFirst?]
> Make some coffee. [coffee]
> Go outside and take in the fresh air. [outside]

[response value="coffee" src="media/scene1-coffee.mp3" alt="Sound of footsteps, then pouring coffee"]

[response value="outside" src="media/scene1-nice.mp3" alt="Sound of a door opening, and birds chirping"]

Video

The video action plays a video file, which you load via the src property. mp4 files are recommended.

  • src: required Path to a video file.
  • alt: Alternate text for the video, which will appear automatically in closed captions.
[video src="media/space-art.mp4"]