> For the complete documentation index, see [llms.txt](https://jixelpatterns.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jixelpatterns.gitbook.io/docs/dependency/jim_bridge/scaleforms.md).

# Scaleforms

## debugScaleform.lua

This module renders debug text in-game when `debugMode` is enabled. Useful for live diagnostics or UI placement feedback.

### **debugScaleForm(textTable, loc)**

Displays an overlay of lines of text at the specified screen location.

{% hint style="danger" %}
**Note:** This only works if `debugMode` is set to `true`.
{% endhint %}

**Parameters:**

* `textTable` (`table`): A list of strings to display.
* `loc` (`vector2`, optional ): Top-left anchor point on screen ( default: `vec2(0.05, 0.65)`).

**Example:**

```lua
CreateThread(function()
    while true do
        debugScaleForm({
            "Line 1: Debug info",
            "Line 2: More info"
        })
        Wait(0)
    end
end)
```

## instructionalButtons.lua

This module renders instructional button prompts using native scaleforms in GTA V and RedM.

{% hint style="danger" %}
&#x20;**Note:** Because it uses native scaleforms, it must be run inside a `while` loop to remain visible.
{% endhint %}

### **makeInstructionalButtons(info)**

Draws instructional buttons using the GTA scaleform `instructional_buttons`.

**Parameters:**

* `info` (`table`): An array of tables, where each entry contains:
  * `keys` (`table`): Control key codes (e.g., `{38, 29}`).
  * `text` (`string`): The label for the button.

**Example:**

```lua
CreateThread(function()
    while true do
        makeInstructionalButtons({
            { keys = {38, 29}, text = "Open Menu" },
            { keys = {45}, text = "Close Menu" }
        })
        Wait(0)
    end
end)
```

**makeRedInstructionalButtons(info, title)**

**Experimental**: Displays prompts using RedM-style `PromptSetGroup` API.

{% hint style="danger" %}
**Note:** Still must be run in a loop for visibility.
{% endhint %}

**Example:**

```lua
CreateThread(function()
    while true do
        makeRedInstructionalButtons({
            { keys = {0x760A9C6F}, text = "Mount Horse" },
            { keys = {0x4CC0E2FE}, text = "Dismount" }
        }, "Horse Controls")
        Wait(0)
    end
end)
```

## scaleform\_basic.lua

This module includes helper functions for 3D text rendering and UI overlays using basic native scaleform techniques.

### **DrawText3D(coord, text, highlight)**

Draws 3D text in the world at the given coordinates, with optional highlight.

Includes a semi-transparent black background box for visibility.

**Parameters:**

* `coord` (`vector3`): World position to draw text.
* `text` (`string`): Text content.
* `highlight` (`boolean`, optional ): Highlights `~w~` sections with yellow.

**Example:**

```lua
CreateThread(function()
    while true do
        DrawText3D(vector3(100, 200, 300), "Hello World", true)
        Wait(0)
    end
end)
```

### **DisplayHelpMsg(text)**

Shows a help message in the top-left corner of the screen.

**Example:**

```lua
DisplayHelpMsg("Press E to interact")
```

### **displaySpinner(text)**

Shows a busy spinner with a message (e.g., "Saving...").

**Example:**

```lua
displaySpinner("Saving data...")
```

### **stopSpinner()**

Hides any active busy spinner (client-only).

**Example:**

```lua
stopSpinner()
```

## timerBars.lua

This module provides a native scaleform-based timer bar HUD. Ideal for displaying tasks, loading indicators, or time-sensitive objectives.

### **createTimerHud(title, data, alpha)**

{% hint style="info" %}
This was an attempt to recreate the gta native shooting ranges (fairly specific use case)
{% endhint %}

Draws a timer bar with custom label and right-aligned values using the native GTA HUD system.

**Parameters:**

* `title` (`string`): Title/header displayed on the bar.
* `data` (`table`): List of `label = value` entries to display (max 4 rows).
* `alpha` (`number`, optional ): Opacity of the bar (0-255).

**Example:**

```lua
CreateThread(function()
    while true do
        createTimerHud("Timer Bar", {
            { stat = "Health", value = "85%" },
            { stat = "Armor", value = "50%", multi = 2 },
            { stat = "Stamina", value = "100%" },
        }, 180)
        Wait(0)
    end
end)
```


---

# 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://jixelpatterns.gitbook.io/docs/dependency/jim_bridge/scaleforms.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.
