Skip to main content

πŸŽ“ Lesson 14: Variables β€” The Memory of Your Course

States gave your objects looks. Triggers gave them behavior. Now comes the third and final pillar of interactivity: variables β€” the way your course remembers things. A name the learner typed, how many items they've clicked, whether they passed. Once a course can remember, it can react, personalize, and gate β€” and that's where e-learning starts to feel alive. This is logic, not code, and you already think this way every day.

πŸ“š What You'll Learn

By the end of this lesson, you will be able to:

  • Explain what a variable is β€” a labeled container that remembers a value
  • Tell apart the three variable types: Text, Number, and True/False
  • Create a variable in Manage Project Variables, and set or adjust it with a trigger
  • Show a variable's value in text with the %VariableName% reference
  • Use a condition that reads a variable to gate what happens next

⏱️ Estimated Time: 45 minutes

🎯 Project: Build a slide that asks the learner's name, remembers it, and greets them by name on the next slide β€” then add a True/False "gate" that only lets them continue once they've done something. Windows only

In This Lesson

πŸ“¦ What Is a Variable?

A variable is a labeled container that holds a value your course can remember and change. Think of it as a sticky note stuck to the inside of your project. The note has a name you choose (LearnerName, Score, WatchedIntro) and a value written on it. At any moment your course can read the note, and a trigger can rub it out and write something new.

You use variables constantly in ordinary life without calling them that. The number on a scoreboard is a variable β€” it starts at 0 and changes as the game goes on. The name field on a form is a variable β€” empty until someone types into it. A light switch is a True/False variable β€” it's either on or off. Storyline just gives you a tidy place to keep those notes and a way to react to what they say.

🧠 Mindset

The word "variable" scares people because it sounds like programming. It isn't. You will never write a line of code in this lesson. A variable is just a thing your course remembers, and everything you do with it β€” set it, show it, check it β€” you do by clicking through the same friendly Trigger Wizard you already met in Lesson 13. If you can fill in "when X happens, remember Y," you can do this. You already can.

Here's why this is the third pillar and not an afterthought: without memory, every click is isolated. States change how one object looks right now. Triggers make one thing happen when the learner acts. But only a variable lets slide 8 know something that happened back on slide 2 β€” that the learner's name is Priya, that they've viewed all four tabs, that they scored 80. Memory is what turns a pile of slides into a course that responds to the person taking it.

πŸ”€ The Three Types: Text, Number, True/False

Storyline has exactly three kinds of variable, and choosing the right one is just a matter of asking "what am I remembering?" Each type is a different shape of sticky note.

Type Holds Great for… Example value
Text Words, letters, anything typed Names, answers, a chosen option Priya
Number Numbers you can count or do math on Scores, counts, progress, attempts 3
True/False A yes-or-no, on-or-off flag "Has this happened?" gates & switches True

A quick way to decide: if you'd write it with letters, use Text. If you'd add or count it, use Number. If the only sensible answers are yes or no, use True/False (often called a boolean, but "yes/no flag" is all you need to remember).

πŸ’‘ Built-in vs. your own variables

Storyline creates some variables for you automatically β€” for example, when you record a slide's narration or build a quiz, it quietly makes variables to track results and progress. Those are built-in variables. The ones you create yourself in Manage Project Variables are user variables. They behave identically; the only difference is who made them. You'll mostly work with your own, and lean on the built-in quiz ones in Lesson 18.

πŸ› οΈ Creating & Setting Variables

Working with a variable is a two-part rhythm you'll repeat forever: first create the container once, then set its value with triggers as the learner moves through the course.

Creating: Manage Project Variables

Every variable in your project lives in one place. In most versions you'll find it on the Triggers panel β€” there's a small variables icon (it looks like x=) that opens the Manage Project Variables window. From there you click the plus (+) to add one, give it a name (no spaces β€” LearnerName, not Learner Name), pick a type, and give it a sensible default value (the value it starts with β€” often blank text, 0, or False).

Setting: with a trigger

Once the container exists, you change what's in it using the triggers you learned in Lesson 13. Two actions do almost all the work:

  • Set variable β€” write a specific new value into the container (set LearnerName to what the learner typed; set WatchedIntro to True).
  • Adjust variable β€” change a Number by adding or subtracting (add 1 to ItemsViewed). Perfect for counting.

Figure 1 β€” Setting variables (a simplified mock-up, not a real screenshot): a data-entry field feeds a Text variable, and a click adjusts a counting Number.

