Forum Groups
  All forums
    Help & Feedback
      Questions
      Work in progress
      Finished Art
      Non-Max related
    Community
      Offtopic
      News
    Hardware
    Photography



Maxunderground news unavailable

More Max Script Questions..
show user profile  ravihara
sorry for so many questions..
my problems are,

1. when i have a script segment like this in my script, :
when transform $AA_slider_knob changes do ( print"new1")
even if close the window i created from the script, it still keeps printing "new1". how do i totally unload the script when i close my dialog?

2. Say I have an array like this,
local boxes_array= #($box1,$box2,$box3)
how can i remove $box2 from this array and register the results #($box1,$box3) as a new array called 'boxes_modify_array'?




read 423 times
8/27/2012 12:41:53 PM (last edit: 8/27/2012 12:44:35 PM)
show user profile  Garp
1. Look down the 'Change Handlers and When Constructs' page in the doc. There are two methods listed there to unregister change handlers.
2. boxes_modify_array = for obj in boxes_array where obj != $box2 collect obj

edit: you could try to keep all you mxs questions in one thread ;)




read 408 times
8/27/2012 1:56:17 PM (last edit: 8/27/2012 1:57:54 PM)
show user profile  ravihara
i read it bro. if question 1 was done by
deleteChangeHandler
deleteAllChangeHandlers


i already placed deleteAllChangeHandlers them in the script. but still same thing happens. :(

and k i will keep it to one post. sorry my bad. :)


read 393 times
8/27/2012 2:45:49 PM (last edit: 8/27/2012 2:45:49 PM)
show user profile  Garp
It should be deleteAllChangeHandlers().
If you call a function with no argument you need to add the function call operator (). Otherwise it's just the function's name.




read 388 times
8/27/2012 2:59:00 PM (last edit: 8/27/2012 2:59:00 PM)
show user profile  ravihara
woow! thanks a lot bro!! it works now..
one other thing,
say if i want to change a one property of all the members inside the new boxes_modify_array.. lets say that all these objects in boxes_modify_array are on path follow constraint and i want all of them to follow there path in certain percentage.. what is the approach for that?


read 383 times
8/27/2012 3:15:31 PM (last edit: 8/27/2012 3:15:31 PM)
show user profile  ravihara
did above with a for loop as inspired by your previous teachings.

for i=1 to 17 do (boxes_modify_array [i].pos.controller.PERCENT = 50)

works fine but i don't know its ugly. :) is there a better way bro?


read 374 times
8/27/2012 3:32:08 PM (last edit: 8/27/2012 3:32:08 PM)
show user profile  Garp
for b in boxes_modify_array do b.pos.controller.percent = 50
When you don't need to do things in a special order, the for in construct is a little more concise.

Note that if you want all those boxes to have the same percentage along their path at all time, it's easy too. You just make them use the same controller instead of each box having its own.
local c = boxes_modify_array[1].pos.controller.percent.controller
for i = 2 to boxes_modify_array.count do boxes_modify_array[i].pos.controller.percent.controller = c


A slightly shorter array name could help too ;)




read 362 times
8/27/2012 3:54:58 PM (last edit: 8/27/2012 4:23:20 PM)
show user profile  ravihara
woow! awesome! thanks a lot bro!! thanks a lot! :)


read 352 times
8/27/2012 4:12:05 PM (last edit: 8/27/2012 4:12:05 PM)
show user profile  Garp
I just modified a typo :\




read 346 times
8/27/2012 4:23:50 PM (last edit: 8/27/2012 4:23:50 PM)
show user profile  ravihara
i didn't try the last code. but by your coding style i really can get an idea about how max works. that is why the huge thanks :)


read 343 times
8/27/2012 4:25:34 PM (last edit: 8/27/2012 4:25:34 PM)
show user profile  Garp
You're welcome.
Keep the questions coming, it's relaxing :)




read 341 times
8/27/2012 4:32:08 PM (last edit: 8/27/2012 4:32:08 PM)
show user profile  ravihara

so here is what I was doing...
i have this face rig that i control my expressions with 18 separate morph targets.




i wanted to build some tool that allows me to switch between solo and mix modes, cause it confuses me when creating a new key, that i have to go backwards in timeline and make the previous slider back to 0. so with your guidance, its built i guess. from now on, i will be building small tools like this in my every project.obviously i will need loads of help.. so i guess you sir will have lot of typing. :P




read 335 times
8/27/2012 5:01:39 PM (last edit: 8/27/2012 5:08:34 PM)
show user profile  Garp
Good thinking. That's exactly what maxscript is for.

When you're comfortable enough, start writing more generic code and make your own library. It'll save you countless hours.
Also try to adopt a more sober style. Shorter lines and shorter comments (describing why and how when it's tricky, not what). Think of the guy having to modify your code (probably you in a few months).




read 319 times
8/27/2012 5:47:08 PM (last edit: 8/27/2012 5:47:08 PM)
#Maxforums IRC
Open chat window


Support Maxforums.org