Value Common Properties, Operators, and Methods

Value > Value Common Properties, Operators and Methods

 

   

Values and Collections - Quick Navigation

The Value class is the root class for all MAXScript classes. It supplies methods and operators that any class can use.

Operators

<value> == <value>

compare if equal

   

<value> != <value>

compare if not equal

   

<value> as <class>

Converts the value to an instance of given class. See the description for each class for valid conversions. All values can be converted to class String, which yields a string with the printed representation of the value.

   

Methods

print <value> [ to:<stream> ] [#noMap] -- mappable

where <stream> is

( <filestream> | <stringstream> | <windowstream> )

Prints single value to Listener or optional filestream, stringstream, or windowstream, followed by a line break. If the argument value is a Collection, and #noMap is not specified, each value in the collection is printed out on a separate line. If #noMap is specified, the collection value is printed out on a single line. The printed form of all basic data value types, except for BigArray, are directly readable by the readValue() and readExpr() functions, making it simpler to read back in values printed to a file by MAXScript. If the pre-3ds Max R3 print forms are required for compatibility with existing scripts, you can set the system global variable options.oldPrintStyles to true .

   

format <format_string> { <value> } [ to:<stream> ]

Prints one or more values to Listener or optional filestream, stringstream, or windowstream, using the format string as a template. The format string is a string that can contain plain text to print interspersed with the '%' (percent) metacharacter. Each occurrence of a '%' is replaced by the printed representation of the successive argument values following the format string.

EXAMPLE

format "name:%, pos:%\n" obj.name obj.pos

generates something like:

name: box01, pos: [0, 150.0, 0.5]

format does not automatically append a line break to the output stream, so you can build up a line from several format calls and generally control layout better. An explicit ' \n ' newline escape character sequence is needed to place a line break in the output stream. Other escape character sequences are documented in String Literals.

   

classOf <value>

Returns the value's class. Each type of value has its own class. If the value is a Node value, classOf() returns the class of the world state object (the state of the node at the top of its stack). See Node : MAXWrapper for more information.

NOTE:To avoid a conflict between a user class value in global variable named 'rollout' and MAXScript reserved word 'rollout' which always introduces a rollout definition the class variable name for a rollout is RolloutClass . So, for a rollout foo you'd now say "if classOf foo == RolloutClass do ..."

   

superClassOf <value>

Returns the value's superclass. A value's superclass is the class from which the value's class was derived.

   

isKindOf <value> <class>

Returns true if value has given class or inherits from class.

   

isStructDef <value>

Returns true if the value is a structure definition

   

isStruct <value>

Returns true if the value is a structure instance

   

isController <value>

Returns true if the value is a controller

   

isMSPlugin <value>

Returns true if the value is a MAXScript scripted plugin.

   

isMSPluginClass <value>

Returns true if the value is a MAXScript scripted plugin class.

FOR EXAMPLE:

b = box() --create a Box primitive
$Box:Box01 @ [0.000000,0.000000,0.000000]
a = emptymodifier() --create an attribute holder modifier
EmptyModifier:Attribute Holder
addModifier b a --add the modifier to the box
OK
isMSPlugin a --see if the modifier is a scripted plugin? Yes!
true
isMSPlugin b --see if the box is a scripted plugin? No!
false
isMSPluginClass EmptyModifier --is the modifier class scripted? Yes!
true
isMSPluginClassBox --is the object class scripted? No!
false

   

isMSCustAttrib <value>

Returns true if the value is a MAXScript Custom Attribute.

NOTE:Since Custom Attributes are a special case of a scripted plugin, isMSPlugin will also return true.

   

isMSCustAttribClass <value>

Returns true if the value is a MAXScript Custom Attribute class.

NOTE:Since Custom Attributes are a special case of a scripted plugin, isMSPluginClass will also return true.

FOR EXAMPLE

weaponDataCA = attributes weaponData
(
Parameters main
(
)
)
b=box()
custAttributes.add b weaponDataCA
 
c=b.baseobject.custAttributes[1]
d=classof c
superclassof c
isMSPluginClass d
isMSCustAttribClass d
isMSPluginClass b
isMSCustAttribClass b
`

RESULTS:

<AttributeDef:weaponData>
$Box:Box03 @ [0.000000,0.000000,0.000000]
true
 
weaponDataCustAttrib:weaponData
<AttributeDef:weaponData>
CustAttrib
true
true
false
false

   

getHashValue <value> <Integer oldHashValue>

If the value is one of the supported value types, returns an integer hash value that is a factor of the <value> and <oldHashValue>. If the value type is not supported, returns a value of undefined .

The supported value types are:

See Also