# Scripting fluid.object creation/connecting (generic attribute bug?)

**URL:** https://discourse.flucoma.org/t/scripting-fluid-object-creation-connecting-generic-attribute-bug/2075
**Category:** Bug Reports and Issues
**Created:** [August 18, 2023, 8:14pm UTC](https://discourse.flucoma.org/t/scripting-fluid-object-creation-connecting-generic-attribute-bug/2075 "2023-08-18T20:14:23Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![rodrigo.constanzo](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/rodrigo.constanzo/32/12_2.png) [@rodrigo.constanzo](https://discourse.flucoma.org/u/rodrigo.constanzo)
#### Post date: [August 18, 2023, 8:14pm UTC](https://discourse.flucoma.org/t/scripting-fluid-object-creation-connecting-generic-attribute-bug/2075/1 "2023-08-18T20:14:23Z")

</div>

TLDR:  
-`fluid.objects` don’t respond to “generic” attributes (`varname`, `patching_rect`, etc…)  
-can’t script/connect `fluid.objects` as a result  
-not sure how to script the creation of an object with wildcards _&_ additional attributes (`@fixwidth 1`)

//////////////////////////////////////////////////////////////////////////////////////////////////////////////

So building something using `fluid.nmfilter~` and I’d like to have it be (behind-the-scenes) dynamically sizeable.

My initial thought was to just make a max amount of components I may want (say 16), and then `mc.pack~` and deal with the empty channels later on.

Turns out that that’s really expensive as `fluid.nmffilter~` does it’s thing whether or not there’s stuff in those channels, making `fluid.nmffilter~ 16` expensive, just sitting there.

//////////////////////////////////////////////////////////////////////////////////////////////////////////////

SO

I wanted to dust off some of the oldschool/arcane magic and script object creation, movement, connecting etc… to basically make something like this:

![Screenshot 2023-08-18 at 9.05.06 PM](https://discourse.flucoma.org/uploads/default/original/2X/1/1aada1621dfb2e6018f8e38a7fc3b1ce5c88f10e.png)

What’s in the red.

In trying to do this I’m running into a couple problems.

One is a more general Max one where I don’t know how to instantiate the object while having wildcards (`#0`) in the name AND still set general/global attributes after (`@fixwidth 1` so it’s not all smooshed up).

So I can do this:  
`script newobject fluid.nmffilter~ 16 @bases sorted @fftsettings 512 64 512 @maxfftsize 2048 @maxcomponents 16 @maxmaxcomponents 16` but that creates a really smooshed thing:

![Screenshot 2023-08-18 at 9.07.24 PM](https://discourse.flucoma.org/uploads/default/original/2X/a/acddabe02006c551d6f4df6649b27036d3f9f43b.png)

Ok, I can put the stuff in a `@text` attribute, and then shove the `@fixwidth 1` at the end, like so:  
`script newobject newobj @text "fluid.nmffilter~ 16 @bases sorted @fftsettings 512 64 512 @maxfftsize 2048 @maxcomponents 16 @maxmaxcomponents 16" @fixwidth 1`

That works, but I can no longer wildcard the amount of components (`16`s in this example).

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////

BUT

All of this is moot when I realized that for some reason, I can’t set the `varname` of `fluid.nmffilter~` other than manually typing it into the info pane.

If I send `varname foo` to `fluid.nmffilter~` I get:

 ![Screenshot 2023-08-18 at 9.10.13 PM](https://discourse.flucoma.org/uploads/default/original/2X/6/67d95b61092b981147206a21863dfdcb76ceb6ed.png)

This appears to be the case for all the “generic” attributes (`patching_rect`, etc…).

Is this intentional or a bug/oversight?

The reason this is important in this case is because the objects need to have scripting names to be able to script connections between them (e.g. `script connect foo 0 bar 0`). So if I can’t dynamically create a `fluid.nmffilter~` with a scripting name attached, I can’t go forward and make connections between it and subsequent objects.

edit:  
Initially made this as “Usage Question” category, but I think the attribute problem seems more important, so changed it to “Bug Reports” instead.

---

<div class="post-metadata">

### Author: ![jln](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/jln/32/1772_2.png) [@jln](https://discourse.flucoma.org/u/jln)
#### Post date: [August 18, 2023, 10:19pm UTC](https://discourse.flucoma.org/t/scripting-fluid-object-creation-connecting-generic-attribute-bug/2075/2 "2023-08-18T22:19:06Z")

</div>

Hi Rodrigo,

> [@](#):
>
> If I send `varname foo` to `fluid.nmffilter~` I get:
> 
> ![Screenshot 2023-08-18 at 9.10.13 PM](https://discourse.flucoma.org/uploads/default/original/2X/6/67d95b61092b981147206a21863dfdcb76ceb6ed.png)
> 
> This appears to be the case for all the “generic” attributes (`patching_rect`, etc…).
> 
> Is this intentional or a bug/oversight?
> 
> The reason this is important in this case is because the objects need to have scripting names to be able to script connections between them (e.g. `script connect foo 0 bar 0`). So if I can’t dynamically create a `fluid.nmffilter~` with a scripting name attached, I can’t go forward and make connections between it and subsequent objects.

I remember running into this with objects other than Flucoma’s. Actually, I just tested again with a couple of Max objects (splay~, gate) and one cannot set varname with a message. SO that’s not a Flucoma issue, I assume.

Unless I am missing something, does something like this work for you ?

Best  
[flucoma scripting.zip](https://discourse.flucoma.org/uploads/short-url/qH9MXytVJMiLlwZ8eHlYuFrdJAX.zip) (2.8 KB)  
,  
Julien

---

<div class="post-metadata">

### Author: ![rodrigo.constanzo](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/rodrigo.constanzo/32/12_2.png) [@rodrigo.constanzo](https://discourse.flucoma.org/u/rodrigo.constanzo)
#### Post date: [August 18, 2023, 10:33pm UTC](https://discourse.flucoma.org/t/scripting-fluid-object-creation-connecting-generic-attribute-bug/2075/3 "2023-08-18T22:33:33Z")

</div>

Ah interesting.

So I guess the `#1` stuff penetrates the “text” thing (whereas `$1` stuff does not).

And right, having the `@varname` outside of the “text” seems to work as well.

Cool, I can work with that! Thanks.

---

<div class="post-metadata">

### Author: ![jamesbradbury](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/jamesbradbury/32/1252_2.png) [@jamesbradbury](https://discourse.flucoma.org/u/jamesbradbury)
#### Post date: [August 19, 2023, 4:36am UTC](https://discourse.flucoma.org/t/scripting-fluid-object-creation-connecting-generic-attribute-bug/2075/4 "2023-08-19T04:36:50Z")

</div>

Yeah for a fully comprehensive example of scripting flucoma-like objets, see the final tab which describes blocking. Pretty sure I scripted all of that.

---

<div class="post-metadata">

### Author: ![rodrigo.constanzo](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/rodrigo.constanzo/32/12_2.png) [@rodrigo.constanzo](https://discourse.flucoma.org/u/rodrigo.constanzo)
#### Post date: [August 19, 2023, 9:18am UTC](https://discourse.flucoma.org/t/scripting-fluid-object-creation-connecting-generic-attribute-bug/2075/5 "2023-08-19T09:18:38Z")

</div>

Turns out using some vanilla `pack` + `tosymbol` seems to work well too (at being able to add wildcards at the same level).

edit:

Here’s the patch for creating it, connecting it to before/after, and being able to change the fftsettings too.

 ![Screenshot 2023-08-19 at 10.59.57 AM](https://discourse.flucoma.org/uploads/default/original/2X/0/0dc5bb09052ed85486f70db89d86df8520aefc45.png)

```

----------begin_max5_patcher----------
1424.3ocyZssaihCF95jmBK5b0pLQ1FLG18ltu.qzd8pQUDhSqmkCQ.oSmYz
zm8821.IcBDLMNLaiDIXL96+6+Ll98kKb1T7BuxA86n+AsXw2WtXgZH4.KZN
egSV7KIowUpo4jy+RwlO6rReoZ9K0pgqQaPosiVbnNkWW+08b8J6rIN+QmUH
GGzmZlhXq51fk5iAQs2W9gLQNbmJjHMCtOtN4IQ9iOTxSp0qmOCuNzK53e3n
UHBwaMdEx2aMaEhRWi6vBVVsDoVWpbverbo7vpqizOitCuaWcEvUP.qFj98R
aV3TocP.acDM33mHWfoLpj1gpiWf1j2Asy3UUwOxOi2LBEzyH3qIRY+doLch
VZOsgN5Fv3ALzoEwakJCz6l4rIarcYqcGvGmPcmQqMAS8.HCQxeLMZ6wrhAG
76kt3ynA+phr8bmbBsH+dL1rnYOxtJoTruFkTjmCBGnDD46OTivvuxy1sSjV
yKQf3b17xRVuON4eUyDjM0M0t5oBXREGxUP30pEJ4U7753ZQQ9CuYF9SRY6N
YWLBSEDQActLVxSEK4OO5W2o4IQmL4ngMYHvZNNRwvafuyVNr37ScX5bW5tT
i2RuNHzoogvS17SZzJ5BmDOka.js8WR70wnpOPNIL5Cjd0MtSR2L4pst3nSh
LzdRdQyQ91CeSfbOlwXvFHa+VH0G84NPdmALMdC5VKtP.iq83b8ShJk.wKGN
qvPMMyBlZMFOl6ZB9j+nP2iLhxh6GLBsaUfUwO2JZ28WRg6Mj.47GxC282xi
77s5QPexd5LnpwdXgQMwIuNwtvvVQo0l4.GNeMjT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