According to my search engine page view requests it seems that lots of people are Googling these error messages so I thought I’d chuck a few more in to help people in their time of need.
viewport.setcamera = newCam >> MAXScript Rollout Handler Exception: -- Unknown property: "SetCamera" in #Struct:viewport(
This is quite easy to do as it seems like you need to set a property to to tell the viewport which camera it should be, where as actually it’s a method function so you want to pass it an argument, see below how it should be.
fn myfunction arg ( ) -- Error occurred in anonymous codeblock; filename: Y:\test.ms; position: 2023; line: 10 -- Syntax error: at (, expected = -- In line: (
Another of the sometimes hard to trace bracket problems, it’s an easy mistake to make but can take bloody ages to spot why, when you’ve just missed out an = sign…. sigh…
fn myfunction arg = ( ) doesfileexist (getdir #maxroot) + "plugins\\Test.dlx" -- No ""+"" function for true
It can be quite easy to forget to bracket things in a way which leaves no confusion to a computer, in the example above it thinks it needs to evaluate doesfileexist and then add this to “plugins\\Test.dlx” not add (getdir #maxroot) to “plugins\\Test.dlx”. I’m always in favour of putting in extra brackets to make damn sure you know what order things will be processed in.
doesfileexist ((getdir #maxroot) + "plugins\Test.dlx")
ObjsIwant = for o in objNames where matchPattern o pattern:"*mesa*" collect o mergeMAXFile "c:\\project\\ep002_background_02.max" Objsiwant
and this is the error:
-- Error occurred in anonymous codeblock; filename: c:\project\merge_pattern.ms; position: 203; line: 3 -- No "map" function for undefined
No ‘Map’ for undefined means the for loop doesn’t know what it’s looking in, in this case objNames wasn’t defined beforehand., so instead of the for loop looking in an array the loop was trying to use an unknown value which wasn’t an array it was just ‘undefined’
show standardmaterial() -- Argument count error: show wanted 1, got 2
Whenever you want to call the Show (or ShowProperties) function remember if you’re creating an instance to get the properties of you need to encase it in brackets.
It’s worth noting that you are creating instances doing this, this is quite obvious when you try using a node/object type.
You’ll now have a sphere in your scene at [0,0,0]
s = CREATE_XML_Xmesh_test_01_.MS -- Unknown property: "MS" in undefined
This can be a silly thing when you’ve simply forgotten to put quotation marks around a string value.
s = "CREATE_XML_Xmesh_test_01_.MS"