ltdrdata / ComfyUI-extension-tutorials

579 stars 32 forks source link

Quantifying Wildcard Issue? #47

Open gobshyte opened 4 months ago

gobshyte commented 4 months ago

Hi

I'm trying to use the quantifying wildcard, as described here: https://github.com/ltdrdata/ComfyUI-extension-tutorials/blob/Main/ComfyUI-Impact-Pack/tutorial/ImpactWildcard.md#syntax

Qunatifying wildcard: $$count#wildcards repeats wildcards many as count
   {2$$, $$5#__wildcards__} turns into {2$$, $$__wildcards__|__wildcards__|__wildcards__|__wildcards__|__wildcards__}

In my initial testing, I had a simple file with colours in, and I wanted to randomly select 1-4 colors, so I did this:

{1-4$$4#__colour__}
Light Grey Amber

This is the same as if I did this:

{1-4$$__color__|__color__|__color__|__color__}
Blue White Red

However, if I want to put commas between them...

This works:

{1-4$$__color__,|__color__,|__color__,|__color__,}
Yellow, Purple, Tan

But this behaves a little unexpectedly:

{1-4$$4#__color__,}
Green Grey Magenta, Yellow
Dark Purple, Light Grey Dark Grey Rainbow
Dark Grey, Violet Navy Blue
Dark Green Magenta

It seems off with multiple quantifiers also:

{4$$2#__color__ color,|2#__shape__ shape,}
sphere square shape, Aqua Light Grey color,
Purple Orange color, diamond shape, cube

It's like any constant value in each wildcard is only included once and is not being picked up by the quantifier?

ltdrdata commented 4 months ago

As explained in the syntax description, $$count#wildcards is syntax that affects only a single wildcard.

The current wildcard system is borrowed from an existing wildcard system for convenience. While it works fine for simple wildcards, its intuitiveness significantly diminishes as more complex syntax is introduced. TBH, since it is not well-formed syntax, it's hard to know where grammatical conflicts might occur.

So, I believe it is appropriate to devise a separate prompt description language for any syntactic elements other than __xxx__ or {||}.

gobshyte commented 4 months ago

Yeah I was under the impression the 'wildcard' was anything between || rather than xxx, and agreed it is confusing. I love using them regardless!!