Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boolean expression does not seem to work (+ui is misleading) #260

Open
KopiasCsaba opened this issue Dec 4, 2024 · 4 comments
Open

Boolean expression does not seem to work (+ui is misleading) #260

KopiasCsaba opened this issue Dec 4, 2024 · 4 comments

Comments

@KopiasCsaba
Copy link
Contributor

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:

vokoscreenNG-2024-12-04_16-56-33.mp4
@benkuper
Copy link
Owner

benkuper commented Dec 4, 2024

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

@KopiasCsaba
Copy link
Contributor Author

Yeah, but i wanted to negate it simply, and thats not possible with refs.

@KopiasCsaba
Copy link
Contributor Author

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.

@benkuper
Copy link
Owner

benkuper commented Dec 6, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants