LESSON 1:  Variables, Parameters, Attributes and Constants

Variables (continued)

To give you an idea of when and how to use Local Variables, let's look at the next figure, which is part of the "play" behavior from the slot machine. As you can see, the fun values are stored in local variables. The fun is a one time shot, and will not "stick". So you put them into a variable.


Fig. 1.1

Temporary Storage:  This is a very useful variable. It's availble to all BHAVs in the object, and even to other objects. The only drawback is that once you exit the game, all data stored in a Temporary Storage container disappears and the original values are returned. A good example is when a Sim picks up something to carry — like a plate to the dishwasher. There are no boxes to update, so you need to make sure you keep track of what variable is stored in which Temporary Storage area.


Fig. 1.2

Parameters

Parameters:  Parameters are not variables. They are bits of information that are passed to the behavior when run as a statement or a private. Another way to regard them is bits of information used to tell the object how to behave. You've seen them often enough. When you look at the Data Box for a statement within a behavior, the numbers in the boxes Parameters 1 through 4, thats bits of information being passed as parameters/boundaries.