[Closed] Apply id by selection order
I’ve filtered the suffix of some nodes with filterString
parsedName = filterString nameToParse "\object_00"
That would leave me with some variables called 1,2,3,4 and so on.
I need to convert those string values to numbers.
I’ve tried to interpret that string with “as integer” (I need to plug the suffix in a variable to set some material IDs)
but maxscript complains –Unable to convert: #(“1”) to type:Integer
You aren’t trying to convert the text “1” to a number value, you’re trying convert #(“1”) to a number which is an array value instead.
Filterstring returns an array value so I’m guessing you’ll need something like,
parsedName = filterString nameToParse “\object_00”
index = parsedName[1]
I’ve tried that, but now the error is
–Unable to convert: “1” to type:Integer
(the # symbol is gone)
Try this:
parsedName = filterString nameToParse “\object_00”
index = parsedName[1] as integer
index = parsedName[1] as integer doesn’t work
index = (parsedName[1] as integer) works