Introduction to Script Blocks

Script blocks are powerful elements that bring interactivity to your stories. Unlike traditional storytelling where the text remains static, script blocks allow your story to respond dynamically to readers' choices and keep track of important information.

Here is an example of some script blocks, as shown in the Quickstart:

choice
go to
if
then
if
then
else
<
>
=
+
-
*
/

How Script Blocks Work

Script blocks can be seamlessly integrated into your story's text, just like you would add images or other media. They come in two main types:

  1. Block Elements

    • Work similar to paragraphs
    • Take up their own line in the editor
    • Examples include condition checks and choices
  2. Inline Elements

    • Can be placed within text, like emojis
    • Flow naturally with your writing
    • Used for displaying variables and other actions that shouldn't require a separate paragraph

Nesting and Content

One of the most powerful features of script blocks is their ability to contain other content. Blocks like conditionals (if blocks) and choices can hold:

  • Regular text
  • Images and media
  • Other script blocks
  • Any combination of the above

This nesting capability allows you to create complex narratives with dynamic content that appears based on specific conditions or choices.

What's Next?

In the next section, we'll explore conditional blocks - your first step into making your story respond dynamically to readers' choices and actions. You'll learn how to show or hide content based on various conditions, opening up exciting possibilities for your interactive stories.