Notifications
Clear all

[Closed] Syntax error:

Hello

I am a begginer user of Max scripts. I have scripted a simple code successfully which combines a stack of modifiers using one click. Now, I have started another script which does not seem to work well. All I need is a script that automatically clears selection for each of the five subobjectlevel inside an editable poly modefier. lately, I have obsereved the behavior of max script listener but, unfortunately, there is an error that keeps popping up every time I run my script. It says :

– Error occurred in anonymous codeblock; filename: C:\Users\delli7\Desktop\e0.ms; position: 731; line: 22
– Syntax error: at ), expected <factor>
– In line: )

It would be really nice if any one in this forum can fix this script:

macroScript Macro2
(
category:“DragAndDrop”
toolTip:””
modPanel.setCurrentObject $.modifiers[#Edit_Poly]
subobjectLevel = 1
modPanel.setCurrentObject $.modifiers[#Edit_Poly]
$.modifiers[#Edit_Poly].SetSelection #Vertex #{}
subobjectLevel = 2
modPanel.setCurrentObject $.modifiers[#Edit_Poly]
$.modifiers[#Edit_Poly].SetSelection #Edge #{}
subobjectLevel = 3
modPanel.setCurrentObject $.modifiers[#Edit_Poly]
$.modifiers[#Edit_Poly].SetSelection #Edge #{}
subobjectLevel = 4
modPanel.setCurrentObject $.modifiers[#Edit_Poly]
$.modifiers[#Edit_Poly].SetSelection #Face #{}
subobjectLevel = 5
modPanel.setCurrentObject $.modifiers[#Edit_Poly]
$.modifiers[#Edit_Poly].SetSelection #Face #{}
subobjectLevel = 0
)

19 Replies

macroScript Macro2
category:"DragAndDrop"
toolTip:""
(
	modPanel.setCurrentObject $.modifiers[#Edit_Poly]
	for i = 1 to 5 do
	(
		subobjectlevel = i
		max select none
	)
	subobjectLevel = 0
)

the code above is too ‘unsafe’ for a master

I still consider myself as not a master.

He can add code to make his script to be safe, to works only when the object have a Edit Poly modifier in the top of the stack and so on.

if iskindof (m = modpanel.getcurrentobject()) Edit_Poly do 
(
	for sub = 1 to 3 do m.setselection sub #{}
)

but what if

#1 same modifier is applied to multiple nodes ?

#1 – yes. But, he can decide to use the script with selection of objects and also have to check to execute the code or not, as you did in your code…

By the way, in 3dsmax 2014, when I select the edges in edge sub-object level, and then selet edges in border sub-object level and then go back to edge sub-object level the selected edges are lost and only the boreder edges are selected. The same with Polygon and Element sub-object levels – select polys in polygon sol, then go th element sol, select a element, then go back to polygon sol – and only the selected elements is selected.

screw <2014 !

I still use 2014 for writing scripts.

If the same modifier is applied to several objects then,:


(
	selObsArr = selection as array
	
	if iskindof (m = modpanel.getcurrentobject()) Edit_Poly do 
	(
		for o in selObsArr do
		(
			select o
			for sub = 1 to 3 do m.setselection sub #{}
		)
	)
)

or


(
	selObsArr = selection as array
	
	if iskindof (m = modpanel.getcurrentobject()) Edit_Poly do 
	(
		for i = 1 to 5 do
		(
			subobjectlevel = i
			max select none
		)
	)
)

see! you can…

so why did you say you are not a master?

but… in both cases you loose selection (or sub-selection)

if iskindof (m = modpanel.getcurrentobject()) Edit_Poly do 
(
	for node in selection do for sub = 1 to 3 do m.setselection sub #{} node:node
)

Page 1 / 2