play animation variable

I have a character ( not the player) that I want to play a specific animation when the player walks into specific triggers. Specific audio as well. I was hoping to do this with one script that I could put on each individual trigger zone and then just plug in the variables. I can get it to work if I specify which animation to play by name but that means a different script for every animation. the audio part works fine as it plays whatever audio I put into that variable slot but the animation always plays the default animation on character. here is my script - well one of several attempts that didn’t work so I guess which attempt I post is of no importance. Instead of writing a new script for every animation that will be played i want one script that will play whatever variable I put in the animation slot on whatever gameobject I put in the source spot ( as i mentioned, the audio variable works fine)

var Sound : AudioClip;
var ani : AnimationClip; 
 var source : GameObject;
	function OnTriggerEnter (col : Collider) {
if(col.gameObject.tag == "Player")
	AudioSource.PlayClipAtPoint(Sound, transform.position);
	//Destroy(gameObject, 2);

Well I don’t use JS but what I would suggest to make this a whole lot easier is to make an animator controller and put the all the related animations into that and add it as a component on the player object. Make variables and use transitions in the animator controller window, based on your post, I would suggest making all the transitions be from the “any state” to all the animations you have with a value for each of them. Then in the collision script in each collider, reference the animator controller and set the value based on the current collider.