Dynamically Changing the Character Motor Script

I'm Trying to get change the max forward speed of the character motor script but I'm not sure how to access the variables. I've tried:

`gameObject.GetComponent(CharacterMotor).maxForwardSpeed=gameObject.GetComponent(CharacterMotor).maxForwardSpeed * (((speed)/100.0)+1);`

However, this doesn't seem to work at all, and printing:

`gameObject.GetComponent(CharacterMotor).maxForwardSpeed);`

Returns null. Any idea what I'm doing wrong?

As you see this parameter is in class CharacterMotorMovement

class CharacterMotorMovement {
        // The maximum horizontal speed when moving
        var maxForwardSpeed : float = 10.0;
        var maxSidewaysSpeed : float = 10.0;
        var maxBackwardsSpeed : float = 10.0;
             //...
    }

var movement : CharacterMotorMovement = CharacterMotorMovement();

So if you want to get parameter member of class you should do this:

Just use .movement.maxForwardSpeed instead of maxForwardSpeed

var motor = gameObject.GetComponent("CharacterMotor");
var max_speed = motor.movement.maxForwardSpeed;
max_speed = max_speed*(((speed)/100.0)+1);
motor.movement.maxForwardSpeed = max_speed;

or just

gameObject.GetComponent("CharacterMotor").movement.maxForwardSpeed = 
   gameObject.GetComponent("CharacterMotor").movement.maxForwardSpeed*(((speed)/100.0)+1);