# How to detect face triggers from script

**URL:** <https://forum.deepar.ai/t/how-to-detect-face-triggers-from-script/574>\
**Category:** Studio\
**Created:** [February 15, 2024, 2:27pm UTC](https://forum.deepar.ai/t/how-to-detect-face-triggers-from-script/574 "2024-02-15T14:27:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nivardo\_Albuquerque](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.deepar.ai/nivardo_albuquerque/32/790_2.png) [@Nivardo\_Albuquerque](https://forum.deepar.ai/u/Nivardo_Albuquerque)\
**Post date:** [February 15, 2024, 2:27pm UTC](https://forum.deepar.ai/t/how-to-detect-face-triggers-from-script/574/1 "2024-02-15T14:27:41Z")

</div>

Hello,

I’m trying to enable/disable a node on mouth open/close and run some custom code.

My issue here is that i’m not sure how to access the Enum described on docs that should be under Utility ( [DeepAR Scripting API: Namespace: Utility](https://docs.deepar.ai/scripting/api-reference/Utility.html#.TriggerType).

```auto
// Use this for initialization
function onStart() {
	Debug.log("STARTED")
	Debug.log("MOUTH_OPEN_SENSITIVE: " + Utility.MOUTH_OPEN_SENSITIVE)
	Debug.log("MOUTH_CLOSED_SENSITIVE: " + Utility.MOUTH_CLOSED_SENSITIVE)

}

// Update is called once per frame
function onUpdate() {

}

// Update is called once per frame
function onTriggerStateChanged(triggerType, state, faceId){

	Debug.log(triggerType + ": " + state)
	if(triggerType === Utility.MOUTH_OPEN_SENSITIVE){
			Debug.log("MOUTH_OPEN_SENSITIVE: " + state)

	}
	if(triggerType === Utility.MOUTH_CLOSED_SENSITIVE){
			Debug.log("MOUTH_CLOSED_SENSITIVE: " + state)

	}
}

```

This code outputs undefined on start and some uint for face triggers. I’m not able to identify the corrects uint.

Thanks

---

<div class="post-metadata">

**Author:** ![jelena](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.deepar.ai/jelena/32/14_2.png) [@jelena](https://forum.deepar.ai/u/jelena)\
**Post date:** [February 16, 2024, 4:16pm UTC](https://forum.deepar.ai/t/how-to-detect-face-triggers-from-script/574/2 "2024-02-16T16:16:53Z")

</div>

Fixed script:

```auto
// Use this for initialization
function onStart() {
	Debug.log("STARTED")
	Debug.log("MOUTH_OPEN_SENSITIVE: " + Utility.TriggerType.MOUTH_OPEN_SENSITIVE)
	Debug.log("MOUTH_CLOSED_SENSITIVE: " + Utility.TriggerType.MOUTH_CLOSED_SENSITIVE)

}

// Update is called once per frame
function onUpdate() {

}

// Update is called once per frame
function onTriggerStateChanged(triggerType, state, faceId){

	//Debug.log(triggerType + ": " + state)
	if(triggerType === Utility.TriggerType.MOUTH_OPEN_SENSITIVE){
			Debug.log("MOUTH_OPEN_SENSITIVE: " + state)

	}
	if(triggerType === Utility.TriggerType.MOUTH_CLOSED_SENSITIVE){
			Debug.log("MOUTH_CLOSED_SENSITIVE: " + state)

	}
}

```

It’s Utility.TriggerType.TRIGGER\_NAME  
Otherwise, you did it correctly

---

<div class="post-metadata">

**Author:** ![Nivardo\_Albuquerque](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.deepar.ai/nivardo_albuquerque/32/790_2.png) [@Nivardo\_Albuquerque](https://forum.deepar.ai/u/Nivardo_Albuquerque)\
**Post date:** [February 16, 2024, 5:44pm UTC](https://forum.deepar.ai/t/how-to-detect-face-triggers-from-script/574/3 "2024-02-16T17:44:40Z")

</div>

Thanks @jelena, maybe we could add this to the docs as an example?

---

<div class="post-metadata">

**Author:** ![jelena](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.deepar.ai/jelena/32/14_2.png) [@jelena](https://forum.deepar.ai/u/jelena)\
**Post date:** [February 16, 2024, 5:50pm UTC](https://forum.deepar.ai/t/how-to-detect-face-triggers-from-script/574/4 "2024-02-16T17:50:48Z")

</div>

Some expanding on the scrips docs is planned, for now feel free to ask me if you get stuck or would like to see anything else documented in more detail.
