[Closed] Trying to convert string array to object array
Im a newbie trying to convert a string (MergedArrayNames) to an object array called: MergedObjectArray
However, when I try to access the MergedObjectArray, I get an error:
Runtime error: Attempt to access deleted scene object.
Heres my code
–First I merge a file and Get the object names in the file…
mergeMAXFile AFile
MergedArrayNames = getMAXFileObjectNames AFile
–Then I attempt to Loop through the objects To find the ones in the MergedArrayNames
for x in objects do
(
ThisObjectIsRepresentedInStringArray = for qq = 1 to MergedArrayNames.count where x.name == MergedArrayNames[qq] collect x
append MergedObjectArray ThisObjectIsRepresentedInStringArray
)
Any help would be appreciated.
Thanks
Hamster139
I’m not with MAX right now, so I can’t verify if this works:
mergeMAXFile AFile
MergedArrayNames = getMAXFileObjectNames AFile
local sakArray = #()
for o in objects do (
for i = 1 to mergedArrayNames.count do (
if (mergedArrayNames[i] == o.name) then (
append sakArray mergedArrayNames[i]
)
)
)
Stev
Thanks for the code, I figured out my mistake; by looking at your code.
I forgot to clear out the global array each time (How embarrasing).
RodentMan