> For the complete documentation index, see [llms.txt](https://zarzel.gitbook.io/zarscript2/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://zarzel.gitbook.io/zarscript2/documentation/api-libs/render.md).

# render

All of this functions must be run on this event for them to work&#x20;

<https://zarzel.gitbook.io/zarscript2/documentation/module/events#on_render_screen>

### render.rect

```lua
render.rect(x, y, x1, y1, r, g, b, a)
```

| Argument | Type   | Description |
| -------- | ------ | ----------- |
| x        | Number | X pos       |
| y        | Number | Y pos       |
| x1       | Number | End X pos   |
| y1       | Number | End Y pos   |
| r        | Number | Red 0-255   |
| g        | Number | Green 0-255 |
| b        | Number | Blue 0-255  |
| a        | Number | Alpha 0-255 |

Draws a filled rect on the screen

### render.line

```lua
render.line(x, y, x1, y1, size, r, g, b, a)
```

| Argument | Type   | Description |
| -------- | ------ | ----------- |
| x        | Number | X pos       |
| y        | Number | Y pos       |
| x1       | Number | End X pos   |
| y1       | Number | End Y pos   |
| size     | Number | Line size   |
| r        | Number | Red 0-255   |
| g        | Number | Green 0-255 |
| b        | Number | Blue 0-255  |
| a        | Number | Alpha 0-255 |

Draws a line on the screen

### render.player\_head

```lua
render.player_head(x, y, size, entity_id)
```

| Argument   | Type   | Description               |
| ---------- | ------ | ------------------------- |
| x          | Number | X pos                     |
| y          | Number | Y pos                     |
| size       | Number | Size of the player's head |
| entity\_id | Number | ID of the entity to draw  |

Draws the player's skin head

### render.circle

```lua
render.circle(x, y, degrees, rotation, diameter, r, g, b, a)
```

| Argument | Type   | Description            |
| -------- | ------ | ---------------------- |
| x        | Number | X pos                  |
| y        | Number | Y pos                  |
| degrees  | Number | Degrees of the circle  |
| rotation | Number | Rotation of the circle |
| diameter | Number | Circle size            |
| r        | Number | Red 0-255              |
| g        | Number | Green 0-255            |
| b        | Number | Blue 0-255             |
| a        | Number | Alpha 0-255            |

Renders a circle on your screen.

### render.player

```lua
render.player(x, y, size, yaw, pitch, entity_id)
```

| Argument   | Type   | Description                            |
| ---------- | ------ | -------------------------------------- |
| x          | Number | X pos                                  |
| y          | Number | Y pos                                  |
| size       | Number | How big will the player be             |
| yaw        | Number | Yaw where the player will be looking   |
| pitch      | Number | Pitch where the player will be looking |
| entity\_id | Number | ID of the entity to draw               |

Renders the full player on the screen

### render.string

```lua
render.string(text, x, y, r, g, b, a)
```

| Argument | Type   | Description    |
| -------- | ------ | -------------- |
| text     | String | Text to render |
| x        | Number | X pos          |
| y        | Number | Y pos          |
| r        | Number | Red 0-255      |
| g        | Number | Green 0-255    |
| b        | Number | Blue 0-255     |
| a        | Number | Alpha 0-255    |

Renders text on your screen

### render.string\_shadow

```lua
render.string_shadow(text, x, y, r, g, b, a)
```

| Argument | Type   | Description    |
| -------- | ------ | -------------- |
| text     | String | Text to render |
| x        | Number | X pos          |
| y        | Number | Y pos          |
| r        | Number | Red 0-255      |
| g        | Number | Green 0-255    |
| b        | Number | Blue 0-255     |
| a        | Number | Alpha 0-255    |

Renders text with shadow on your screen

### render.get\_string\_width

```lua
render.get_string_width(text): number
```

| Argument | Type   | Description |
| -------- | ------ | ----------- |
| text     | String | Text        |

Returns the width of the specified text

### render.scale

```lua
render.scale(scaling)
```

| Argument | Type   | Description      |
| -------- | ------ | ---------------- |
| scaling  | Number | Scale multiplier |

Scales the next drawing functions, for example, 2 multiplier will make the drawings twice as big

### render.world\_to\_screen

```lua
render.world_to_screen(x, y, z): number, number, number
```

| Argument | Type   | Description |
| -------- | ------ | ----------- |
| x        | Number | X position  |
| y        | Number | Y position  |
| z        | Number | Z position  |

Returns the screen position of the desired coordinates

### render.show\_gui

```lua
render.show_gui(gui_table)
```

| Argument   | Type  | Description                            |
| ---------- | ----- | -------------------------------------- |
| gui\_table | Table | Table containing all the gui functions |

This function is similar to the `module_manager.register` function, but instead of registering anything, it displays a custom GUI you can make. \
Further information for the events here

{% content-ref url="/pages/-MZcdCsyxX6mutrXroiH" %}
[GUI Events](/zarscript2/documentation/api-libs/render/gui-events.md)
{% endcontent-ref %}

### render.draw\_image

```lua
render.draw_image(url, x, y, width height)
```

| Argument | Type   | Description                    |
| -------- | ------ | ------------------------------ |
| url      | String | URL where the image is located |
| x        | Number | X position                     |
| y        | Number | Y position                     |
| width    | Number | Width of image display         |
| height   | Number | Height of image display        |

Draws the image thats contained in the URL, for this method to work you must have enabled unsafe script functionality


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://zarzel.gitbook.io/zarscript2/documentation/api-libs/render.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.
