Hey,
In several patches I had the following problem: I make a patch that I'm going to use in another patch. To make it possible to use several of these subpatches in the main patch, I add a dollarsign where needed. But when I apply this to arrays, I cannot make it work. For example a block that applies a window. It's nothing more than a tabread block. But I have four files with a window in. So I call the array to read: $1-window. But when I want to read it with a message: $1-window read gaussBig.txt, it doesn't load. Probably this is because of the ambiguity between dollarsigns in a message and elsewhere, or maybe due to the dollarsign not being replaced in the name of an array. Anyone any idea how to deal with this?
I refer also to the documentation of this block on our website: http://idafx.blogspot.com/2007/04/mapwindow-pdf-in-this-document-one-can.htm...
Another small problem: can you leave a graph visible in a subpatch (thus with graph on parent selected) without seeing it in the mainpatch where this subpatch is used in? Because when i select graph on parent for the graph, the graph also appears in the parent patch at the same place, being next to the block from the subpatch.
Hallo, ronny vanden bempt hat gesagt: // ronny vanden bempt wrote:
In several patches I had the following problem: I make a patch that I'm going to use in another patch. To make it possible to use several of these subpatches in the main patch, I add a dollarsign where needed. But when I apply this to arrays, I cannot make it work. For example a block that applies a window. It's nothing more than a tabread block. But I have four files with a window in. So I call the array to read: $1-window. But when I want to read it with a message: $1-window read gaussBig.txt, it doesn't load. Probably this is because of the ambiguity between dollarsigns in a message and elsewhere,
Exactly this is the reason. (Read on)
or maybe due to the dollarsign not being replaced in the name of an array.
This is not the reason: Array names are just like any other name in Pd, no exception.
But as you already wrote: dollar signs in messages and dollar signs in object boxes are different. They are similar in that they both get replaced by "something". But this "something" is different: message boxes use, what they receive through their inlet, to do $-replacements. You've probably already used this for example to generate an "read file" message, for example for [textfile], when using [openpanel]. It looks like this:
[bang( | [openpanel] | [read $1( | [textfile]
[openpanel] will send a message like "symbol /tmp/file.txt". The $1 in "read $1" will take the first element of this message (counted without the "symbol"-thing) and replace $1 with that so that you get a "read /tmp/file.txt" message to [textfile].
In object boxes, $-variables however take the arguments that *a patch* was created with to do the replacement. Patch arguments aren't bound to messages. Even objects that don't have inlets for messages *at all* can use argument dollar signs: an example would be [r $1-something].
Now what you need to do is convert a dollarsign as it is used in object boxes to one, that is used in a message. That's actually very simple: You first create an object with a dollarsign to get the "object dollar", and then you connect this object to a message box with a "message dollar" inside. Example:
[bang( | [symbol $1] | [read $1( | [textfile]
The number - 1 in the example - can even be different, depending on where your wanted argument is:
[bang( | [symbol $3] | [read $1( | [textfile]
That is possible, because object dollars and message dollars are completely independent from each other.
Oh, and don't forget this: $0 is something else again and there is no $0 in a message box.
Frank Barknecht _ ______footils.org_ __goto10.org__
# Hi, # Becauseof its special usage, could it be a good idea to allow using $0 in message boxes? Or is it a bad idea? :-) # One needs often to use $0 in message boxes (but this gives an errr of course) But it'll make an ambiguity between the $'s in object boxes and message boxes. -ugur guney-
That is possible, because object dollars and message dollars are completely independent from each other.
Oh, and don't forget this: $0 is something else again and there is no $0 in a message box.
Ciao
Frank Barknecht _ ______footils.org_ __goto10.org__
Hallo, ugur guney hat gesagt: // ugur guney wrote:
# Becauseof its special usage, could it be a good idea to allow using $0 in message boxes? Or is it a bad idea? :-) # One needs often to use $0 in message boxes (but this gives an errr of course) But it'll make an ambiguity between the $'s in object boxes and message boxes.
This discussion came up several times in the past. So far the people who didn't like $0 in message boxes always have won. ;)
I think, now that Pd (0.40/1) got a setable [send] and especially $-replacement in the middle of a symbol (not only at the start as it was until 0.39) the need to actually use $0 in a message box became less urgent. (See attachement)
Frank Barknecht _ ______footils.org_ __goto10.org__
On Sun, 29 Apr 2007 16:33:39 +0200 "ronny vanden bempt" ronny.vandenbempt@gmail.com wrote:
Hey,
In several patches I had the following problem: I make a patch that I'm going to use in another patch. To make it possible to use several of these subpatches in the main patch, I add a dollarsign where needed. But when I apply this to arrays, I cannot make it work. For example a block that applies a window. It's nothing more than a tabread block. But I have four files with a window in. So I call the array to read: $1-window. But when I want to read it with a message: $1-window read gaussBig.txt, it doesn't load. Probably this is because of the ambiguity between dollarsigns in a message and elsewhere, or maybe due to the dollarsign not being replaced in the name of an array. Anyone any idea how to deal with this?
Put it in an abstraction. There is currently no real local scope in Pd. That's something I would like to see change, but for now you must create abstractions. The $1 is expanded to a random UID that is per patch, so two or more $1-things will not actually be unique within the same patch.
I refer also to the documentation of this block on our website: http://idafx.blogspot.com/2007/04/mapwindow-pdf-in-this-document-one-can.htm...
Another small problem: can you leave a graph visible in a subpatch (thus with graph on parent selected) without seeing it in the mainpatch where this subpatch is used in? Because when i select graph on parent for the graph, the graph also appears in the parent patch at the same place, being next to the block from the subpatch.
This has varied with different Pd versions. In the past you could just place it off the GOP area and not see it. I believe that changed > 0.4. You can make a subpatch to hide your arrays in and still have them easy to see if you need to.
-- Ronny Vanden Bempt (0486)510841 www.ropefly.com www.hetdepot.be [home]riddersstraat 226, 3000 Leuven [dom]verbindingslaan 36, 3001 Heverlee