Convert string to number

#1

I want to have an OSC popup button that drives an FX slider with non-sequential numeric values. If I publish the button as a string, then it doesn’t work for driving sliders. It seems like any value gets treated as zero. Is there any way to make it treat this string as a float?
I’m trying to have a popup button to choose from common movie aspect ratios. From there, I’ll do some math to derive the top and bottom crop values for cropping the image. I hope it makes sense with this screenshot.

The DDMathParser documentation suggests an evaluate() function, but $VAL.evaluate() doesn’t work for me, I guess I’m using it wrong.

0 Likes

#2

It’s not possible.
See my post request here

You’ll need to set up local presets where you want to do you processing and then go from there. The other option is to possibly use OSCulator to convert it.
Or create a VUO plugin that will convert you OSC String for you.

0 Likes

#3

Try this
$VAL.numberByEvaluatingString().doublevalue
Or
numberByEvaluatingString($VAL).doublevalue

From here:
https://github.com/davedelong/DDMathParser/issues/108

0 Likes

#4

I can’t type those things in the “do math” field. Are you suggesting using those expressing in OSCulator or vuo?

0 Likes

#5

In VDMX
Maybe try putting quotes around “$VAL”

0 Likes