Dialog Menu

Here is an example of Aty Scripts - UI Kit's dialog menu system usage.

Dialog Menu Usage Guide

Creating a Dialog Menu

To create a dialog menu, use the following function:

aty.createDialog("Dialog Menu", "This is a dialog menu.", {
    name = "test_dialog",
    title = "Dialog Menu",
    subtitle = "This is a dialog menu.",
    position = "top-left",
    inputs = {
        {
            title = 'Name Surname',
            type = 'text',
            placeholder = 'Enter your name and surname'
        },
        {
            title = 'Age',
            type = 'number',
            placeholder = 'Enter your age',
        },
        {
            title = 'Password',
            type = 'password',
            placeholder = 'Enter your password'
        },
        {
            title = 'Birthday',
            type = 'date',
        },
        {
            title = 'Birthday Time',
            type = 'time',
        },
        {
            title = 'Favorite Color',
            type = 'color',
        },
        {
            title = 'Height',
            type = 'range',
            placeholder = 'Enter your height',
            min = 120,
            max = 210,
            value = 150
        },
        {
            name = 'test_checkbox',
            title = 'Are you a human?',
            type = 'checkbox',
        },
        {
            title = 'Favorite Food',
            type = 'radio',
            options = {
                {
                    value = 'hamburger',
                    text = 'Hamburger'
                },
                {
                    value = 'pizza',
                    text = 'Pizza'
                },
                {
                    value = 'pasta',
                    text = 'Pasta'
                },
                {
                    value = 'salad',
                    text = 'Salad'
                }
            }
        },
        {
            title = 'Select Option',
            type = 'select',
            placeholder = 'Test Placeholder',
            options = {
                {
                    value = 'Option 1',
                    text = 'Option 1'
                },
                {
                    value = 'Option 2',
                    text = 'Option 2'
                },
                {
                    value = 'Option 3',
                    text = 'Option 3'
                }
            }
        }
    }
}

Dialog Parameters

Name

  • "test_dialog" A unique identifier for the dialog menu. Type: string

Title

  • "Dialog Menu" The title of the dialog menu. Type: string

Subtitle

  • "This is a dialog menu" Additional text displayed below the title. Type: string

Position

  • "top-right" Determines where the context menu appears on the screen. Options: "top-right", "top-left", "bottom-right", "bottom-left", "bottom", "top", "left", "right", "center" Type: string


Input Fields

Text Input

  • Title: "Name Surname"

  • Type: 'text'

  • Placeholder: "Enter your name and surname"

Number Input

  • Title: "Age"

  • Type: 'number'

  • Placeholder: "Enter your age"

Password Input

  • Title: "Password"

  • Type: 'password'

  • Placeholder: "Enter your password"

Date Input

  • Title: "Birthday"

  • Type: 'date'

Time Input

  • Title: "Birthday Time"

  • Type: 'time'

Color Picker

  • Title: "Favorite Color"

  • Type: 'color'

Range Input

  • Title: "Height"

  • Type: 'range'

  • Placeholder: "Enter your height"

  • Min: 120

  • Max: 210

  • Value: 150 (Default value)

Checkbox

  • Name: "test_checkbox"

  • Title: "Are you a human?"

  • Type: 'checkbox'

Radio Buttons

  • Title: "Favorite Food"

  • Type: 'radio'

  • Options:

    • value: "string"

    • text: "string"

  • Title: "Select Option"

  • Type: 'select'

  • Placeholder: "Test Placeholder"

  • Options:

    • value: "string"

    • text: "string"


This structure provides a detailed and highly customizable dialog menu suitable for various scenarios. Each input type supports its unique attributes to tailor the dialog menu to your requirements.


Open Dialog

aty.openDialog("test_dialog", function(data)
    if data.result == "ok" then -- Here will be the used when the dialog is accepted.
    
        -- Data will come in a table format.
        -- You can find them in the data.inputs table.
        for k, v in pairs(data.inputs) do
            Wait(500)
            aty.sendNotify(k, v, "info", 10000)
        end
    elseif data.result == "cancelled" then -- Here will be the used when the dialog is canceled.
        -- Here will be the used when the dialog is canceled.
    end
end)

Last updated