Notifications
Clear all

[Closed] Why is it undefined when i drag and drop to tool bar

I wrote this script and drag and drop to tool bar.
Then i saw this text in Listener, “undefined” when i evaluate this script.
But this script is work if i evaluate on Script Edite.
Why is different?
and i want to know that how to work when i drag and drop to tool bar?
I can’t access other code because that.
My english is very poor.
so my sentence little bit awkward, i am so sorry
and i hope to know you what i want to.

5 Replies

I don’t understand what you want to achieve.

You’re missing the “on execute do” bit – you want something like:

macroscript ....
(
rollout test "test"(....)
on execute do
(
    createdialog test
)
)

Have a look on this page:

http://docs.autodesk.com/3DSMAX/15/ENU/MAXScript-Help/index.html?url=files/GUID-6E21C768-7256-4500-AB1F-B144F492F055.htm,topicNumber=d30e636049

Search the page for “on closeDialogs do ” and look at the example script just below it

I was making a script that i get the MatId when i click to object.
but this Callbacks is not work when on the tool bar.

when you use a general callbacks system the executing script has to have a global pointer at least.
in case of ‘macro’ implementation it’s in local scope of the macro’s body

so a working code might look:

global SelectionSetRollout =
(
    rollout SelectionSetRollout "SS MAN"
    (
        -- ...
        on SelectionSetRollout open do
        (
            callbacks.addscript #selectionSetChanged "::SelectionSetRollout.selectionSetFn()"
        )
        -- ...
    )
)

but it not work on the custom toolbar.