# Buttons & Commands

**On this page**

**Export a button**

You can export a button by right clicking on the button and selecting Export JSON.

The contents will be copied to your clipboard.

**Import a button**

You can import a button by right clicking anywhere on an empty space in your deck and selecting Import from JSON.

In SAMMI, select a deck you wish to share with someone, right click on it and select **Copy Deck**. This will copy all your JSON deck data into your clipboard. You can then paste it into a text file to share with others.

To Import a deck, press **Paste Deck** in SAMMI’s side menu.

You can set up a hotkey to trigger a SAMMI button by right clicking on the button in your deck - **Edit Triggers**. Press **+**, select **Hotkey** and fill out the **Key** field and optionally check whatever modifiers you want to use (for example Ctrl + K). Don’t forget to hit save!

Create a new button. Right click on the button - **Edit Settings**. You can then set up the button to switch your decks when pressed.

**Adding a cooldown for a single button**

Use the Overtime command, which artificially increases the duration of the button and prevents it from getting triggered again.

**Adding a cooldown for a group of buttons**

If you want to put a group of buttons on cooldown as soon as one of them is triggered, you can follow these steps:

- Add all buttons to the
**same**group ID*(right click on a button - Edit Settings - Group ID).* - Make sure
`Allow Queue`

is checked for all your buttons in the group*(right click on a button - Edit Settings)*. - Now every time one of the buttons in the same group triggers, it will automatically add any other triggered buttons sharing the same group into a
**queue**, wait for the currently running button to be over and execute the next button in the queue.

You can use Block Button command to temporarily block a button or group from executing.

If you enable `Allow Queue`

(right click on a button - Edit Settings), all the incoming triggers will be savely queued up and executed as soon as you use Block Button command again to unblock the button.

This is extremely useful if you want to make sure you don’t miss any alerts while you’re on a BRB scene.

Refer to our Commands-Introduction section to learn more about how command delays work.

Press `Variable Viewer`

in SAMMI. You can see all global and persistent button IDs and click on the individual ones to see their variables.

Learn more about all variable types in our Commands-Variables section.

See a list of all premade variables in Commands-Introduction section.

There’s a significant difference between White and Yellow box.

The following examples show the usage in **yellow boxes**.

Operator | Description | Example |
---|---|---|

= | Assignment. Real values or strings. Strings need to be wrapped in double quotes. Asigns the value on the right to the variable on the right. `x = y` |
`x = 7` , `x = "Hello World"` |

+= | Addition. Real values or strings. Strings need to be wrapped in double quote. Same as `x = x + y` |
`7 += 2` = 9 `"Hello" += " World"` = “Hello World” |

-= | Subtraction. Real values only. Same as `x = x - y` |
`7 -= 2` = 5 |

*= | Multiplication. Real values only. Same as `x = x * y` |
`7 *= 2` = 14 |

/= | Division. Real values only. Same as `x = x / y` |
`7 /= 2` = 3.5 |

mod | Modulus. Real values only. Returns the remainder of division. | `7 mod 2` = 1 |

div | number division. Real values only. Same as division, but the remainder is discarded. | `7 div 2` = 3 |

concat | Concatenation. Real values or strings. Returns a string with the two values one after the other. | `7 concat 2` = “72”`"Hello" concat " World"` = “Hello World”`"Player " concat 1` = “Player 1” |

&= | Bitwise AND. Real values only. Same as `x = x & y` |
`7 &= 2` = 2 |

^= | Bitwise XOR. Real values only. Same as `x = x ^ y` |
`7 ^= 2` = 5 |

|= | Bitwise OR. Real values only. Same as `x = x \| y` |
`7 \|= 2` = 7 |

« | Bitwise Left-Shift. Real wavlues only. Same as `x = x << y` |
`5 << 2` = 20 |

» | Bitwise Right-Shift. Real wavlues only. Same as `x = x >> y` |
`5 >> 2` = 1 |

