geting the name of a selected object

I know this is such a stupid question.. but ive looked and looked and just can't find out how to get the name of the object selected

previously ive worked on code which itterates through all of the objects in a scene and grabs their names, it does like so:

someObj.name

but when i try

$.name
or
$.baseObject.name

but I just can't find the way to do it.. Oh god how I love the sugestions box that you get with a proper IDE.. Maxscript would be so much more newb friendly if it had one

Comments

Comment viewing options

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

-.- modelTxt.text =

-.-
modelTxt.text = selection[1].name

i tried that and i got:

-- Error occurred in anonymous codeblock; filename: J:\Dropbox\ICT312 (1)\scripts\entityAttribs.ms; position: 867; line: 39
-- Syntax error: at ., expected name
--  In line: 		modelTxt.t

so i tried:

modelTxt.text = ""

and same thing..

yet this works:

on selectModel pressed do
(
	modelName = getModelName()
	modelTxt.text = removeExtensions(modelName)
)

-.- i wish i had of chosen to use the C++ plugin creation option rather than maxscript

barigazy's picture

If one object is selected

If one object is selected then you can use

 
objName = selection[1].name


but if you want to collect all name in current selections then:

 
namesArray = for s in selection collect s.name

bga

falconmick's picture

out of curiosity, how did you

out of curiosity, how did you learn all that you know?

barigazy's picture

Can you attach your

Can you attach your "entityAttribs" script.
I can't help you if not know what you want to achive.
These fragments of the code means nothing to me.

bga

Comment viewing options

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