次の長い書式の例で示すように、MAXScript では所定の位置の値の修正に使える C 言語略語形式の代入を使用できます。
x = x + 1 -- increment x by one $obj.pos = $obj.pos * scale -- multiply $obj.pos by scale
4 つの数値演算子 +
、-
、*
、/
に対応する代入演算子は、代入先に演算を適用し、代入先を結果で更新します。
代入演算子の構文は次のとおりです。
<destination> += <expr> -- add <expr> to destination
<destination> -= <expr> -- subtract <expr> from destination
<destination> = <expr> -- multiply destination by <expr>
<destination> = <expr> -- divide destination by <expr>
代入の略語形式を使うと、上の例を次のように記述することができます。
x += 1 -- increment x by one $obj.pos *= scale -- multiply $obj.pos by scale