Announcement

Collapse
No announcement yet.

help with a script

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Iskánder ivp87
    started a topic help with a script

    help with a script

    well in a render forum this will be super-super off-topic...

    I did a tool bar with some maxscript and there's a function I can't accomplish

    I want to be able to create an fstorm light from a button, this is what I'm writing: on execute do StartObjectCreation FStormLight, it works fine, but what I really want is to set an arbitrary shape and power for the light I am creating, instead of the default power value of… 1...yeah, for example to have a button for a rectangular light and another for a spherical light and both with a power value of 50

    but whenever I add $.power=50 and run the script maxscript crashes on me and I have to close the 3dsMax... can you help me with this?

    At this point, if you are still with me you could think I Know Nothing about maxscript, and YES!, you are right haha so any help will be appreciated

  • Sylk
    commented on 's reply
    And congrats for your progress

  • Sylk
    commented on 's reply
    Thank you but in fact my toolbar is much more advanced and therefore more complicated and long to develop than the basic functions. I do other things at the same time, so sorry for the time it takes.
    I just told you that I was not yet at the point of material management. I don't have any problems with that. Thanks anyway.

  • Iskánder ivp87
    commented on 's reply
    well I kind of get to that myself haha, first it didn't work, but I was writing in the same line without the ; I ended doing the declarations in different lines... now I know I can use ; as separators thank you again!

    this maxscript is incredible easy I went from never had doing a thing with it to do a complete toolbar with all the functions I need in a couple of days!
    if I remember well you told me you hadn't managed to import a new fstorm material, sure you have already done it by now, but anyway if it helps this is how I did it:

    try(
    i= medit.GetActiveMtlSlot()
    )
    catch(i=1)
    meditMaterials[i] = FStorm ()

  • Sylk
    replied
    I don't understand where's the last answer i posted... so repost
    Code:
    fn doPlaneLight n = ( n.shape=0 ; n.power=50 )
    startObjectCreation FStormLight newNodeCallback:doPlaneLight

    Leave a comment:


  • Sylk
    commented on 's reply
    fn setRecLight n = (n.power=50 ; n.shape=0)
    startObjectCreation FStormLight newNodeCallback:setRecLight

  • Iskánder ivp87
    replied
    thank you both, I pull it editing the code posted by sylk

    Leave a comment:


  • Iskánder ivp87
    commented on 's reply
    @cdb... OK, and please could you help me to accomplish this one??:
    Create the light -- same process as when you create anything, drop and drag
    set the shape to 0
    set the power to 50

  • cdb
    commented on 's reply
    no, you don't necessarily need to have those values fixed, you can quickly build a ui to get everything you want and how you want and you can even build functions to do wathever you want

    there are many advantages of getting a fixed light instead on a per drag aproach, if you can see them or not is up to you and i don't mind really
    you have all the params exposed, if you want to develop further

    your choice

  • Iskánder ivp87
    commented on 's reply
    Haha sorry man but why would I want to create a light always with the same dimensions and in the same position?
    Maybe I was not clear enough, excuse my bad English
    What I want is to create an fstorm light as I normally would from the original button in the max interface, but with 2 parameters already settled, one the shape and the other one the power, that’s it
    The position and the size have to be free to get from the mouse the same way as when you are creating anything in 3ds max
    Similar to this pseudo code:
    Create the light -- same process as when you create anything, nothing weird here
    set the shape to 0
    set the power to 50
    I don’t mind the order… the thing is that when I create the light its initial power and shape parameters are predefined

  • Sylk
    commented on 's reply
    I just answer his question for the StartObjectCreation use

  • cdb
    replied
    why would you need to use callbacks and startobjectcreation when every fstorm parameter is exposed?
    make your life easier and do it in a standard maxscript


    try this

    FStormlight enabled: true pos: [0,0,200] isselected: on power: 50 size_x: 50 size_y: 50 visible: false shape: 0


    the shape range goes from 0 to 3

    0 - planar
    1 - disc
    2 - sphere
    3 - ies

    Leave a comment:


  • Iskánder ivp87
    commented on 's reply
    thank you, that solves the power problem at least, any idea for the shape? I tried to edit it and adapt it but it just take the shape of the last created object instead of the value I'm setting

  • Sylk
    replied
    fn setPower n = n.power=50
    startObjectCreation FStormLight newNodeCallback:setPower
    Last edited by Sylk; 11-09-2016, 05:06 PM.

    Leave a comment:

Working...
X