Introduction

Edit

General #

When you right click-Edit commands or double click on your button in your deck, you can press + or use CTRL+N keyboard shortcut to start adding commands to execute when the button is pressed.

  • Once a button is triggered, all enabled commands are executed

  • You can hover over a command name and press F1 on your keyboard to open Documentation in your default browser for the given command

  • You can disable a command (and prevent it from executing) by checking Off on the very right side of the command. Disabled commands have a red color.

    Disabled command
    Disabled command
  • You can copy a command (or multiple commands) by pressing the scissors icon and pasting it anywhere else (even in another button in another deck)

  • You can freely rearrange your commands by pressing the ball icon (very left side) and dragging them to a different position. Select multiple commands to drag all of them at the same time. You can also use up and down arrows for the same effect.

  • If you accidentally delete or rearrange a command, you can press Undo to revert the action and Redo to redo the action.
  • When typing in an input box, you can press CTRL+Z to undo what you typed last
  • You can temporarily block a button from executing
  • You can use comments to organize your buttons. Simply create a new Comment command, give it some relevant description and place all relevant commands inside of it!
  • Some commands (for example Comment) have an expandable text box. You can drag the ↕ handle at the bottom of the box to give it more vertical space for longer content.


Edit

Button Indicator Icons #

Buttons can display small icons in their top-left corner. These icons provide a quick overview of the button’s configuration without opening its settings or commands.

Multiple icons can be displayed on the same button. If there is not enough horizontal space, SAMMI continues on the next line. You can hide all of these icons with the Hide Button Icons option.

Icon Meaning When it is shown
Commands indicator icon Commands The button contains one or more commands that run when the button is pressed.
Play Sound Effect indicator icon Play Sound Effect The button contains a Play Sound Effect command in its press or release commands.
Keyboard indicator icon Keyboard Input The button contains a Keyboard Simulate Press command in its press or release commands.
Stop Sound Effect indicator icon Stop Sound Effect The button contains a Stop Sound Effect command in its press or release commands.
Triggers indicator icon Triggers The button has at least one trigger configured.
Overlap indicator icon Overlap Allow Button Overlap is enabled. The button can run again while a previous execution is still active.
Persistent indicator icon Local Variable Persist Local Variable Persist is enabled, so local variables remain available after the button finishes.
Queue indicator icon Allow Queue Allow Queue is enabled. Additional executions wait until the current execution finishes.
Press type indicator icon Press Type The button uses a press type other than the normal press behavior.
Deprecated Switch Deck indicator icon Switch Deck (deprecated icon) SAMMI still stores the related button setting, but the Deck Editor intentionally skips this legacy icon when drawing button indicators.
Release commands indicator icon Release Commands The button contains one or more commands that run when the button is released.
Initial variables indicator icon Initial Variables The button has initial variables configured.
Protected button indicator icon Protected The button is protected. Its commands cannot be copied.
Transparent button indicator icon Transparent The button is transparent and has no other indicator icons to display.


Edit

Command delays #

Command delays are absolute and not related to each other. You can think of them as a timeline, they do not affect each other in any way.

Example 1: If you set up the first command to trigger at 1000ms and the second command to trigger at 1000ms, both commands will trigger at 1000ms, one right after another (in this case order matters), exactly 1000ms from when the button was pressed.
Example 2: If you set up your first command to trigger at 5000ms and your second command to trigger at 2000ms, the second command will be triggered exactly 2000ms from when you pressed the button and then first command will be triggered exactly 3000ms after it (5000ms from when you pressed the button).

The command delay is superior to the command order, which means that a second command with a shorter delay will be always triggered before the first command with a longer delay.

Example showing how command delays work
Example showing how command delays work

You cannot use variables in command delays, but you can use Wait for Timeout command instead.


Edit

Async (Purple) Commands #

You might notice that some commands are coloured purple - these commands are ones that are not instantaneous. otherwise known as asynchronous.

The variable name listed in the Save Variable box of these commands (if present) will not be returned immediately, meaning commands ahead run before it’s returned. As such, you must Wait until the variable exists to halt your button until the response is recieved. Please note that this variable must not be a variable that already exists, otherwise the Wait Until Variable Exists command will not run.

SAMMI Purple Commands
SAMMI Purple Commands

If the async command does not contain a Save Variable box, you may choose an arbitrary amount of time using the Wait command.

You may also choose to let it continue without waiting if you don’t need to know when it resolves.


Edit

Input Boxes #

When you start using commands in SAMMI, you will notice that some parameter boxes have yellow color and some have white color.

Different parameter box colors
Different parameter box colors

It’s extremely important to know the difference as you need to format your input according to the color of the box.

Operation White Box Yellow Box
Inserting another variable You must wrap other variables in /$$/.
/$myVariable$/
You can directly type another variable.
myVariable
Inserting array value You must wrap them in /$$/.
/$myArray[0]$/
You can directly insert them.
myArray[0]
Inserting real values (numbers) You can directly insert them.
26
You can directly insert them.
26
Inserting string values (text) You can directly insert them, such as Hello World and even use new lines by pressing ENTER You have to wrap any string in double/single quotes.
"Hello World" or 'Hello World'
Using a combination of strings and variables You can insert a variable into text by wrapping it in /$$/.
Hello world, this is my /$myVariable$/, isn't it cool?
You must wrap any string in double/single quotes and use + to combine them with other variables. The whole value must be enclosed in parentheses.
( "Hello World, this is my " + myVariable + ", isn't this cool?" )
Math Operations All math operations must be enclosed in /$$/ and parentheses.
Hello world, do you know what's 3+7? It's /$(3+7)$/!
All math operations must be enclosed in parentheses.
( "Hello world, do you know what's 2+7? It's " + (2 + 7) + "!" )


