combining variable values

I am trying to combine the values of two variables that I am getting from two different scripts and combining in a third.
I am using GetComponent but am running into trouble. I thought something like this below might work but though Untiy doesn’t object to the script when I save it, it tells me “Object reference not set to an instance of an object”.
Could anyone tell me where I need to alter this script to get it to work (or if I should scrap it and start over?)
Thanks. Here’s the script:

var getA = GetComponent (“/Aobject.Ascript.A”);
getA *= 100;
var getB = GetComponent (“/Bobject.Bscript.B”);
getB *= 100;
getA += getB;

Not sure exactly what you want to do, but if you do not want to modify the variables in the referenced scripts:

var getA : float = GetComponent(ScriptA).variableA;
var getB : float = GetComponent(ScriptB).variableB;

getA *= 100.0;
getB *= 100.0;
getA += getB;

You could also declare a public variable and just drag and drop you referenced scripts, that way you do not need to worry about getting them at run time everytime you need to access them.

var ScriptA : ScriptA;

then your reference would be

getA = ScriptA.variableA;