Cos | Returns a numeric value between -1 and 1, which represents the cosine of the angle given in radians. | `Cos 90` = -0.45 |

Sin | Returns a numeric value between -1 and 1, which represents the sine of the angle given in radians | `Sin 90` = 0.89 |

Tan | Returns a numeric value that represents the tangent of the angle. Tan = Sin/Cos. | `Tan 90` = -2.00 |

log10 | Returns the common logarithm of the value. | `log 100` = 2 |

sqrt | Returns a square root of the value. | `sqrt 16` = 4 |

Applies to all Statement commands.

Operator | Description | Example |
---|---|---|

== | Equal. Checks whether the variables are equal. Real values or strings. Strings need to be wrapped in “ “. |
`1 == 3` = false `"Hello" == "Hello"` = true |

!= | Not Equal. Checks whether the variables are not equal. Real values or strings. Strings need to be wrapped in “ “. |
`1 != 3` = true `"Hello" != "Hello"` = false |

> | Greater than. Checks whether the variable is greater than the second variable/value. Real values only. |
`1 > 3` = false `3 > 2` = true |

< | Less than. Checks whether the variable is less than the second variable/value. Real values only. |
`1 < 3` = true `3 < 2` = false |

>= | Greater than or equal. Checks whether the variable is greater than or equal to the second variable/value. Real values only. |
`1 >= 3` = false `3 >= 3` = true |

<= | Less than or equal. Checks whether the variable is less than or equal to the second variable/value. Real values only. |
`1 <= 3` = true `3 <= 3` = true |

You can execute complex math operations in every parameter box, using a mix of variables and real values. Note that there’s a significant difference between White and Yellow box.

Each time you want SAMMI to execute any kind of math, you need to wrap the whole sequence in parentheses: `(some math operation)`

, for example `(variable+3*5+round(variable2))`

or `(variable+10)`

(applies for yellow boxes, as you must use `/$$/`

in white boxes).

The following examples show the usage in **yellow boxes**.

Operator | Name | Example (without parentheses) |
---|---|---|

+ | Add | `3+2` |

- | Subtract | `3-2` |

/ | Divide (including decimals) | `3/2` = 1.5 |

* | Multiply | `3*2` = 6 |

^ | XOR | `3^2` = 1 |

| | OR | `3|2` = 3 |

& | AND | `3&2` = 2 |

$ | Hexadecimal | `$FFF` = 4095 |

round() | Round to nearest number | `round(3.4)` = 3 |

ceil() | Ceil (Round up) | `ceil(3.4)` = 4 |

floor() | Floor (Round down) | `floor(3.8)` = 3 |

mod | Modulus (division remainder). Space required before and after mod. | `7 mod 3` = 1 or `(7+3) mod (2+4)` = 4 |

div | Divide (no decimals). Space required before and after div. | `7 div 3` = 2 or `(7+3) div (2+4)` = 1 |

String in a programming language is a sequence of characters. It is used to represent text rather than numbers.

Strings are contained within a pair of double quotes, i.e. `"Cat"`

or `"Hello World"`

.

Strings can contain numbers, however you must realize that `"5"`

doesn’t have the value of 5, it has the value of 0, the same as `"a"`

does.

You cannot add strings either, i.e. `"12" + "34"`

isn’t `"46"`

, it’s `"1234"`

. `12 + 34`

is `46`

.

If you wish to convert a string to a number, you can use String to Number command.

Any characters not supported by SAMMI will be displayed as invisible or `□`

characters within SAMMI.

The characters themselves are correctly saved and will be correctly displayed/sent outside of SAMMI (such as in your Twitch Chat Send message command).

Learn more about wild cards and their usage in our Triggers-Introduction section.

If you’re using the same .ini files from LioranBoard 1, you will notice that your stringified stacks don’t get properly parsed when loaded back into SAMMI (they end up being objects instead of arrays).

**Use this Stack to Array converter button:**