Some questions: switch (color) ? is that the right node? + input from txt-file

Hello!

  1. I made a patch that actually works but since hours I don`t get one thing: is it right to use the node “switch (color)” if I want to use one of the possible 4 color-values?

I track my mouse activity and translate it to RGB.
RED and GREEN depends on mouse X and Y
the mouse klicks should produce different values of BLUE.
there are 4 values:

  • no klick (default)
  • klick left
  • middle
  • klick right

if any of 3 klick-actions detected, the colour should change. but it doesn`t work… where is my bug?

I attach the patch here.

  1. I have a txt-file that I use as an input. There are only digits - in one line - from 000 up to 255. like this: 234167003005227… I want the Reader to read 3 digits per second. First 3 digits, second 3 digits, 3rd 3 digits and so on… How can I split them? Any idea - which node do I use?

I hope somebody can help. (Im sure, the solution is easy, but I dont get it right now).

Thanks! Juliett.

Moustracking-RGB_1.v4p (15.0 kB)

Hallo, you should use your clicks to decide wich of the 4 for colors you want to switch to. I patched an little example on how to do that (sure there are better ways).

Why do you map your values 2 times? you should be able to do it with 1 map node?

For your second question, a Split (String) should work, and than a getslice connected to an LFO, it is in the same patch.

But it is always better to use some kind off seperator between your values, like a space or a $ or something.

Moustracking-RGB_1.v4p (26.9 kB)

WOW!

I dont really understand how you did it (moustracking), but after a while Ill surely get it. It looks a bit complicated, but it works! Thanks.

I do map 2 times just because I normally work with 0-255 RGB. So its easier for me if I always see and controll the usual RGB value. Thats the only reason.

Sorry, what do you mean with using separator? Should i have separatet digits already in txt-file? Or you mean i should separate them while reading?

Thanks. Juliett.

The Mousetracking part, well, since a mouse press only produces a 0 or 1, you can see them as Booleans. So if I put them all three in a spread (with the Cons node), I get a 3-slice spread, with the status off the 3 mouse buttons. Next I used the select node to get the values back from the Booleans, so I know what slice goes with what mouse press.

When there is nothing pressed, the Select node gives a Nill (empty) spread. The great replaceempty node (open it up (press right) and try to understand how it works ;) ) is used in that case to replace the Nill with a 3, so I can use that 3 to switch to the Default value.

And in the end we have a switch… wich I am sure you understand.

I don’t know how your textfile is generated offcours, but yes, a seperator is used in between values you are interested in. It makes it a bit more save, that is all. When you have 10000 values, and you missed 1 value, all values get messed up!! But with a seperator, only 1 value will be wrong.

Hehe, lucky for me I am already used to values between 0 and 1, so I don’t have to map that much.

Hope this info helped a bit, if not, blame it on me not sleeping enough!! :D

OK, I see. I didnt expext this explanation - it was really helpfull. Im just getting started working with vvvv and it`s really something that I´ve missed the whole time. So it looks like a am going to post a lot of questions in the vvvvorum the next time…

Im going to have thousands of values in the txt-file, so ill make a separation.Im sure its easy.

hmmm… but wouldnt MultiFlipFlop (Animation) do the Cons Select Replaceempty thing somehow easier?

I think good idea is to use a new line for every new set off values.

Quote: (sure there are better ways).

Mutlifliflop, totaly forget that one…needs 2 extra nodes to switch back to the default value.

MousMulti.v4p (16.7 kB)

Looks elagant. And easyer to understand. Thanks.