help me make this work!!

Hay all forum member and maxScripter i’m newbie in maxscrpt and need help developing my script, bassiclly it based on copy paste modifier but im try to remodel it a little bit and get dizzy how it work so here is my problem !!
-------------------------------------------- ---------------------------------------------
rollout kie “Untitled”
(
button btn1 “Button” pos:[1,3] width:132 height:22
on btn1 pressed do
(
sel=selection as array
rollout kio “Temp”
(
multilistBox lbx1 “item” pos:[3,1] width:155 height:5 i
)
createDialog kio
)
)
createDialog kie
-------------------------------------------- --------------------------------------------- -------
bassicly I want to add modifier name as item in multibox list when I click object that had a modifier and do nothing if item in selection doesn’t have any (btn1 click createDialog and automaticlly add modier name in multilistbox thing.... this is very very dizzy I tried every method I know and still not working ), clear multibox list automaticly when I clear selection () and add item automaticlly (modifier object when I click object that have an a modifer ) bassiclly like multilist box in command panel.

Comments

Comment viewing options

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

Hey mat, thank for suggest,

Hey mat, thank for suggest, I think I'll but that CG academy, the author is bobo, right?I already download the scriptspot tutorial though, it help me huild UVW map and mapscaler editor,it's very simple script though!but still pain in the head! hey http://www.justmathtutoring.com/ is math tutor right?I already given up in that lesson...hehehehe...I hate it(math), but thank for give me some info!

Hey mat, I already try to add some function to our script(if I may call that/yours) the function is delete modifier in selected, check the attachment.

this function has speciality in , if you activate the "all" radiobutton it'll be able to delete all modifier in all selected object, check it out!

AttachmentSize
DelModif.zip 1.22 KB
MATSCRPTART's picture

Just saw your new message.

Just saw your new message. I have been busy with this scripted muscle system test I am working on so haven't checked this much.

I will check out your modifications to the modifier script. Looks interesting.

A couple more suggestions about learning programming that I think are really good options.

Here are the best and quickest free C++ tutorials on the web. They are simple and to the point but pretty extensive as far as getting you going with C++ programming.

http://xoax.net/

I even tried to start downloading a few of the tuts with real player a couple months ago but I could only download a couple after that I think the website shut me out And I couldn't even view the videos for a few weeks , So If you want to download them be cautious.

Another great resource are the stanford lectures on porgramming On Youtube. These Are Actual videos of the classes complete semester. Very good and amazingly aimed at total beginners in progrmming.

There are 3 different courses

Programming Paradigms

http://www.youtube.com/watch?v=Ps8jOj7diA0&feature=PlayList&p=9D558D49CA...

Programming methodology

http://www.youtube.com/watch?v=KkMDCCdjyW8&feature=channel

Programming Abstractions

http://www.youtube.com/watch?v=kMzH3tfP6f8&feature=channel

Download Them all if you can With Real Player or YouTube Downloader.

Good luck with the Math to.

Matthew

[email protected]
http://s18.photobucket.com/albums/b117/dalek333/
http://www.freewebs.com/lamoreart/index.htm
http://www.scriptspot.com/3ds-max/joint-bend-rig

fajar's picture

Be my guest, after all you

Be my guest, after all you made it work!! and Matt, thank so much for the time and script you given to me!!

for the experience sharing , I was like you, from a high school I like reading something about C, but never had time to experience with it , couse I dont have computer my own.Starting on univerity I forgot all about that, now I feel need to re-reading all of that!!

Hey can I ask you something, for someone like me , where can I start maxscript lesson!! do you self study or ask some one to teach you?

Thank
fajar

MATSCRPTART's picture

There are a few options some

There are a few options some are faster but cost money others are less or no money but may take longer. For me I don't have much money or time to spend on this stuff so My skills are probably advancing slower than they could , plus this is only really a side thing since my main thing is digital painting and animation etc. You can start here although I have a feeling you already have seen this.

http://www.scriptspot.com/3ds-max/tutorials/free-video-tutorials

These are the free video tutorials by bobo right here on scriptspot.

The best thing to do , which would cost money is to just buy the dvd's by the same guy. Haven't done it myself but they look really good and I am really sure they would be.

advanced

https://www.cg-academy.net/es_catalog/product_info.php?cPath=27_42&produ...

fundamentals

https://www.cg-academy.net/es_catalog/index.php?cPath=27_41&osCsid=6pue9...

I plan on getting them if I ever get any money.

The Only other thing I can think of is google searches and just playing around. Coming up with an idea on something you want to do and then trying it and learning all the new methods definitions and techniques that will most likely go along with executing the idea.

Another helpful thing I am doing right now which is really helping is just sharpening my math skills. You may not have this problem but everytime I try something new I have to get some more math or brush up on some math. I am going to go through all this guys tutorials especially since they are free. I just did some scripting with transformation matrixes for a new version of my joint Bend rig which I will be releasing soon

http://www.scriptspot.com/3ds-max/joint-bend-rig

and this guys videos really helped with that stuff.

http://www.justmathtutoring.com/

good luck.

Matthew

