Logic Gadgets: Variable Modifier


Name of gadget Variable Modifier
Section Logic & Processing
Number of Tweak pages 1
Author LadylexUK, QuietlyWrong
Last updated 27 Feb 2019 [Beta]


This gadget modifies or reads a named Variable gadget. It works wirelessly and you can have any number of modifiers associated with one variable, so it can keep your logic tidy and legible. There are options that allow you to make a change in a one-off pulse, for example adding gold to your purse when you sell an object, or to change it continuously over time, such as reducing your fuel while you are firing the thrusters on your rocket-ship.

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)

See Variable

Tweak Menus

  1. Variable Name
  2. Operation Type
  3. Update Type
  4. Operation Value
    4a. Input
    4b. Output
  5. Variable Value
    5b. Output
  6. Power
  1. Variable Name
    Add the name of the variable you wish to modify here. The name is case-sensitive. Unless you have dozens of variables, it’s easiest to select from a list of existing variable names by hovering the mouse tip over this box and pressing up or down on the d-pad to cycle through them – this reduces the chance of a misspelling breaking your logic. Don’t forget to actually create and name your variable first though!
  2. Operation Type
    • Set
      Use this to change the value of the named variable directly, to the value of Operation Value (4.).
    • Get
      Use this to read the value of the named variable and output it to Variable Value (5.).
    • Add
      Increases the variable value by the value in Operation Value (4.) – and of course you can “subtract” by “adding” a negative number.
    • Reset
      Returns the variable to its default value.
  3. Update Type
    Dictates when the Variable Modifier actually modifies or reads the named variable:

    • When Powered On
      Only operates at the split-second when the “Power” status of the gadget switches from Off to On. It will then do nothing more until the Power is turned off (and then on) again.
    • Continuously
      Continuously updates the value of the named variable (or outputs its value) as long as the gadget is powered on. Used with the “Add” operation, this will keep the variable value changing.
  4. Operation Value
    Used by Operation Types “Set” and “Add” only, it is the value in this field that either replaces the named variable’s value or is added to it.
  5. Variable Value
    Used by Operation Type “Get” only, this outputs the current value of the named variable, no matter where it is in your level.
  6. Power
    This is where you turn the gadget on/off


Lex Tips

Useful Tutorials

Beginners Guide to Variables and Variable Modifiers


2 thoughts on “Logic Gadgets: Variable Modifier

Add yours

  1. I’m having a bit if trouble figuring out how to cause an action when a variable is set to a specific number, in particularly while pressing a button on the controller.
    I thought I could accomplish this with an AND Gate, but it doesn’t seem to work.


    1. Wire your button to the power of a variable modifier that is set to change your Variable (make sure the name of your variable and the referenced variable in your modifier is the same). Use set and the number of your choice. No AND gates required. Now this variable is permanently changed. You could use a timer powered at the same time and attached to another variable modifier to revert it back after a second or two if you need the action that is controlled by the variable to be activated numerous times (however if you are wanting to have an action on a button press a variable is not really the correct method).


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: