Notifications
Clear all

[Closed] Some syntax errror in my script

line 4 has a syntax error, could anyone show me a pointer on how to code this correctly?
Thanks
Jack


 rollout ScaleScene "Scale Scene" 
 (
 	spinner amount "Scale amount:"
	button scale "Scale"
 	myCollection = $* as array   -- this line has syntax error 
 	MyDummy = (dummy name:"MyDummy01")
 	
 	on scale pressed do (
 		
 		for i = 1 to myCollection.count do
 		(
 		   if myCollection[i].parent == undefined then (myCollection[i].parent = MyDummy)  
 		)
 		select MyDummy
 	)
 
 	on amount changed val do 
 	(
 	  MyDummy.Scale = val
 	)
 )
 
 
 createdialog ScaleScene
 
4 Replies
2 Replies
(@gazybara)
Joined: 10 months ago

Posts: 0

Your scale solution is very limited. Don’t use this approach. Anyway …


 rollout ScaleScene "Scale Scene" 
 (
 	local MyDummy, myCollection = #()
 	 spinner amount "Scale amount:"
 	button scale "Scale"
 	 
 	on ScaleScene open do
 	(
 		myCollection = getCurrentSelection()
 		MyDummy = dummy name:(uniquename "MyDummy") pos:(if myCollection.count != 0 then selection.center else [0,0,0])
 	)
 	 on scale pressed do if myCollection.count != 0 do
 	(
 		  for o in myCollection.count where o.parent == undefined do o.parent = MyDummy
 		 select MyDummy
 	 )
  
 	 on amount changed val do MyDummy.Scale = val
  )
  createdialog ScaleScene
 
(@denist)
Joined: 10 months ago

Posts: 0
	local myCollection = $* as array   -- this line has syntax error 
  	local MyDummy = (dummy name:"MyDummy01")

but it’s not a good idea to make an object on dialog creation.

Thanks for sharing.
I’ll try your script.
Jack

There is much better solution for this.
Recntly Denis posted modifier solution for this kind of problem