Logic Gadgets: Variable


Name of gadget Variable
Section Logic & Processing
Number of Tweak pages 1
Author LadylexUK, QuietlyWrong
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!

You could use a variable and variable modifier as a health gadget to track the player’s health but the dedicated Health Modifier (used with a Health Manager) is normally a better choice.

Example Tutorial (adapted from Media Molecule)

  1. Place a variable gadget and name it “jumps”
  2. Place a puppet
  3. Scope into the puppet, open the Puppet microchip, and controller logic section
  4. Put a variable modifier on the chip.
  5. Tweak the modifier and enter “jumps” in the variable name field.
  6. Set operation type to add
  7. Make the operation value 1 (this will add one to the value when activated)
  8. In the puppet interface connect jumped output to the power port on the variable modifier.
  9. Add a number displayer gadget to the output of the variable gadget
  10. Go to test mode
  11. Possess the puppet and jump.
  12. Every time you jump the variable will add 1 to its value (which you will see displayed in the number displayer)

Tweak Menus

  1. Initial Value
  2. Minimum Value
    2a. Input
    2b. Output
  3. Maximum Value
    3a. Input
    3b. Output
  4. Multiplayer
    4a. Input
    4b. Output
  5. Persist in Dream
    5b. Output
  6. Force Reset
  7. Current Value
  8. Increased
    8b. Output
  9. Decreased
    9b. Output
  10. Power
  1. Initial Value
    You can manually set the default (starting) value of this variable here.
  2. 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.
  3. 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.
  4. Multiplayer
    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.
  5. 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.
  6. Force Reset
    Force the variable to return instantly to its “Initial Value”.
  7. 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.
  8. Increased
    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
  9. Decreased
    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
  10. Power
    This is where you turn the gadget on/off


Lex Tips

Useful Tutorials

Beginners Guide to Variables and Variable Modifiers


Comments and Feedback

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Create a free website or blog at WordPress.com.

Up ↑

%d bloggers like this: