Forum

Best approach to a variable

Hi,
I would like to know if there is an approach to use an IObox as variable that can be modified from different sources, like in many programming languages, where you can change a variable’s value from different code’s sections.

Thanks,
Gustavo

hi,
you might like S+H (Animation) , it can sample & hold values. when preceded by a Switch (Value Input) , you can control which value (which source) it samples.
to avoid messy patches, don’t forget to refactor any working complete parts of your patch into modules. if the links get ugly, consider S (Value) and R (Value) .
good luck!

hi gbravetti, thats a real good one !
you are asking about real true global variables.
unfortunately, there seems not to be modifiying node from everywhere.

S and R are only working with unic identifiers.
wich means you can receive with as many identifier you want R nodes, but there will be only one S. So to this S needs to be conected to a switch.

S and R works all around vvvv as global variables for transiting data. all around all opened patches

be aware to rename the name of variable when created R node at minimum once ( or when opening your patch you will loose variable name in R)

if you find a way to access writing as real global varible ( or devvvs), please let us know…

That will work for the moment.

I just found an approach to a global variable using a useful module from Kalle → Edit (Spreads).v4p (http://vvvv.org/tiki-index.php?page=kalle.Modules.Spreads thanks Kalle!)

Here is a screenshot and the patch, let me know if this could be achieved easily.

http://gbravetti.fileburst.com/images/forums/vvvv/global_variable_approach.png

Best, and thanks about your help.
Gustavo

hi gustavo… manythanks for your screenshot.

for once I could beat Kalle … he beatted me ( tahts normal, Kalle is Grrrrrreat : ) without being around ! ;-)

…Framedelay node… all is there !!! ;-)