ScriptSpot

Forum topic · General Scripting

Turn on and Off by Scripting Custom Attribute in Holder

By sebastian_chevy · 2015-02-28

Description

Hi everyone

I am new in Maxscript, I want to be able to turn ON and OFF a check button in an attribute holder (costumed attribute)created previously with the Parameter editor . I am doing an UI that collects some custom attributes from different objects.
But when I tried to check the syntax in the max listener and paste it in the script editor, this pops up:

No ""="" function for ((prop Custom_Attributes ((prop modifiers* (%getDollarSel()))[#FACIAL])) 0.1)

and the script for the button is this:

on btn1 pressed do
(
$.modifiers [#FACIAL].Custom_Attributes.1 = on
)

where the number 1 it's the button´s name
and FACIAL the modifier's name (attribute holder)

Any ideas??
Thank you!!!

Attachments
Comments (3)

Re: on off

pixamoon · 2015-02-28

Hi,

In this case I would do :

SetProperty $.modifiers[#FACIAL].Custom_Attributes #1 off

get button state:

GetProperty $.modifiers[#FACIAL].Custom_Attributes #1

The reason is: usually numbers can't be used as variables in max scripts.
Here 1 came from button name but you can't just call it by 1

If the name of button is "Param1" or even "P1" then you can use your way:

$.modifiers[#FACIAL].Custom_Attributes.P1 = on

Hope it helps.
Cheers,
Pixamoon

THANK youuu

sebastian_chevy · 2015-03-02

It worked!! you were right, it was just the name. It's better not to mess with values that can be taken as variables.

You are the best.

pixamoon · 2015-03-04

no prob, Great it helped :)

cheers,
Pixamoon