Notifications
Clear all

[Closed] How can use a function name as object name?

I would like to use that function name (popo) as the object name.
But It was “undefined”
How do I modify the function below?

 fn CreateConObject ConOBJ OBJRadius = 
(
	 local conObject = ConOBJ
	 conObject = Circle radius:OBJRadius pos:[0,0,0]
	 conObject.name = ConOBJ as string
	 convertToSplineShape conObject
	 conObject_copy = copy conObject
	 rotate ConObject_copy (angleaxis 90 [0,1,0]) 
	 addAndWeld conObject ConObject_copy 100
	 conObject.render_displayRenderMesh = true
	 conObject.render_thickness = 1.5
)
CreateConObject popo 10 

1 Reply

Maxscript thinks (correctly) that the name “popo” is a variable…but because the variable is has not yet been initalised, it is, correctly, been interrupted as undefined…

CreateConObject popo 10

is where you are making your mistake, it should read

CreateConObject "popo" 10

Shane