Maya 2018 Help needed with a World space Wheel rotation script giving syntax errors



Firstly I am very much a MEL beginner although i have had limited experience with C# and understand most of the basic fundamentals of programming.

I am trying to apply the following script but replacing the strings and $radius with my own values


float $radius = 25;
vector $moveVectorOld = xform -q -ws -t "rightWheelOld";
vector $moveVector = xform -q -ws -t "R_Wheel";
vector $dirVector = xform -q -ws -t "rightWheelDir";
vector $wheelVector = ($dirVector - $moveVector);
vector $motionVector = ($moveVector - $moveVectorOld);
float $distance = mag($motionVector);
$dot = dotProduct($motionVector, $wheelVector, 1);
R_Wheel.rotateZ = R_Wheel.rotateZ + 360 / (6.283*$radius) * ($dot*$distance) * (Root_CTRL.rightWheelAuto);
xform -t ($moveVector.x) ($moveVector.y) ($moveVector.z) rightWheelOld;
if (frame==0) {
R_Wheel.rotateZ = 0;

I have null groups in scene as per the tutorial and I have named them firstly as the tutorial suggests and then another test to create a new null1 empty group and replacing “rightWheelOld” with “null1”

Each time the Script editor returns Error: Line 1.42: Syntax error and i have determined that it refers to the string “rightWheelOld” in line 1 but I am unable to figure out why after checking Autodesk help and similar scripts.

I tried declaring the string using

string $rwold = “rightWheelOld”;
vector $moveVectorOld = xform -q -ws -t $rwold;

I still got a syntax error

My question is has there been any changes to scripting since 2016 such that syntax has changed?
Is there a special way of referencing a parented null group?
What could be going wrong?

Does anyone know of an alternative way of creating a world space autorotation system as described that works in Maya 2018?


Issue resolved. The cause was autoformatting of the quote marks from copy and paste from youtube description.

gave italicised ” instead of "