How to change args in a [bpatcher]?

Brian H.'s icon

Hi,
This seems like it might be simple, but I'm going in circles. ALl I want to do is send a msg to a [bpatcher] to change the argument from one int to another. I've tried sending the msg "send args 2" into the [bpatcher] and then a [thispatcher] object. Also tried several other varients, and keep getting Max window errors about patcher not understanding "send" or "args" (I'm not sure I see where a [patcher] in involved at all). Can't find anything straightforward enough at 1 AM in the docs or forum. Just a quick pointer should be all...

Thanks,
Brian

Roman Thilenius's icon

i could be wrong - mainly because i hardly use max5 - but i
dont see how you could change the argumens to bpatcher by
a message. dont forget, those are arguments to the bpatcher
object, not to the bpatcher. (hope that makes sense)

do you have an [i #1] already somewhere in your bpatcher patch?
eventually it is enough to send new values right to the place
where they are needed?

Brian H.'s icon

Hi,
Well, I think an argument to the object itself is what I need here (?). I'm looking for the equivalent of providing a custom argument, just as would be done with a [patcher], but this needs to be a [bpatcher] instead. The inspector has an arguments field, so I just need to be able to change that attribute. The number could originate inside or outside the [bpatcher], I work around that. Seems like a place to use [thispatcher] inside [bpatcher], but I'm pretty new at use of those objects.

Any input?

Many thanks,
Brian

Luke Hall's icon

All you get is the argument attribute in the inspector, if you want to change this after instantiation you need to patch in a seperate [inlet] or add a keyword and use [route] and send this data to the same place as [patcherargs].

lh

Brian H.'s icon

Really? That seems odd...I had it in my head otherwise. Just to be clear, if this was a [patcher] and not [bpatcher] I could easily feed it a new argument, is that correct?

Thanks a lot for the help,
Brian

Luke Hall's icon

The arguments are used to set certain variables at instantiation. If you want to change a particular variable programmatically (ie not in edit mode) then you will have to set an [inlet] to do this. The easiest way to do this is to set up a [route] with all your variable keywords and patch them to the same location as your [patcherargs] object.

Edit: Obviously [patcherargs] won't fire if you copy and paste from the forum, you'd need to save and re-open the patch.

lh

Max Patch
Copy patch and select New From Clipboard in Max.

Brian H.'s icon

OK, I see the system...But my problem is that I'd have to somehow individually update my use of #1 notation around the patch then, since it will always refer to the initial argument? Unless there is another reasonable trick, I'll have to either do that or use a different object (like [value], [pv], etc.).

Thanks,
Brian

Roman Thilenius's icon

Brian H. wrote on Sat, 12 September 2009 19:19Really? That seems odd...I had it in my head otherwise. Just to be clear, if this was a [patcher] and not [bpatcher] I could easily feed it a new argument, is that correct?

...no, not all all.

arguments to patcher should work like arguments to objects, or
in other words, they appear only if used inside and they are
initialised only when loadbanged inside.

you can, for example, use [loadbang]-[f #1] to get the first argument.

now if you would change the argument to patcher, the [f #1]
cannot update, because it is not loadbanged.

normally (normally as in "like with objects") you would simply have
an inlet for the [f #1] in order to update this "parameter" when you
want to be it something else than the initial status from the frist
argument to patcher/bpatcher.

the only thing what work of course is (re)scripting the bpatcher object
with new arguments. did you mean that?

-110

.

Brian H.'s icon

Hmmm...so I see, what you're presenting makes sense. I think I saw the args attribute and got all excited, or somehow otherwise assumed this could be done. I don't think scripting (at least as I understand it) will help much here. I can work-around it all because this is a fairly simple section of a much less-simple patch. Thanks for setting me straight.

Wojciech Morawski's icon
Max Patch
Copy patch and select New From Clipboard in Max.

You can do it like that -example below.
For more check "thispatcher" objects help and try to find something about scripting
:)