Hello, I'm new to Puredata and programming in general.
I've been looking everywhere to create variables in order to call them in objects, for example :
-a "random" creates a number that changes everytime that I want to call "A"
-I want to make it the goal value of a "line"
Sorry if I don't express it properly !
Thank you for your answers.
-
How to make and recall variables
-
@trotu Hi and welcome to Pd. I suggest you read this before you start understanding how the flow of operation works in Pd.
https://forum.pdpatchrepo.info/topic/5692/hot-and-cold-inlets-execution-order-and-triggerThen this might help with your particular question, although I'm not entirely sure I understood what you are trying to achieve precisely.
store_values.pd -
Thank you ! This is what I was searching for (I think the pack helps a lot).
-
the [v] object allows for the creation and recollection of global variables. You would use it by calling the object and giving it a name. ie: [v foo]. Now, any time you create an instance of [v foo]. you can send it numbers to set it's value globally, or send a bang to recall it's value locally. If you need to create variables which have symbols or other kinds of data for it's value, then this can be accomplished in several ways. I tend to use cyclone/coll for this. Coll objects can hold a text file that acts as a list of variables and values which can be set and recalled dynamically. A named coll object will also become global in it's scope. Theres a few other ways to do this as well, but this is my goto.
I think the pvar object is like V object only it operates only on a local scope. hope that helps
-
It may be just a matter of preference, but i almost always use send/receive instead of the value object. I like this because i can use $0-names with $0 in the beginning and it is consistent with storing symbols (using symbol object instead of float object to store the value). Also i can mix it with the build-in sends/receives of the number boxes.
Edit: Ok, the comment for the last example is not true anymore with this method in the sense it was originally intended.