Variables and triggers seemingly not working properly

Sep 24, 2021

I have had numerous issues with variables and triggers working properly in the past - some were mistakes on my part found later and others are still unknown and I had to come up with alternate uses to accomplish my goal.

Today, however, I cannot find an alternate route and cannot get the variables and triggers to work.

I have created a Battleship-esque game to test the trainees' trivia. For every question they get correct, 4 "clicks" goes toward the variable %clicksallowed%.

After all the questions are answered, the available "clicks" are shown on screen. Each click they perform to find and hit the ships are subtracted from the %clicksallowed% variable. I also have a click counter to show how many clicks they have made.

There are 6 different "opponents" (different arrangements of ships on the board), and I have filled in the triggers on one opponent (Skylar) to add 1 to %clicks% and subtract 1 from %clicksallowed%. 

However, when I test the game (preview entire project), after I answer the questions and get to any of the opponents, the %clicksallowed% variable shows 0, even after answering questions correctly.

Do I need to complete the triggers for all opponents before it will show (doesn't seem likely)? Am I missing an element to bring it all together (seems more likely)? Can there be too many variables/triggers that breaks Storyline?

5 Replies
Maria Costa-Stienstra

Hi, Martin.

Thank you for sharing your .story file!

I noticed you had a question bank, and on each of the correct layers, you added points to the variable clicksallowed, as you described. However, the trigger to add points to the variable should be the first on the list, as the order of triggers is very important. 

I am not sure where those questions will be asked in your project, as there was no draw from the question bank (question slides were not created), but on slide 1.2, you have a trigger to set the clicksallowed to 0. If the questions are asked before slide 1.2, then the clicksallowed gained will not be shown. 

I hope this helps!

Martin Maynard

Thank you, Maria. I have gotten the issue fixed, but in a different way. On the question bank slides, I had the trigger set to add points to the %clicksallowed% when the user clicked the continue button on the success screen. I changed it to add the points when the timeline on the layer started, instead of based on a user action, which now allows the points to actually add in to the variable. This also jumped the add function to the top of the trigger panel, so I inadvertently did as you recommended, just for went in the backway to do it!! 

It all works now and the project is complete.