Branched Scenarios...Do I need Variables?
October 21, 2008 12:00 AM
Variables are an easy way of doing this, and once you get familiar with them, you'll probably find them a breeze to use. The hard part is becoming accustomed to how they work. It's not entirely intuitive, so I can understand your reluctance. I suggest a strong naming convention, both for variables and for pages. You may want to organize your pages into sections or chapters, depending on how your scenario is laid out. But, if you name your pages something like 01-02, then your variables can match the page numbers. So, your choices could have variable names of 0102A, 0102B, etc. Set all your variables to 0. You could set them to "No," but it is understood in programming that 0 is a way to say "No" (with 1 being "Yes"). Since all new variables have a default value of 0, I prefer this option, as it's less work. When a choice button is pressed, then define an action to set that value to 1. So, on the first page, 0101A = 1 if the user clicks on choice A. If the user clicks on B, then obviously 0101B = 1 instead. On each page, you'll want to set an action to hide each button when the page shows. The button hides only if the associated variable = 1. So, the first time the user goes to page 01-01, then choices A and B are visible, because 0101A = 0 and 0101B = 0. When choice A is clicked and the user comes back to the page, then choice A is hidden because 0101A = 1. Only choice B is viable.This can cause problems, though. If you only have two choices, and the user comes back to the page for a second time, then both choices will be hidden. The user is stuck!Instead of hiding a choice, I would suggest showing a different color button (or showing a colored outline). Give the user the opportunity to click on the wrong button but make it clear that the button was the wrong choice. This can be done easily enough. Make your "unvisited" buttons initally visible but also create "visited" buttons that are on top of the "unvisited" buttons. The "visited" buttons are not initially visible. Then, when the page shows, you Show each of the "visited" buttons if the associated variable = 1. Using that example, you automatically see the choices for 01-01A and 01-01B. But if the learner already clicked on B before, then when he returns to this page, the code recognizes that 0101B = 1 and Shows the "visited" version of 01-01B. I hope that makes sense.Kevin
Discussions have been disabled for this post