Conditional Variables Help!

Apr 14, 2023

I'm relatively new to Storyline. I'm using the program to build an "escape room style" learning game where users navigate around different areas (slides) and find pieces of a hidden key. 

So here's my question. I want the key pieces to show up in an inventory box on a particular slide once they are found and clicked on on a different slide. Is this possible? What variables/conditions do I need to set to make this happen?

Another difficulty I'm having is hiding the pieces once they have been found for the first time. For example, a user finds and clicks on key piece #1. I have the trigger set to HIDE that piece once it's clicked on, but if a player exits that slide and returns, the key piece shows up again. How can I make the key piece hidden for good once it's been clicked on for the first time? 

Thank you!

1 Reply
Robert Stryker

Hi Jenna,
The bottom line is both of these issues can be handled with Storyline. Whether I can do each one justice by describing it is another matter. Giving it a go as follows:

  1. Create a meaningful project variable name for each room item. I'm just going to go with a phone. So, name the variable something like "phoneClicked" and make the default value "false."
  2. When the item is clicked, create a trigger that changes "phoneClicked" to "true." It sounds like you may want the item to disappear at this moment too? If so, add a trigger that makes the item hidden when clicked.
  3. On your inventory slide: create a two-state phone icon using the States tab. Set the initial state of the phone icon as hidden.
  4. Add a trigger to the inventory slide that changes the state of the phone icon to normal when the timeline starts on this slide, IF the variable "phoneClicked" equals "true."
    If participants are going to return multiple times to this slide, you probably want to set the slide to "reset to initial state."

That should do it from a directional standpoint. Your mileage may vary!

For your second issue. There are two ways that may solve reappearing image. One is to set the slide to "resume saved state." That is the simplest approach but can have unforeseen consequences.

The other is to set the slide to "reset to initial state" and include slide triggers that work like the four-step process described above --using variables to determine if an object is shown or hidden.

There are numerous details that will be inherent to your design that may support or hinder these steps, but I hope this helps!

Bob