Numbers

Edit

Clamp #

Clamps a variable between two values. Intended to use on real values (numbers) only.

  1. If value of the variable < minimum allowed value, returns minimum allowed value.
  2. If value of the variable > maximum allowed value, returns maximum allowed value.
  3. If value of the variable is within the allowed range, returns the original value.

Box Name Type Description
Variable String Name of the variable to clamp.
Minimum Real (number) Minimum value allowed.
Maximum Real (number) Maximum value allowed.
Value Clamp Min Clamp Max Result
20 50 120 50
75 50 120 75
980 50 120 120


Edit

Random #

Returns a variable with a random value (number) between minimum and maximum possible value.
This is a basic command you can use for showing random images, playing random videos/sounds, picking a random viewer from chat etc.
If you wish to have more power over randomizing values (like adding weights), it is best to use Arrays instead.

Box Name Type Description
Variable String Name of the variable to save the random value.
Minimum Number Minimum value possible.
Maximum Number Maximum value possible.
Allow Float checkbox checked = random value returned can never be the maximum or minimum value itself
unchecked = random value returned can be anything including maximum and minimum possible value
Any float value in minimum or maximum value is omitted if Float is set to False.


Edit

Hex to Number #

Converts a hexadecimal string into a real (decimal) number.

Box Name Type Description
Variable String Name of a variable to save the converted value.
Hex String String Hex string to convert.
Hex string value Returned real value
A 10
1d 29
1F4 500


Edit

Number to String #

Turns a real value (number) into a string value.

Box Name Type Description
Variable String Name of a variable to save the string value.
Value Number Number to convert.


Edit

String to Number #

Turns a string value into a real value (number).

  • returns 0 if the string does not start with a number or .
  • stops the conversion if it encounters any non number in the string and returns the current converted value
  • converting a value that’s already real returns 0
  • removes any leading zeroes and rounds the number to 2 decimal points
  • string X beginning with a . will be converted to 0.X
  • accepts strings containing Euler’s number
Box Name Type Description
Variable String Name of a variable to save the real value.
String Variable String Name of a variable containing the string to convert.
String Variable value Returned real value
“Hello World” 0
“Hello World 123” 0
“123 Hello World” 123
“123 Hello World 456” 123
“.99” 0.99
“1.239999” 1.24
“000010” 10
“10e-2” 0,10
“10e+2” 1000
10 0


Edit

Swap Red & Blue #

Swaps red and blue value for a color in HEX/DEC format and returns its DEC value. Useful for converting HTML colors to LioranBoard or OBS colors (as they use BGR instead of RGB).

Box Name Type Description
Variable String Name of the variable containing the color value to swap red and blue.