Notifications
Clear all

[Closed] Unknown syntax error

Hello all,
I am getting a syntax error, and after hours of checking and rechecking, I can’t figure out what it may be. All I am doing is calling up a rollout when the Macro is initiated. I have done this numerous times before and it works fine, but not here for some reason. Any help would be greatly appreciated.

Below is not the whole script, but just the problem section.

The Listener is saying that there is a syntax error “at (, expected do” [in reference to the third ( in this script]. I can’t see any syntax errors, but maybe I have just been looking at it too long. Thanks for any help!

(
	rollout TrisOrQuads "Select Polygons"
	(
		on execute do
			(
				label whichPolygon "Which Polygons to select?"
				button tris "Tris" align:#left offset:[4,0] across:3
				button quads "Quads" align:#left
				button ngons "N-gons" align:#left
			(
				on tris pressed do 
					vertsCheck 3
				on quads pressed do
					vertsCheck 4
				on ngons pressed do
					ngonGen ngonGrab
			)
		)	
	)
	createDialog TrisOrQuads width:200
)
4 Replies
 lo1

execute is not a handler of rollout, it is a handler of macroscript.
Also, there is no purpose to the parentheses surrounding the other handlers in the rollout.

should be become like this mate…


(
	rollout TrisOrQuads "Select Polygons"
	(
		on execute do 
			(
				label whichPolygon "Which Polygons to select?"
				button tris "Tris" align:#left offset:[4,0] across:3
				button quads "Quads" align:#left
				button ngons "N-gons" align:#left
			(
				on tris pressed do 
					vertsCheck 3
				on quads pressed do
					vertsCheck 4
				on ngons pressed do
					ngonGen ngonGrab
			)
		)	
	)
	createDialog TrisOrQuads width:200
)

Red = Missing or just delete the line

1 Reply
(@gazybara)
Joined: 11 months ago

Posts: 0

He need the macroscript so…


macroScript someName buttontext:"MACRO" category:"Some Category" tooltip:"Some Description"
(
	on execute do 
	(
		rollout TrisOrQuads "Select Polygons"
		(
			local ngonGrab = selection[1]
			fn vertsCheck val = (print val)
			fn ngonGen obj = (print obj)
			
			label whichPolygon "Which Polygons to select?"
			button tris "Tris" align:#left offset:[4,0] across:3
			button quads "Quads" align:#left
			button ngons "N-gons" align:#left
			
			on tris pressed do vertsCheck 3
			on quads pressed do vertsCheck 4
			on ngons pressed do ngonGen ngonGrab
		)
		createDialog TrisOrQuads width:200
	)
)

Thank you everyone for the replies, I got it sorted out. I forgot to mention that it was already a macroscript, I just didn’t include that section in my post, and all of the functions were declared elsewhere. I just had the “on execute” in the wrong place.