Can I change the buttons text according to it's current value?

Hey guys!

I know this is a very simple question, but I really don't know how excatly to change the "label" of the button.....

Can I set it's label value in the "On value" script page?

The simplest way to go is to write something like this in the label property:

#{@{this} == 1 ? "On" : "Off"}

(assuming on is set to 1)

Cool! I didn't even think about using #{} in the label.

I thought label can just run javascript so I acutally tried

If(get(value) == 1){
  “On”
} else {
  "Off"
}

get() is only available in scripting properties such as onValue.

Thank you! I see now