# Model Behaviors Parameters Within the model behaviors XML you will be using many **parameters**. In the context of the behavior XML a parameter is used to store a value that you will want to use later in some function or element. They are created within some specific scopes defined by the following nodes: 1. [``](../general-template-xml-properties/#Parameters) 2. [``](../general-template-xml-properties/#UseParametersFn) 3. [``](../general-template-xml-properties/#UseTemplate) 4. [``](../general-template-xml-properties/#UseInputEvent) 5. [``](../general-template-xml-properties/#ReturnParameters) 6. [``](../general-template-xml-properties/#saveparams)   Components essentially push a scope on the stack of parameters, and parameters defined within a component will be valid for the whole parsing of the elements defined in the same scope or below. Parameters are a fundamental part of using model behaviors, and at their most basic they consist of an **identifier** and a **value**. An identifier can only consist of a combination of the following characters: - `0` to `9` - `A` to `Z` and `a` to `z` - `_` and `-` for example: ``` xml A parameter value ``` The value of a parameter can be anything *as long as it is written with ASCii characters*, however it should be noted that the value of parameters have to follow the strict XML restrictions, which means that some characters have to be escaped:   {{< table-wrapper >}} | Character | Escaped character | |----------------------|-------------------| | `>` *(greater-than)* | `>` or `>` | | `<` *(less-than)* | `<` or `<` | | `&` *(ampersand)* | `&` | {{< /table-wrapper >}}   Once defined a parameter can be used in the scope it was defined in, and referencing a parameter value is done using the `#` symbol, as shown in this example: ``` xml Hello #A_PARAMETER#, world! ```   Note, however, that you cannot use a parameter in the same node that it was defined in, for example, this would give an error: ``` xml Hello #A_PARAMETER#, world! ```   A parameter can be defined several time with the same identifier, depending on the scope, and when this happens **the parameter value will be overridden**. The only exception to this rule is when using the "Default" override, which ensures that if the parameter was defined before, a redefinition will not override the previous value. This default override rule is only used by the [``](../general-template-xml-properties/#Parameters) and [``](../general-template-xml-properties/#saveparams) elements and is specified using the `Type` or `Append` attribute. The sample below shows how things work when the `Type` is omitted or set to "Override" for a parameter (save parameters are explained in the section below): ``` xml A value An other value A value Another value ```   And this sample shows what happens when Type is set to "Default": ``` xml A value Another value ```     ### Save parameters A parameter save using [``](../general-template-xml-properties/#saveparams) can be defined anywhere [``](../general-template-xml-properties/#Parameters) can be defined. The save is given a unique identifier value and a list of parameters to save, which are then saved to a stack separate to the main one. For example: ``` xml A Value ```   At it's most basic, this way of saving parameters is **destructive**, meaning that - unless an `Append` rule is defined - **the save will be reset if it already existed**, and only the new parameters being set for saving will be stored: ``` xml A Value Another Value ```   Using an `Append` rule will prevent this behavior and give you some control over how any existing parameter values should be handled. Similar to the [``](../general-template-xml-properties/#Parameters) element, this is done by setting the `Append` attribute, with the "Default" behaviour being to append parameters onto the save stack, as shown in the example below: ``` xml A value An other value ```   The `Append` attribute will also modify how existing parameters will behave when saved to the stack. When set to "Default" and you save a parameter with the same name as one already saved, the parameter will *not* be overridden: ``` xml A value An other value ```   However, when the attribute is set to "Override", it will be: ``` xml A value An other value ```     ### Load parameters The element [``](../general-template-xml-properties/#loadparams) can be used to load a copy of the contents of the given save stack ID onto the current parameter stack. Note that performing a load operation is *not* destructive, and loaded parameters will still exist in the save with the same value. Essentially, the action is always to load a **copy**. ``` xml A Value ``` Note that if a save isn't found for the given ID then the load will simply fail *silently*. The existence of a saved parameter stack can be checked using the [``](../program-template-xml-properties/#Condition) attribute `CheckSavedParameters` where the attribute value is the ID of the save stack to look up.     ### Remove saved parameters The element [``](../general-template-xml-properties/#removeparams) can be used to remove a saved stack of parameters. ``` xml A Value ``` Similarly to [``](../general-template-xml-properties/#loadparams), if a save isn't found for the given ID, the removal will fail *silently*.     ### Macros Macros are a kind of a *constant* parameter, where the value of a macro is defined in one place and can then be used anywhere. The lifetime of a macro is the same as the global scope, which is to say the same as the [`