Using the scripts widget

Can you provide an example of how to use the script widget.

also like to know if it can do the follow. If toggle button 1 is on then toggle button 2 is off, so that both button are not on the same time

You don’t need a script to do that, you can set the buttons’ value property as follow:

JS{{
// button_2's value property
return @{button_1} == 1 ? 0 : 1
}}
JS{{
// button_1's value property
return @{button_2} == 1 ? 0 : 1
}}

There are a few discussions about scripts were you can find some examples:

https://openstagecontrol.discourse.group/search?q=scripts%20category%3A7

https://github.com/jean-emmanuel/open-stage-control/issues?q=is%3Aissue+script+is%3Aclosed

In v0.46.2, this would work too:

  1. create a script
  2. set its value property to “@{button_1} @{button2}” to link it to the buttons’ values
  3. set its script property as follows:
JS{{

var widget =  id == "toggle_1" ? "toggle_2" : "toggle_1",
      newValue = get(id) == 1 ? 0 : 1

set(widget, newValue)

}}