πŸ’‘ The data-entry shortcut: When you insert a text-entry field or numeric-entry field from the Insert tab, Storyline automatically creates a variable for it and wires up the "set variable to what the user typed" trigger for you. So a name box gives you a TextEntry variable with no manual setup β€” you can rename it to LearnerName and you're ready to use it.

🏷️ Showing a Value with %VariableName%

Remembering a value is only half the fun β€” you'll usually want to show it. Storyline has a delightfully simple rule for this: wrap a variable's name in percent signs inside any text box, and it displays the current value.

Type this into a text box on the stage:

Welcome back, %LearnerName%! You've viewed %ItemsViewed% of 4.

…and at runtime the learner sees "Welcome back, Priya! You've viewed 3 of 4." The %LearnerName% and %ItemsViewed% tokens are references β€” live placeholders that Storyline swaps for the real value whenever the slide displays. Change the variable later and the text updates automatically the next time it's shown. That's how you greet people by name, echo their answer back to them, or show a running score.

⚠️ Watch the details

References are case-sensitive and must match the variable name exactly: %LearnerName% works, %learnername% shows nothing. Both percent signs are required. And a reference only refreshes when the slide (or layer) that contains it appears β€” if you change a variable while its text is already on screen, revisit or re-show that content to see the new value.

πŸ”€ Conditions: Reading a Variable to Decide

Here's where memory becomes intelligence. Back in Lesson 13 you learned a trigger can have an optional condition β€” an "only if" test. A condition's favorite thing to test is a variable. That's how your course makes decisions:

  • Jump to the "Passed" slide β€” only if Score is greater than or equal to 80.
  • Show the "Complete" layer β€” only if ItemsViewed is equal to 4.
  • Enable the Continue button β€” only if WatchedIntro is equal to True.

Notice the pattern: the trigger sets or adjusts a variable when the learner acts, and a separate trigger reads that variable in a condition to decide what happens. One writes the note; the other reads it. That two-step is the beating heart of every gate, every branch, and every personalized moment you'll ever build.

βœ… The gate recipe you'll use again and again

To require the learner to do something before continuing: (1) make a True/False variable that starts False; (2) a trigger sets it to True when they do the thing; (3) the Continue button's "jump" trigger carries a condition β€” only if that variable is True. If it's still False, the click does nothing (or you show a "not yet!" nudge). Simple, and it scales to any complexity.

🧩 The Three Pillars, Together

You've now met all three pillars of Storyline interactivity. They're not separate tricks β€” they're a team, and almost every interaction you'll build combines them. Here's how they hand off to one another:

