Swaps and Swap Table

Swaps allow you to dynamically change values in commands, events, or titles.
You can modify values without having to edit the command, event, or title.

A brief example

Suppose you’ve created a button to select a scene in OBS Studio.

In the JSON of the command, you specify the value “Scene1” for the “sceneName” attribute.

If you want to select a different scene with the button, you edit the command in the button and update the value “Scene1” to “Scene2”. From now on, the button calls “Scene2” in OBS.

Create A Swap

Let’s use a swap instead of the specific scene value in “sceneName”.

To do this, first go to the main menu and tap on “Swap tables” once.

Now tap on the “Globals” entry to display the list of global swap tables.

Use the plus button at the top right to add a new table.

Name this table “Scenes”.

Then tap on “Scenes” and create a new entry using the plus button.

In the “Swap” field, enter the name for the swap as “SceneA”.

In the “Value” field, enter the value of the swap as “Scene1”.

Confirm the input with “OK”.

You can now leave the swap tables using the checkmark at the top right and return to the panel.

Use The Swap

Go to the button’s command and change the value of the “inputName” attribute to “\(SceneA)“.

Look at the syntax for using swaps.

Swaps always start with “\( “.
Then comes the name of the swap, followed by “)“.

If you’ve correctly specified the swap, it will appear in blue font. Complete the input using the checkmark at the top right.

\(SWAP)

This syntax is important. It’s the way swaps are inserted.

When you tap the button now, the swap will be replaced by the stored value during the execution of the command.

If you want to change the value, you can do so via the swap table where you saved it.
This can be done through the main menu.

Advanced Use

There are also other interesting ways to change the value of the swap. For example, through another button on the panel.

Create a new button and add a tap command to the button named “Set global swap value”.

Select your “Scenes” table.

Then, in the Swap field, enter the name of the swap.

Important

The swap is not formatted with “\( ) ” here.

You can also use the button on the far right.

In the Value field, enter the new value for the swap.

You can also use the button on the far right to display an input window for live input of the value.

Let’s do that.

Leave the “Panel check Status” switch turned on.

Complete the input using the checkmark at the top right.

Set Global Swap Value

Test The Swap

Go to the live mode and press the button.

An input window appears, showing you the current value of the swap.

You can now change this value to “Scene2” and confirm with “OK”.

Now, when you tap the button, OBS switches to Scene2 instead of Scene1.

Use Swaps in Titles

Now let’s display the scene name in the title of the button.

To do this, edit the button.
Enter “\(SceneA)” in the title field.
Complete the edit using the checkmark.

Now the scene name will be displayed on the button.

This was just an example of how useful the use of swaps can be for you. The possibilities are great, and over time, you’ll surely find many uses for swaps.