# Rules

<figure><img src="https://2186043722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mgll1jjQMRTVj7p6n7g%2Fuploads%2FiERlzjiICESOHuYLwtVq%2Fimage.png?alt=media&#x26;token=ca1349e3-8327-4a1a-97eb-12384133fe00" alt=""><figcaption><p>Rules</p></figcaption></figure>

Rules are the building blocks of interactivity in your experience.

{% hint style="info" %}
GMetri uses rules in the form of simple sentences. Like\ <mark style="color:green;">`When polygon is clicked`</mark>`,`` `<mark style="color:blue;">`Then video should disappear`</mark>
{% endhint %}

Rules are always of the form: <mark style="color:green;">**When Something Happens**</mark>**,&#x20;**<mark style="color:blue;">**Then Do Something**</mark>

You can combine multiple *When Events* using `AND` or `OR` highlighted above. You can also combine multiple *Then Actions*. Click on "+Add an Action" to add *Then Actions*, Click on "Add an Event" to add *When Events*.

## Example: Viewer Rules

Using a "When Rule", you can detect when a viewer **enters a zone**.

<figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mgll1jjQMRTVj7p6n7g%2Fuploads%2F8DaNgHZKWvd43kXyC9QI%2Fimage.png?alt=media&#x26;token=10ff3d30-8f1e-43a0-8b87-69508d971332" alt=""><figcaption><p>Viewr Rules</p></figcaption></figure>

Also, using a "Then Rule" you can make the Viewer do the following:

* **Teleport** to another scene, object, or zone.
* **Change the scene** to a different one within the experience.
* **Direct** the viewer to a specific object or element.

## More About Rules

* [shared-rules](https://docs.gmetri.com/metaverse/build/rules/shared-rules "mention")
* [how-rules-work](https://docs.gmetri.com/metaverse/build/rules/how-rules-work "mention")
* [number-variable-rules](https://docs.gmetri.com/metaverse/build/rules/number-variable-rules "mention")
* [string-variable-rules](https://docs.gmetri.com/metaverse/build/rules/string-variable-rules "mention")
* [boolean-variable-rules](https://docs.gmetri.com/metaverse/build/rules/boolean-variable-rules "mention")

## Also Read

* [string-substitution](https://docs.gmetri.com/metaverse/build/variables/string-substitution "mention")
* [zones](https://docs.gmetri.com/metaverse/build/scenes/3d-scene/zones "mention")
