What are Custom Variables?

3 min read

Tip

Parameters (called Custom Variables in older guides) are used to define reusable parameters that you and your team can use in all diagrams, by referencing them in the Formula Fields of Nodes and Connections.

The Diagram parameters panel opened from the (x) button in the toolbar, with one parameter, loot_value, listed and its menu open: Duplicate, Copy to library, Copy to team and Delete.The Diagram parameters panel opened from the (x) button in the toolbar, with one parameter, loot_value, listed and its menu open: Duplicate, Copy to library, Copy to team and Delete.

Types of Custom Variables

Two types of custom variables are created in the New parameter dialog, and four kinds of external data are connected from the Data tab:

  1. Randomness – Set up a randomness variable to use as a random number generator. You may choose between Interval (from/to) or Array (integer numbers divided by a comma) to select a random number.
  2. Math Expression – This is the most versatile type of custom variable. You can use integer numbers in the Formula field during setup or make use of the available Math.js functions. This includes combining existing variables with each other.
  3. In the Data tab, External JSON – Use an external JSON file as value(s) for this custom variable type. Please note that the hosting location for this file needs to be whitelisted by Machinations!
  4. In the Data tab, Live Market Feeds – This variable type allows you to select live market data from a vast list of available projects. Select Binance or Opensea from the Market dropdown to load the list of Projects.
  5. In the Data tab, under Add connectors, Google Sheets – Connect a public or a private Google Sheet; its cells become a variable you can use in formulas. This data can be fetched using the official Language Clauses.
Note

Additionally, you can use the predefined custom variable: STEP. 

By typing this name in any formula (using all caps) you can easily reference the current simulation step, allowing this value to update in real time. Use it every time when your project requires a timer, a counter or an index for transposing arrays.

Organizing your Custom Variables

You can organize your Custom Variables in three available tabs:

The top of the Diagram parameters panel with the Diagram, Library and Team tabs.
  1. Diagram – a list of variables in use on the diagram you are currently editing
  2. Library – all variables you saved to your library, available across your account
  3. Team – all variables available across your team’s account

Configure a new Custom Variable

  1. Press the (x) button in the toolbar at the top of the canvas to open Diagram parameters.
  2. Press New parameter.
  3. Pick Math expression (“Compute a value from a formula”) or Randomness (“Sample from a range each Play”) in the list on the left. Google Sheets, Binance, OpenSea, JSON and API variables are added from the Data tab at the top of the editor instead.
  4. Go through the configuration steps.
Warning

The “Name” field of custom variables is case sensitive. Please make sure that you used the correct capitalization when referencing the variables in the diagram.

Using a previously saved variable

If you want to use an already existing Private or Team variable in your diagram, it must be added to the diagram first.

  1. Go to the private or team tab and click on the three dots to open the contextual menu.
  2. Find the custom variable you wish to use
  3. Click the contextual menu (3-dotted) next to it
  4. Choose one of the available options:
    • Use in this diagram – an instance of this custom variable will be available in the Diagram tab, and you can use it in the Formula fields of nodes and connections. Changes made to a custom variable added through this method will propagate throughout ALL its instances.
    • Copy to this diagram – a copy of this custom variable will be made available in the Diagram tab and you can use it in the Formula fields of nodes and connections. Use this method if you want the custom variable to be independent of the one being copied. Changes made to the custom variable being copied will NOT affect its copies.
    • Delete – Delete the selected variable. Please be cautious when deleting team variables!