I figured it out. Should have done some digging before asking here, but maybe this will be of interest to others.
I checked out the dev-state page and found that it was adding a “can_cancel: true” property to the state of the script. I believe it is adding this automatically to any script that has a “delay” in it. Kind of makes sense. Lets you cancel the script in the middle of its execution by turning off the toggle.
Usually I’m not the RTFM type of guy, but if you would’ve read the second last sentence on the script component page, it would have spared you some time.
If it’s really just for aesthetics, you could also use the can_cancel attribute in the customize section of the script definition and set it to true or false:
If you do this, script won’t even load as there is no such thing as customize section in the script definition.
This needs to be done in customize.yaml.
A bit of an old thread, but on 0.105.2 I’m finding that the toggle switch only stays ‘on’ for a few seconds, even though I’ve got a WAIT statement in there.
And before you ask - no, the wait statement isn’t being evaluated as True after a few seconds, it can take up to 120
I think for neatness I’ll just add the 'can cancel:false" flag to all my scripts that have toggles.
I’ve just updated to 2021.1.4. Earlier, last year, seeing this thread, I’ve added a delay to one of my scripts to show a switch instead of the nonsensical (from human UI standpoint) EXECUTE text.
In this version it stopped showing the switch icon, instead it always shows EXECUTE. Did something change in this version? Is this a bug? Can I change my config so it always shows a switch on the panel?