Skip to content

BLOCKS VALUE

BLOODWIING edited this page Aug 13, 2021 · 1 revision

List of VALUE Blocks

VALUE BLocks are readable. They have a value type (Null, Number, String, Boolean, Color, Object) and, depending on where they're used, can be read differently.

A Number type can be converted to a Color type if needed. The object type means that the Value needs to be calculated first, as if there was a MATH Block in it.


QUICK NAVIGATION


NUMBER

NUMBER Block

Gets a number from BMG's state. Has access to the drawer, map data, etc. Please reference the schema to have the enum list suggested to you.

key

ALLOWED TYPES: String
Required

The key of the data.

EXAMPLE

{
  "type": "NUMBER",
  "key": "MAP->INDEX"
}

COLOR

COLOR Block

A Color value.

r

ALLOWED TYPES: Number
Required

The red value.

g

ALLOWED TYPES: Number
Required

The green value.

b

ALLOWED TYPES: Number
Required

The blue value.

EXAMPLE

{
  "type": "COLOR",
  "r": 218,
  "g": 51,
  "b": 63
}

PARAMETER

PARAMETER Block

Gets a parameter that was passed when running this function. Cannot request a parameter that wasn't registered in the function's header.

name

ALLOWED TYPES: String
Required

The key of the parameter.

EXAMPLE

{
  "type": "PARAMETER",
  "name": "user_color_1"
}


MATH

These types of VALUE blocks can solve Number or Color equations. These blocks can help you get the number you need by calculating. Most blocks take 2 inputs and accept Numbers or Colors, only a few blocks are exceptional). If any input of a math block is of a Color type, then it will yield a Color output.


+ (ADDITION)

ADDITION Block

Returns the added value of a and b.

a

ALLOWED TYPES: Number, Color, MATH
Required

The first input.

b

ALLOWED TYPES: Number, Color, MATH
Required

The second input.

EXAMPLE

{
  "type": "+",
  "a": 2,
  "b": 7
}

- (SUBTRACTION)

SUBTRACTION Block

Returns the subtracted value of a, having taken away the value in b.

a

ALLOWED TYPES: Number, Color, MATH
Required

The first input.

b

ALLOWED TYPES: Number, Color, MATH
Required

The second input.

EXAMPLE

{
  "type": "-",
  "a": 20.3,
  "b": 11.3
}

* (MULTIPLICATION)

MULTIPLICATION Block

Returns the multiplied value of a and b.

a

ALLOWED TYPES: Number, Color, MATH
Required

The first input.

b

ALLOWED TYPES: Number, Color, MATH
Required

The second input.

EXAMPLE

{
  "type": "*",
  "a": 18,
  "b": 0.5
}

/ (DIVISION)

DIVISION Block

Returns the divided value of a, using the divisor in b. If both inputs are Numbers, keep in mind that the result could have a floating point.

a

ALLOWED TYPES: Number, Color, MATH
Required

The first input.

b

ALLOWED TYPES: Number, Color, MATH
Required

The second input.

EXAMPLE

{
  "type": "/",
  "a": 27,
  "b": 3
}

// (FLOOR DIVISION)

FLOOR DIVISION Block

Returns the floored divided value of a, using the divisor in b. Only works for Number operations. The Number returned will never have a floating point.

a

ALLOWED TYPES: Number, Color, MATH
Required

The first input.

b

ALLOWED TYPES: Number, Color, MATH
Required

The second input.

EXAMPLE

{
  "type": "//",
  "a": 8,
  "b": 0.85
}

% (MODULO)

MODULO Block

Returns the remainder when dividing a by b.

a

ALLOWED TYPES: Number, Color, MATH
Required

The first input.

b

ALLOWED TYPES: Number, Color, MATH
Required

The second input.

EXAMPLE

{
  "type": "%",
  "a": 48,
  "b": 13
}

New in 1.1

POW

POWER Block

Returns the value when raising the value in base to the exponent. Can also be used to root the number.

base

ALLOWED TYPES: Number, Color, MATH
Required

The base, what to raise.

exponent

ALLOWED TYPES: Number, MATH
Required

The exponent, how much to raise.

EXAMPLE

{
  "type": "POW",
  "base": 3,
  "exponent": 2
}

New in 1.1

SQRT

SQUARE ROOT Block

Returns the the input's square root.

input

ALLOWED TYPES: Number, Color, MATH
Required

The input of the SQUARE ROOT Block.

EXAMPLE

{
  "type": "SQRT",
  "input": 81
}

BMG WIKI

DOCUMENTATION

CHANGE LOG

BEHIND THE SCENES

Clone this wiki locally