Create objects with dynamic names

Jul 12, 2007 at 5:05pm

Create objects with dynamic names

Hi there.

I’m trying to create objects with dynamic names.

I vas trying something like this

script new vol$2 newex 160 500 27 9109513 *~

i.e. $2 is a name and I’m trying to concatenate (prepend) the “vol”.

but it doesn’t work…

Any idea?

#32861
Jul 12, 2007 at 5:36pm

Use sprintf

On 7/12/07 1:05 PM, “amietbeach” wrote:

>
> Hi there.
>
> I’m trying to create objects with dynamic names.
>
> I vas trying something like this
>
> script new vol$2 newex 160 500 27 9109513 *~
>
> i.e. $2 is a name and I’m trying to concatenate (prepend) the “vol”.
>
> but it doesn’t work…
>
> Any idea?
>
>

Cheers
Gary Lee Nelson
Oberlin College
http://www.timara.oberlin.edu/GaryLeeNelson

#108729
Jul 12, 2007 at 5:39pm

There is also a tutorial on scripting in the max folder.

On 7/12/07 1:05 PM, “amietbeach” wrote:

>
> Hi there.
>
> I’m trying to create objects with dynamic names.
>
> I vas trying something like this
>
> script new vol$2 newex 160 500 27 9109513 *~
>
> i.e. $2 is a name and I’m trying to concatenate (prepend) the “vol”.
>
> but it doesn’t work…
>
> Any idea?
>
>

Cheers
Gary Lee Nelson
Oberlin College
http://www.timara.oberlin.edu/GaryLeeNelson

#108730
Jul 12, 2007 at 6:55pm

it would work with $2vol

the messagebox (and any other variable-savvy extern for that matter)
knows how to expand a variable only if it’s at the beginning of a
symbol.

hth

/*j

> script new vol$2 newex 160 500 27 9109513 *~
>
> i.e. $2 is a name and I’m trying to concatenate (prepend) the “vol”.

#108731
Jul 12, 2007 at 8:27pm

Jasch your solution is perfect!

Cheers lads!

#108732

You must be logged in to reply to this topic.