graph TD A["πŸ–±οΈ Learner acts
(clicks, types, drags)"] --> B["⚑ Trigger fires
Action + Event"] B --> C["πŸ“¦ Variable changes
set / adjust the value"] B --> D["🎭 State changes
the object's look updates"] C --> E["πŸ”€ Condition reads the variable
only if the value matches"] E --> F["🎬 Something happens
gate opens, layer shows, jump"] D --> F style A fill:#bfdbfe,color:#1e293b style B fill:#fed7aa,color:#1e293b style C fill:#fde68a,color:#1e293b style D fill:#c7d2fe,color:#1e293b style E fill:#bbf7d0,color:#1e293b style F fill:#f1f5f9,color:#1e293b

Figure 2 β€” How states, triggers, and variables work as a team: the learner acts, a trigger responds, memory updates, and a condition decides what happens next.

Read the flow as a sentence: the learner does something, a trigger notices and updates a variable (and maybe a state), then later a condition checks that variable and decides what happens. Every custom interaction in this course β€” and in the professional courses you'll build after it β€” is some arrangement of exactly this loop. In the very next lesson you'll wire all three together into one complete interaction.

🎯 Try It: Greet by Name & Gate

πŸ‹οΈ Activity: Make your course remember the learner Windows only

Objective: Capture the learner's name into a Text variable, greet them by name on the next slide, and add a True/False gate that only lets them continue after they've clicked a button. This is a hands-on Storyline task β€” you'll need the Storyline 360 desktop app on Windows (or a Windows VM), on the trial or a plan. Trial / Paid

Steps

  1. Create a new project with two slides. On slide 1, from the Insert tab, add a text-entry field and a short prompt like "What should we call you?" (⏱️ 4 min)
  2. Open Manage Project Variables (the x= icon on the Triggers panel). You'll see the entry field's auto-made Text variable β€” rename it to LearnerName. (⏱️ 3 min)
  3. Add a Continue button to slide 1 with a trigger: jump to next slide when the user clicks Continue. (⏱️ 3 min)
  4. On slide 2, add a text box that reads Welcome, %LearnerName%! β€” preview and watch it greet you by whatever you typed. (⏱️ 4 min)
  5. Now the gate: create a True/False variable ReadPolicy with a default of False. Add a button "I've read the policy" that sets ReadPolicy to True when clicked. (⏱️ 5 min)
  6. Give slide 2's Continue button a condition: jump to next slide when clicked, only if ReadPolicy is equal to True. Preview: the button should do nothing until you click "I've read the policy" first. (⏱️ 6 min)
πŸ’‘ Hint

If your greeting shows nothing, check the reference spelling and capitals β€” %LearnerName% must match the variable name exactly, percent signs and all. If the gate never opens, confirm the "set ReadPolicy to True" trigger is really firing (it must be on the correct button, on the "user clicks" event), and that your condition compares to True, not the word "true" typed into a text field.

βœ… Activity Complete When…

  • Slide 2 greets you by the exact name you typed on slide 1
  • You created both a Text variable and a True/False variable in Manage Project Variables
  • The final Continue button refuses to advance until ReadPolicy is True

🎯 Quick Quiz

Question 1: You want to remember whether the learner has watched the intro video β€” a simple yes-or-no. Which variable type fits best?

Question 2: How do you display a variable's current value inside a text box on the stage?

πŸ““ Learning Journal

Keep building your Learning Journal β€” it's where "I read that" becomes "I can do that." After this lesson, jot down:

  • Key concepts you learned
  • Things that clicked for you
  • Questions or confusion points to revisit
  • Ideas you want to try
  • Your progress and how you feel about learning this

✍️ This lesson's prompt: Think about the course you want to build for your capstone. Name one thing it could usefully remember about the learner β€” their name, a score, a choice they made, whether they've completed a step β€” and write which of the three variable types you'd use and one place that memory would change what the learner sees.

πŸ“ Lesson Summary

πŸŽ“ Key Takeaways

  • A variable is a labeled container that remembers a value your course can read and change β€” it's the third pillar of interactivity, and it's logic, not code.
  • There are three types: Text (words), Number (counts & math), and True/False (yes-no flags). Storyline also makes built-in variables for quizzes and media.
  • Create variables in Manage Project Variables; change them with Set variable and Adjust variable triggers; show them in text with %VariableName%.
  • A condition that reads a variable lets your course decide β€” the write-then-read loop is how you gate, branch, and personalize.

πŸŽ‰ What You've Accomplished

You've completed the trio. States, triggers, and now variables β€” the three pillars every Storyline interaction stands on. You can make your course remember a name and say it back, count how many things a learner has done, and refuse to move on until they've earned it. That's not a small skill; it's the exact capability that separates a slideshow from real interactive e-learning.

❓ Common Questions at This Stage

Do variables reset when the learner leaves or comes back?

Within a single run of the course, variables hold their values as the learner moves around. If they close the course and reopen it, whether progress is remembered depends on the LMS and resume settings (we touch on tracking in Lesson 20). For most interactions you build, "remembers during this session" is exactly what you want.

Isn't this basically programming? I'm not a coder.

You don't write any code here β€” you click through the Trigger Wizard and pick from menus. It's true that setting a value and checking it with a condition is the same kind of thinking programmers use, and that's a compliment to you, not a barrier. If you can plan a gate as "remember they clicked it, then only continue if they did," you're already doing the hard part.

My %reference% shows the name in percent signs instead of a value. Why?

Almost always a spelling or capitalization mismatch, or a missing percent sign. The text inside the percents must match the variable's name exactly. Open Manage Project Variables, copy the name precisely, and paste it between the two % signs.

πŸ”­ Looking Ahead

In Lesson 15, you'll bring all three pillars together and build a complete custom interaction end-to-end β€” using layers, buttons, and hotspots to make a "click each item to reveal info, then unlock Continue when all four are seen" experience. This is the lesson where it all clicks.

βœ… Before the Next Lesson

  • Finish the "greet by name & gate" activity β€” the gate recipe is the star of Lesson 15
  • Write this lesson's journal prompt about what your capstone course should remember
  • Peek at your Manage Project Variables list and notice any built-in variables already there

πŸ“š Additional Resources

🌟 Encouragement for the Journey

The moment your course first greeted you by name, something shifted β€” it stopped being a document and became a conversation. That's the power of memory, and you just gave it to your course. Every expert Storyline developer started with exactly this "hello, %Name%" moment. You're one of them now.