How do you script a change to Idle with Mecanim?

I am struggling mad with mecanim. I’m trying to follow a tutorial on dialogue boxes, but I’ve found that upon deactivating scripts relating to all movement (so as to focus on conversation), the animation is locked - if I’m running, I stay running. This problem has occured before and I need to solve it.

So I want to set the animation to idle before I deactivate movement scripts. I would love to do Animation.Play(“idle”) but having looked around, I’ve got to do other stuff, but I just can’t wrap my head around it. How do I make the animation go from running to idle? If I have to set booleans somewhere, where do I set them? In the script, or in the animator? And why does unity tell me that the parameter “Idle” in the StopAnimation function is an unexpected token when there is a state called “Idle” within the animator?

Appreciate any help you can give.

var talkTextGUI : UnityEngine.UI.Text;
var talkLines : String[];
private var loco : LocomotionPlayer;
private var currentLine : int;
private var talking : boolean;


function OnTriggerEnter (col : Collider){
	if(col.tag == "Player"){
		loco = col.GetComponent("LocomotionPlayer");
		//Debug.Log("Script works");
		talking = true;
		currentLine = 0;
		talkTextGUI.text = talkLines[currentLine];
		StopAnimation();
	}
}

function Update () {
	if(talking){
		if(Input.GetButtonDown("Ctrl") && currentLine < talkLines.length - 1){
			//display next line	
			currentLine++;
			talkTextGUI.text = talkLines[currentLine];
			Debug.Log(talkLines[currentLine]);
		} //else {
			//currentLine = 0;
			//talkTextGUI.text = "";
			//talking = false;
			//loco.enabled = true;
		//}
	}

}

function StopAnimation("Idle"){
	animator.SetTrigger("Idle"); 
    //animator.SetBool(animator.StringtoHash "Idle", true) is better???
	loco.enabled = false;
}

Yeah, exactly. Animation refers to the Legacy animation system. Mecanim uses the Animator window to handle animation transitions. Inside this tutorial you can learn very quickly how to properly use Mecanim animation system.

http://unity3d.com/learn/tutorials/modules/beginner/2d/2d-controllers