# okokTextUI

[**YouTube Video**](https://www.youtube.com/watch?v=CGVBsQWlrLw)

## Installation Guide

#### Displaying

```lua
exports['okokTextUI']:Open('[Key] Message', 'color', 'position', playSound)
```

#### Hiding

```lua
exports['okokTextUI']:Close()
```

#### Displaying (in a loop)

```lua
exports.okokTextUI:OpenThisFrame('[Key] Message', 'color', 'position', playSound)
```

**Colors:**&#x20;

* <mark style="color:blue;">lightblue / darkblue</mark>;
* <mark style="color:green;">lightgreen / darkgreen</mark>;
* <mark style="color:red;">lightred / darkred</mark>;
* lightgrey / darkgrey.

**Positions:**

* right;
* left.

**Play sound:**

* true;
* false.

#### Example

```lua
local shown = false
local inDistance = false

while true do
    inDistance = false
    -- your code
    if playerDistance <= distance then
        inDistance = true
        -- your code when you are inside the range
    else
        -- your code when you are outside the range
    end

    if not shown and inDistance then
        exports['okokTextUI']:Open('[E] Hello', 'lightgreen', 'right', true)
        shown = true
    elseif shown and not inDistance then
        exports['okokTextUI']:Close()
        shown = false
    end
end
```

#### Example (loop)

```lua
while true do
    -- your code
    if playerDistance <= distance then
        exports['okokTextUI']:OpenThisFrame('[E] Hello', 'lightgreen', 'right', true)
        -- your code when you are inside the range
    else
        -- your code when you are outside the range
    end
end
```


---

# 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://docs.okokscripts.io/scripts/okoktextui.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.
