|Name of gadget||Variable|
|Section||Logic & Processing|
|Number of Tweak pages||1|
|Last updated||27 Feb 2019 [Beta]|
This gadget creates a number variable that you can read and modify remotely with the Variable Modifier gadget. A variable can be used to house info such as the number of enemies killed, items collected, jumps made and much more. It can also be used to carry info from one scene to another within a Dream, so that character progress in a game can be maintained.
Each variable must be given a unique name which is case-sensitive. Give each a clear name that tells you exactly and unambiguously what it represents to avoid causing yourself, your collaborators or future remixers problems along the line!
Example Tutorial (adapted from Media Molecule)
- Place a variable gadget and name it “jumps”
- Place a puppet
- Scope into the puppet, open the Puppet microchip, and controller logic section
- Put a variable modifier on the chip.
- Tweak the modifier and enter “jumps” in the variable name field.
- Set operation type to add
- Make the operation value 1 (this will add one to the value when activated)
- In the puppet interface connect jumped output to the power port on the variable modifier.
- Add a number displayer gadget to the output of the variable gadget
- Go to test mode
- Possess the puppet and jump.
- Every time you jump the variable will add 1 to its value (which you will see displayed in the number displayer)
- Initial Value
You can manually set the default (starting) value of this variable here.
- Minimum Value
Set (or check) the minimum value that the variable can carry. Any attempt to set the variable to a lower value will be limited to the minimum value instead. Be careful when changing this (and Maximum Value) dynamically because changes to these may affect the Initial Value and Current Value if they fall outside the new range.
- Maximum Value
Set (or check) the maximum value that the variable can carry. Any attempt to set the variable to a higher value will be limited to the maximum value instead.
Set this to make this a multiplayer variable, i.e. such that each player in your Dream has their own separate copy of this variable – suitable for individual inventories, for example. If not activated, the variable ignores the number of players and provides a single value, useful for the status of props in your levels – e.g. whether a gateway is unlocked.
- Persist in Dream
By default, variables are reset any time the player exits a scene. This may be fine for keeping track of things limited to that scene, but it’s not good for things like total score. By activating this setting, your variable will not get reset when the player changes scenes. When the player exits and then plays your Dream again, previous variable values will be retained unless the player chooses to reset their own progress. You will need to create a variable with the same name in each of the other scenes of your Dream to use it in those scenes.
- Force Reset
Force the variable to return instantly to its “Initial Value”.
- Current Value
This output socket 7b is where the current value of the variable can be accessed directly. The current value can also be obtained using the variable modifier gadget.
Sends a positive signal if the current value is higher than the previous value. Sends a negative signal if the value is the same or lower
Sends a positive signal if the current value is lower than the previous value. Sends a negative signal if the value is the same or higher
This is where you turn the gadget on/off