Boolean expression does not seem to work (+ui is misleading)
Environment
- OS: Ubuntu 22.04
- Version 1.9.24
Describe the bug I was trying to make a template for toggling a scene item visibility in OBS. I already have a value that is updated when OBS repots any change about it.
Now I set the template parameter to be an expression (for test just to send the current value), and that does not seem to work. Also when it is in expression mode the checkbox is still visible, that is not really clear. It seems it still sends the value of the checkbox not the expression.
I have made a video about it:
https://github.com/user-attachments/assets/632ce10b-f4a4-4c3e-80cf-7c7f63b36414
expressions are a bit sensitive. in this case, it will only update if the actual referenced parameter in the expression changes.
for this kind of link you should use control mode reference, far easier and more stable
Yeah, but i wanted to negate it simply, and thats not possible with refs.
Okay spent some more days messing around, and actually got most of what i wanted and even more working:)
But i figured there is something weird going on:
script.log(root.modules.obsWebsocket.values.sceneItemVisibility.scene_item_20.get()); // 0
script.log(typeof root.modules.obsWebsocket.values.sceneItemVisibility.scene_item_20.get()); // number
script.log(root.modules.obsWebsocket.values.sceneItemVisibility.scene_item_20.get()==="0"?"TRUE":"FALSE"); // FALSE
script.log(root.modules.obsWebsocket.values.sceneItemVisibility.scene_item_20.get()===0?"TRUE":"FALSE"); // FALSE
script.log(root.modules.obsWebsocket.values.sceneItemVisibility.scene_item_20.get()==0?"TRUE":"FALSE"); // TRUE
script.log(root.modules.obsWebsocket.values.sceneItemVisibility.scene_item_20.get()==1?"TRUE":"FALSE"); // FALSE
And that field is a boolean parameter, created as this:
c.addBoolParameter(itemName, "", isPresent);
c.getChild(itemName).setAttribute("readonly", true);
So apparently it is a number, but it's not really ===0
root.modules.obsWebsocket.values.sceneItemVisibility.scene_item_20.get()==0 does not work as an expression either, it stays one value.
So something fishy is going around, but other values, e.g. bool custom variable works in expressions nicely.
The current javascript engine is custom vanilla JS from JUCE. The new version (2.x) will feature QuickJS which should make the whole scripting engine way more standard and robust.