Forum

[vvvv Beginner] String condition to result an Integer

Hi everybody!

I’m a beginner with vvvv and I’m trying do make something simple :

I am receiving OSC signals like this :

/controller/red
/controller/orange
/controller/yellow
etc…

At the final of the OSC part, I’m receiving perfectly the name of the colour as string.

http://img11.imageshack.us/img11/2204/zxus.gif

Now, with a vvvv box( = string ) I can compare 2 strings perfectly but when I compare the OSC string output, the vvvv box ( = string ) doesn´t work and the output still 0.

The next question is what is the correct way to make in vvvv the equivalent of this code :

switch (OSC_color_string){
case “red”:
output_int_to_drive_switch = 0;
break;
case “orange”:
output_int_to_drive_switch = 1;
break;
case “yellow”:
output_int_to_drive_switch = 2;
break;

… etc …

}

Or exactly when I have red on the OSC output string, I get the 0 integer result and :

red -> 0
orange -> 1
yellow -> 2
green -> 3
sky -> 4
blue -> 5
pink ->6
grey -> 7
white -> 8

I’m totally lost with this really simple problem.

Please help :)

hei axxel, please check the osc examples in
girlpower\IO\Networking\2_Advanced (OSC)
then come back if your question is not solved.

Hi.

Thanks for your answer.

The file you are talking me doesn’t exists.

http://img547.imageshack.us/img547/7320/jh0.GIF

I use the last 64 bit version of vvvv 45beta 29.2

as joreg said, you should definitely use the OSC nodes.
and for the fun of your switch problem, here is a patch parsing your example string and switching the numbers.

but considering your problem, why don’t you send the hex value directly and put it into the AsColor node?

SwitchLogic.v4p (11.4 kB)

Yeah thanks for your answer!

I think it can works!

But the problem is the ( = ) function doesn’t work… Always returns 0…

Test OSC Colors.v4p (27.9 kB)

those patches i mentioned ship with beta31. is there a reason why you don’t use the latest?

the = node needs the exact same string, if there is one character different it returns 0. so make sure you send the string without any space or other invisible characters. here is your patch using the OSC nodes:

Test OSC Colors2.v4p (32.0 kB)

Ok perfect thanks a lot to everyone!

It works. Finally the problem was my OSC controller, it was sending only integer values and I saw vvvv only accepts strings. Then I made the modification. Before the problem with the ( = ) didn’t working was for hidden characters. And I actualized to 31, and I saw the examples perfectly :)

Thanks everybody :)

I will publish soon the Android controller with this example included :)

Here is a patch I would not have known that I would like to see if I had your problem when I was a newbie.

Use spreads more consistently vvvv to make your life easier in vvvv.

Test OSC Colors3.v4p (18.8 kB)