How to get components

hey, i need to get a component from a script that is supposed to deploy a turret when there is no turrets left, so i thought, for the script to know how many there are and when they die i need the get component to change variables, so i begun with the one just for it to count how many there are i tried this:

var deploy = Deployer.GetComponent(turret deploy).turretCount = turretCount + 1;

(deploy is the function to deploy it and Deployer is the object they will be deployed from)

im getting 2 errors, one tells me to put a semicolon right after GetComponent, and the other tells me the closing parenthesis its an unexpected token.
so any help is much appreciated, sorry for any spelling mistakes

Try using SendMessage, its a lot easier and cleaner.
Something like:

var deployer: GameObject;

function Update(){

deployer.SendMessage ("deployer", +1);

}

Then every script attached to the gameObject with the Deployer function will be called. Just create the function and inside it add your code to instantiate the turret when you run out of them.