Edit

Premade Variables #

The following premade/permanent global variables are accessible from all the buttons and their commands at all times.
These global variables can be viewed in the Variable Viewer in your SAMMI.
You can access them by using the Get Global Variable command, or reference them with global.variablename in a command.

SAMMI Global Premade Variables
SAMMI Global Premade Variables

General Variables

Variable Type Explanation
administrator_mode Boolean True if running in Administrator mode.
elapsed_time Number Time in seconds since you started SAMMI.
main_directory String Main directory where SAMMI folder resides, using forward slashes (/). Useful for extension makers to be able to easily copy files.
main_directory_slash String Main directory where SAMMI folder resides, using backslashes (\\). Useful for sending file paths to OBS.
mouse_x Number Current x position of your mouse.
mouse_y Number Current y position of your mouse.
since_2020 Number Elapsed time in seconds since January 1st, 2020.

SAMMI Variables

Variable Type Explanation
api_port Number The port number for the Local API server.
api_pw_enabled Boolean Returns true if SAMMI Local API server has a password.
api_server_opened Boolean Returns true if SAMMI Local API server is running.
bridge_connected Boolean True if connected, false if not connected.
client_language String Language SAMMI is currently using.
deck_app_connections Array Contains string names of all connected Deck Apps.
deck_app_port Number The port number for the Deck App.
SAMMI Object Contains information about your current SAMMI versions.
SAMMI.bridge_version String Your current SAMMI Bridge version.
SAMMI.sammi_version String Your current SAMMI Core version.
bridge_port Number The port number for SAMMI Bridge connections.
trigger_type Array All available trigger types.
sammi_pro Boolean Returns true if the user has an active SAMMI Pro subscription.

Meld Variables

These variables are updated by the Meld Studio connection. SAMMI stores Meld state in the Meld object.

Variable Type Explanation
Meld Object Contains the current Meld Studio connection and session status.
Meld.connected Boolean True if SAMMI is connected to Meld Studio.
Meld.webchannelReady Boolean True if Meld’s WebChannel API has finished initializing.
Meld.ip String IP address used by the Meld connection.
Meld.port Number Port used by the Meld WebChannel connection.
Meld.isStreaming Boolean True if Meld is currently streaming.
Meld.isRecording Boolean True if Meld is currently recording.
Meld.isReplayBufferActive Boolean True if Meld’s replay buffer is currently active.
Meld.streamTime String Meld stream timer value, if provided by Meld.
Meld.recordingTime String Meld recording timer value, if provided by Meld.
Meld.version String Meld version, if provided by Meld.
Meld.currentScene String Name of the current Meld scene.
Meld.currentSceneId String ID of the current Meld scene.
Meld.stagedScene String Name of the currently staged Meld scene.
Meld.stagedSceneId String ID of the currently staged Meld scene.
Meld.previousScene String Previous Meld scene name. Empty until SAMMI has observed a scene change.
Meld.previousSceneId String Previous Meld scene ID. Empty until SAMMI has observed a scene change.
Meld.sceneCount Number Number of scenes reported by the current Meld session.
Meld.layerCount Number Number of layers reported by the current Meld session.
Meld.trackCount Number Number of tracks reported by the current Meld session.
Meld.effectCount Number Number of effects reported by the current Meld session.
Meld.lastSignal String Last Meld WebChannel signal received by SAMMI.

Twitch Variables

Variable Type Explanation
twitch_accounts Array All linked Twitch account login names.
twitch_chat_connected Boolean Twitch chat connection status. True if connected, false if not connected.
twitch_client_id String SAMMI Twitch Client ID, used in Twitch API calls.
twitch_default_channel String The Twitch account SAMMI recieves events from.
twitch_default_chat_account String The Twitch account SAMMI sends messages from.
twitch_eventsub_connected Boolean Returns true if SAMMI is connected to Twitch’s eventsub.
twitch_default_channel_id String The ID of the Twitch channel SAMMI receives events from.
twitch_default_chat_id String The ID of the default Twitch account SAMMI sends chat messages from.
auto_connect_twitch_extension Boolean Whether SAMMI Bridge should automatically connect to the SAMMI Twitch Extension backend.

YouTube Variables

Variable Type Explanation
youtube_accounts Array All linked YouTube account login names.

OBS Variables

Variable Type Explanation
obs_connections Array Names of all your OBS connections.
[obsName] Object Contains information about your main/alternate OBS connection.
[obsName].connected Boolean Returns true if SAMMI is connected to that OBS.
[obsName].current_scene String Your selected OBS current scene.
[obsName].ip String The IP address of the OBS connection.
[obsName].obs_studio_version String Current OBS studio version the OBSws is connected to.
[obsName].obs_websocket_version String Current OBS Websocket version the OBSws is connected to.
[obsName].port Number The port of the OBS connection.
[obsName].previous_scene String Your selected OBS previous scene.
[obsName].type String OBSws selected type in OBS Connections, either OBSws4, OBSws5 or Auto.