fajar's picture

hey..hey...hey I already

hey..hey...hey I already begun learning maxscript in only this 2 month and still don't know anything,though. if I have some experience in C or other languange that connect in maxscript I wouldn't bother to ask you guys. but anyway you have respect from me and thank a lot!

Hay mat I already check your script that you send to me and it's very good have all vafunction that I need but I want to add some if you please!!

===========================================================
---refresh button (btn2) (this will get modifiers name in selection that already had one and clear the list box if selected object doesnt had one or doesnt had object in selection, sorry for bad english )
-----------------------------------------------------------
on btn2 pressed do
(
if selection.count == 1 then
(
createDialog kupo 162 260
TheMods = for mod in selection[1].modifiers collect mod.name
lbx1.items = TheMods
modsArray465 = $.modifiers
global modsArrayCopy = copy modsArray465
print "modsArray465 ="
print modsArray465
)
else
(
if selection.count == 0 then
(
lbx1.items = #()
)
)
)
===========================================================

NB: the modified version basic from yours!

AttachmentSize
Add modifer script example - 6.zip 1.21 KB
MATSCRPTART's picture

looks like a nice function

looks like a nice function for the refresh button. I will add your part to the script I have.

I know how it feels to be learning maxscript with little programming experience previously. I only started learning about a year ago. But it payed off greatly.

I think Maxscripting is a very fast and easier way to learn programming because its so easy to see immediate results and there are endless aplications that one can think of for ideas for new scripts.

Before I started maxscripting I was reading a few books on C++ programming but making little progress because I was not really using it that much. It was harder to come up with reasons for making the programs.

Really Mascripting was kind of a by-product of just a desire to have a better way to do what I was already doing in max. I started coming up with ideas on how I could do stuff and after playing around I was able to get most of them to work. Before I knew it I was actually learning real programming. Now I can go back to C++ and do a lot more than I would have been able to otherwise.

The only other thing I am trying to do righ now is resharpen my math skills. I feel if I have a better range of math methods at my disposal I will be able to do a lot more in programming.

Matthew

fajar's picture

Thank Matscrptart, for the

Thank Matscrptart, for the answering, but apparently marco help making this scripts more simpler! Take look at this:

============================================================
global kupo -- so you can access kupo controls from another rollout

rollout kupo "List"
(
MultiListBox lbx1 "Mod" pos:[3,1] width:156 height:4
button btn2 "Refresh" pos:[3,80] width:73 height:17
button btn3 "Paste" pos:[86,80] width:73 height:17
)

rollout kie "Untitled"
(
button btn1 "Button" pos:[2,1] width:151 height:21
on btn1 pressed do
(
if selection.count == 1 then
(

createDialog kupo 162 99

TheMods = for mod in selection[1].modifiers collect mod.name -- collect modifiers names into an array
kupo.lbx1.items = TheMods --assign the array of names the the listbox items
)
else messagebox "pick one object"
)

)
createDialog kie 155 24
============================================================
Sorry , but your script get some error when the object doesn had any modifier in it!!

the problem now, is when I doubleclick inside the listbox I can't paste modifier to selection ?!

MATSCRPTART's picture

Hey Your script definitely

Hey

Your script definitely is a lot simpler and optimized. I made the one I posted a little larger than necessary because I wasn't sure where you are maxscripting wise so I mainly was trying to show a few techniques that maybe you might no be familiar with. Seems like you have some experience though.

So I grabbed your code and added the copy paste modifier functionality to it. I also attached the script in the attachment.

Mainly I think where you what you were missing was that getting the modifier name only gets the name which is the string value. to actually add the modifier you have to store the actual modifiers themselves from the selected object. this is gotten simply by saying

MiscVariable = $.modifiers

then adding to an object by saying

addModifier object MiscVariable[i]

of course iterating the index for each modifier stored in
MiscVariable.

Note collecting the modifiers one by one into an array by saying
modsArray = for modGet in selection[1].modifiers ( collect modGet )

does not directly get the modifiers as a useable array that can then be applied to other objects. This is because the array must be of a modifier type in the format

#modifiers(Push:Push, Edit Poly:Edit Poly, RelaxMod:Relax)

where Push:Push, Edit Poly:Edit Poly, RelaxMod:Relax are your modifiers.

using the $.modifiers method will get the modifiers correctly.

So Here is the final script.
-------------------------------------------
-------------------------------------------

global kupo -- so you can access kupo controls from another rollout

global modsArray465 -- just for randomness

rollout kupo "List"
(
MultiListBox lbx1 "Mod" pos:[3,1] width:156 height:4
button btn2 "Refresh" pos:[3,80] width:73 height:17
button btn3 "Paste" pos:[86,80] width:73 height:17

on btn3 pressed do
(

selNow = GetCurrentSelection()

if modsArray465 != undefined and modsArray465.count > 0 then
(
for i in SelNow do -- for every object
(

for v = 1 to modsArray465.count do
(
addmodifier i modsArray465[v]
)
)
)
) -- end on btn3 pressed do
)-- end rollout kupo

