# Built-in Functions

Components come with a series of built-in functions that will make it easier to interact with them.

## Modify the HTML structure

```javascript
static template ()
```

This function allows you to either get the HTML structure from a component, or set a new one to it.

### Examples

```javascript
monogatari.component ('main-screen').template (() => {
    return `
        <h1>My Awesome Game</h1>
        <main-menu></main-menu>
    `;
});
```

## Running an arbitrary line of Monogatari

```javascript
monogatari.run ("string")
```

Runs a line of the script as though it were a regular line in the script array. Can be invoked from the JavaScript development console for testing, such as `monogatari.run("jump myLabel")` if you want to rapidly test a particular label. This can also be used as part of a function if you need to do something specific or fancy. Up to you.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.monogatari.io/documentation/develop/building-blocks/components/built-in-functions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
