CommandSim State Manager (CS State Manager)
So far presented, the tools let you mock up a single visual with a variety of smoke and fire conditions. However, in practice, you often need the ability to look at a scene from various views to determine the appropriate course of action.
If you are only creating a single view, you only need to use CS Transition -- the CS State Manager persistance does not help you.
The CS State Manager lets you group a set of conditions into what we call a "state". With that group, you can invoke all those changes at once. You can already do this with CS Transition by using the same trigger (pressing 1, for example). However, if you were to show a new visual (file), such as from different sides of a building, you cannot use CS Transition to preserve the condition in the new visual. The CS State Manager lets you preserve the condition as you move from one file to another.
This is easiest to demonstrate by example. Look at the picture below. We have mocked-up two sides of a building (sides A and B), which show smoke coming out of side C (rear). We have defined three states: no fire, smoke showing, and fully-involved. You invoke the states by pressing 0, 1, or 2, respectively (you can assign arbitrary keystrokes or timing).
Click on the arrow to start. In the side A (front) view, you can see light smoke from the rear of the building. If you press the 0 key, the smoke will disappear. If you press 2, it will get worse (black). You can press 0, 1, or 2 as much as you would like. If you press the arrow key to move to side B, you will see that the smoke conditions are similar on side B. On side B, you can also press 0, 1, or 2 to change the conditions, and when you move back to side A, the conditions will persist. These examples are in the Samples folder in the distribution, under the folder State Examples.
Using CS State Manager
To help sort out where to start in the overall task of scenario creation, we developed a process described in the section titled "Scenario Creation Process." Part of the process is to define the number of states you will have, and then using one CS State Manager for each state in each file.
The CS State Manager component is located in the CommandSim folder in the Components panel (Window > Components). Drag a CSStateManager token onto the stage. On the Stage, the CS State Manager will be represented by an orange box with black text inside (below, left).
When you select the CS State Manager instance and open the Component Inspector, you will see the CS State Manager interface (above, right). The options are:
- IDENTIFIER: What you type in this box is placed in the box on the Stage to help you locate which state manager manages which state. If you leave the box empty, by default CS State Manager will write "Stage Change <State: <state number indicated>>" in the box, as shown.
- STATE NUMBER: Which state number this represents. Typically, the state number is an positive number, however, you can put whatever text you like here (no spaces or punctuation). You will put this state number (or text) into the state box in the CS Transition interface, for transitions you want to associate with this state.
- MAKE THIS START STATE: If this box is checked, then the CS State Manager sets the state of the simulation to the specified state number when your movie starts. As the Scenario Creation Process explains, you should use this once in the beginning of your simulation to reset the state to a predictable state. If you do not, whenever you start your simulation you will encounter whatever state was last set when you ran your simulation, even if that state was set hours, days, or weeks ago.
- TRIGGER STATE CHANGE ON:
You decide how the user will trigger the state change. The options are by keystroke (single character, or special character such as the arrow keys, page up/down, delete, etc.), by button press, and by time.
- Keystroke: You select the keystroke that will invoke this state change. If you want to use an alphabetic character or number, select "Type key in box" from the drop-down menu, and type in the (single) character in the adjoining box. If you want to use a special character (Left/Right/Up/Down arrow, Enter, Space, Tab, Delete, Page Up, Page Down), select the character from the drop-down menu. Make sure that Keystroke is selected (the radio button to the left of the word Keystroke should be clicked on).
By default, the keystroke you use will invoke the state change every time you press the key. If you want the change only to be invoked on a certain number of presses, type the number of presses in the box next to the label "wait for". You might want to do this if you decide to use the same key to increase or decrease the state, for example, Up arrow to increase the state and Down arrow to decrease the state. However, once you press the key the specified number of times, that state cannot be triggered again unless you restart the simulation or use a CS Transition and specify RESET for the CS State Manager instance.
- Button Press: You can make the state change when you click on a Flash button or movie clip. To do so, enter the instance name of the button or movie clip in the adjoining box. Make sure that Button Press is selected (the radio button to the left of the word Button Press should be clicked on).
By default, pressing the button will invoke the state change every time you press the button. If you want the change only to be invoked on a certain number of presses, type the number of presses in the box above Button Press and next to the label "wait for". You might want to do this if you decide to use the same button to increase or decrease the state. However, once you press the button the specified number of times, that state cannot be triggered again unless you restart the simulation or use a CS Transition and specify RESET for the CS State Manager instance.
- Time: To make the state change automatically after a certain number of seconds, enter the number of seconds in the box adjoining the word Time. Make sure that Time is selected (the radio button to the left of the word Time should be clicked on). The state change will occur after the number of seconds you indicate has elapsed. Once the time has elapsed, that state cannot be triggered again unless you restart the simulation or use a CS Transition and specify RESET for the CS State Manager instance. If you have MAKE THIS START STATE checked, the time is ignored and the state is changed when the movie starts.
Once the time has elapsed and the change has occured, that state cannot be triggered again unless you restart the simulation or use a CS Transition and specify RESET for the CS State Manager instance.