rollout kie "Untitled"
(
button btn1 "Button" pos:[2,1] width:151 height:21
on btn1 pressed do
(

-----------------------------
if selection.count == 1 then
(

createDialog kupo 162 99

TheMods = for mod in selection[1].modifiers collect mod.name -- collect modifiers names into an array
kupo.lbx1.items = TheMods --assign the array of names the the listbox items

-- we must collect the actual modifiers you were only collecting
-- the modifier name above in TheMods

-- this does not seem to get the modifiers as a useable array
-- modsArray465 = for modGet in selection[1].modifiers ( collect modGet ) -- collect

-- this does
modsArray465 = $.modifiers -- selection[1].modifers

print "modsArray465 ="
print modsArray465 -- just for you to see what it looks like in listener window
)
---------------------------
else messagebox "pick one object"
)
---------------------------
)
createDialog kie 155 24

-------------------------------------------
-------------------------------------------

Matthew

[email protected]
http://s18.photobucket.com/albums/b117/dalek333/
http://www.freewebs.com/lamoreart/index.htm
http://www.scriptspot.com/3ds-max/joint-bend-rig

AttachmentSize
Add modifer script example - 2.ms 1.57 KB
MATSCRPTART's picture

Here is the script with all

Here is the script with all functionality.

Choice to paste all or just selected.

Also choice to paste as copies or instances.

And the refresh button operational.

An interesting exercise and got a pretty useful tool out of it.

remove Commnent out of the Macroscript part if you want to add it to a UI element.

------------------------------------
------------------------------------

/*
-- macroscript Modadder category:"ModAdder" (
-- for if you want to put in a macroscript Customize menu > User interface > Category Modadder > add to UI of choice
-- see parenthesis at bottom to close
*/

global kupo -- so you can access kupo controls from another rollout

global modsArray465 -- just for randomness

rollout kupo "List"
(
MultiListBox lbx1 "Mod" --pos:[3,1] width:156 height:4
button btn2 "Refresh" --pos:[3,80] width:73 height:17
button btn3 "Paste" --pos:[86,80] width:73 height:17

radiobuttons PasteAllorSel labels:#("sel","all")

radiobuttons copyOrInst labels:#("copy","instance")

on btn2 pressed do
(
lbx1.items = #()
modsArray465 = undefined
)

on btn3 pressed do
(
print lbx1.selection -- notice this is a bit array
undo "paste mod" on -- so we can undo it
(

selNow = GetCurrentSelection()

if modsArray465 != undefined and modsArray465.count > 0 then
(

for i in SelNow do -- for every object
(

if PasteAllorSel.state == 1 then
(

-- convert from bit array to array so we can access its indexed values as an array

SelectedMods = lbx1.selection as array

if SelectedMods.count > 0 then
(
for p = 1 to SelectedMods.count do
(
indexedmod = SelectedMods[p]

if copyOrInst.state == 1 then -- copy
(
addmodifier i (copy modsArray465[indexedmod] )
)
Else -- instance
(
addmodifier i modsArray465[indexedmod]
)

)
)
)
Else
(

for v = 1 to modsArray465.count do
(

if copyOrInst.state == 1 then -- copy
(
addmodifier i (copy modsArray465[v] )
)
Else -- instance
(
addmodifier i modsArray465[v]
)
)
)
)
)
Else
(
MessageBox "Please Get The mods first"
)

) -- end undo "paste mod" on
) -- end on btn3 pressed do
)-- end rollout kupo

rollout kie "Untitled"
(
button btn1 "Button" pos:[2,1] width:151 height:30
on btn1 pressed do
(

-----------------------------
if selection.count == 1 then
(

createDialog kupo 162 260

TheMods = for mod in selection[1].modifiers collect mod.name -- collect modifiers names into an array
kupo.lbx1.items = TheMods --assign the array of names the the listbox items

-- we must collect the actual modifiers you were only collecting
-- the modifier name above in TheMods

-- this does not seem to get the modifiers as a useable array
-- modsArray465 = for modGet in selection[1].modifiers ( collect modGet ) -- collect

-- this does
modsArray465 = $.modifiers -- selection[1].modifers

global modsArrayCopy = copy modsArray465

print "modsArray465 ="
print modsArray465 -- just for you to see what it looks like in listener window
)
---------------------------
else messagebox "pick one object"
)
---------------------------
)
createDialog kie 155 50

-- ) -- end macroscript end

-----------------------------------------------

---------------------------------------------

Matthew

[email protected]
http://s18.photobucket.com/albums/b117/dalek333/
http://www.freewebs.com/lamoreart/index.htm
http://www.scriptspot.com/3ds-max/joint-bend-rig

AttachmentSize
Add modifer script example - 5.ms 3.18 KB
MATSCRPTART's picture

Realized I needed to make a

Realized I needed to make a slight change to make it more what I think you wanted. This is the part I added.

on GetMods pressed do
(

If AutoClear.state == true then
(
LstBx.items = #()
)

the updated script is attached below.

Matthew

AttachmentSize
List Modifiers in a list box example 4.ms 2.53 KB

Comment viewing options

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