Script Help - how to run script on group

Hi guys

I am not a programmer nor am i anywhere near that level. However i have been playing around with the most basic functions of listener and the scripts and i want to be able to create simple scripts for my every day use.

For instance, i created the below script which placed a UVW map of 2000mm to the selected object.

modPanel.addModToSelection (Uvwmap ()) ui:on
$.modifiers[#UVW_Map].maptype = 4
$.modifiers[#UVW_Map].length = 2000
$.modifiers[#UVW_Map].width = 2000
$.modifiers[#UVW_Map].height = 2000

However, when i try and run the script on a group, it doesnt work and it comes up with the error "unknown propery:"modifiers" in $selection.

How can run this script on any thing that is selected, be that it is a group or not?

Thanks in advance guys

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
fajar's picture

aa= Uvwmap()aa.maptype =

aa= Uvwmap()
aa.maptype = 4
aa.length = 2000
aa.width = 2000
aa.height = 2000
modPanel.addModToSelection (aa) ui:on

or

aa= Uvwmap maptype:4 length:2000 width:2000 height:2000
modPanel.addModToSelection (aa) ui:on

modPanel.addModToSelection is mapped function.
note: it will be instance modifier

sirmontal's picture

Thanks so much

Hey there

Thanks so much - so i figured that aa represents 1 modifier. SO if you want to add more the next would be bb and then cc and so forth. Worked a treat - THANKS SO MUCH

PS - where can i get more info on scripts and how to make them? I think its awesome.

ALso any ideas on where to create the interface for it? ie create an interface for the script itself

fajar's picture

1.everything start from you

1.everything start from you want to learn ...
2.download all (not all) free open script here first...
3.copy and paste thing that you want to learn from downloaded script (like how to make UI, many sample here) ...
4.do some experiment (try and error thing)....
5.then read the maxscript help (I recommend you to download the maxscript in chm file first...)...
6.and if you bump to something like this case then dont be shy to ask another people on forum like this or on cgtalk(there you'll meet many expert that ready to help you like here too).

here is the cgtalk address for maxscripter

http://forums.cgsociety.org/forumdisplay.php?f=98

and here is the code sample how to make UI from maxscript

fn applyUVWMap =
(
	if selection.count!=0 do
	(
		local aa= Uvwmap maptype:4 length:2000 width:2000 height:2000
		modPanel.addModToSelection (aa) ui:on
	)
 
) ---fn is short from function ...in further case you'll do it very much , you make it once rather than over and over it again
 
 
rollout applyUVW "Untitled" width:162 height:48
(
	button appUVW "Button" pos:[9,11] width:138 height:31
 
	on appUVW pressed do
	(
		applyUVWMap()
--or you could do it this way...
/*
if selection.count!=0 do
	(
		local aa= Uvwmap maptype:4 length:2000 width:2000 height:2000
		modPanel.addModToSelection (aa) ui:on
	)
*/
 
	)
)
createDialog applyUVW

copy and paste those code in maxscript editor and execute it (ctrl+e).

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.