how to select objects using string variable?

Hello. I'm scripting for a while now but I'm always stuck at a problem what I couldn't resolve no matter how much I read the MaxScript reference... maybe I just overlooked somethin. but the fact is fact I still don't know how to do. So the question is how can I put in a string variable after a $ sign...

So put it to example:

--I make the name of my objects.
myobjectname="stone"
--I create my object.
box isSelected:on
--I name my object.
$.name = myobjectname
--I want to select all previous objects with the same name
select $(myobjectname)*

So at the last line I just simply don't know what to do, if someone could help me pls.

Thx a lot G.I.Gig

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
martinskinner's picture

try this, it worked for

try this, it worked for me;

replace your last line with:

select (for o in objects where o.name == myobjectname collect o)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.