OSRS Plugin API
    Preparing search index...

    Class SliderInt

    A moveable horizontal integer slider element.

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Properties

    display: string

    The text that is displayed inside the slider.

    -- Create new container
    local newWindow = osrs.Ui.window({title = "Example Window"})

    -- Create a slider with display text, and one without
    local slider1 = osrs.Ui.sliderInt()
    local slider2 = osrs.Ui.sliderInt({display = "Test"})

    -- Add sliders to the container
    newWindow:addChild(slider1)
    newWindow:addChild(slider2)

    -- Add container to the canvas
    osrs.Ui.canvas:addChild(newWindow)
    enabled: boolean

    Controls whether an interactive element is enabled/disabled.

    true
    
    -- Create new container
    local newWindow = osrs.Ui.window({title = "Example Window"})

    -- Create a checkbox that is interactable, and one that is not
    local interactableCheckbox = osrs.Ui.checkbox(
    {
    label = "Interactable",
    onValueChange = function()
    osrs.print("Checkbox is Interactable")
    end
    }
    )
    local notInteractableCheckbox = osrs.Ui.checkbox(
    {
    label = "Not Interactable",
    enabled = false,
    onValueChange = function()
    osrs.print("Checkbox is not Interactable, this should not print")
    end
    }
    )

    -- Add the Checkbox's to the container
    newWindow:addChild(interactableCheckbox)
    newWindow:addChild(notInteractableCheckbox)

    -- Add container to the canvas
    osrs.Ui.canvas:addChild(newWindow)
    label: string

    The text that should display to the left of the slider.

    "Example Label"
    
    -- Create new container
    local newWindow = osrs.Ui.window({title = "Example Window"})

    -- Create a slider with a label, and one without
    local slider1 = osrs.Ui.sliderInt()
    local slider2 = osrs.Ui.sliderInt({label = "Test"})

    -- Add sliders to the container
    newWindow:addChild(slider1)
    newWindow:addChild(slider2)

    -- Add container to the canvas
    osrs.Ui.canvas:addChild(newWindow)
    max: number

    The maximum value of the slider.

    0
    
    -- Create new container
    local newWindow = osrs.Ui.window({title = "Example Window"})

    -- Create a slider with a set max value
    local slider = osrs.Ui.sliderInt({max = 100})

    -- Add slider to the container
    newWindow:addChild(slider)

    -- Add container to the canvas
    osrs.Ui.canvas:addChild(newWindow)
    min: number

    The minimum value of the slider.

    0
    
    -- Create new container
    local newWindow = osrs.Ui.window({title = "Example Window"})

    -- Create a slider with a set min value
    local slider = osrs.Ui.sliderInt({max = 100, min = 10, value = 50})

    -- Add slider to the container
    newWindow:addChild(slider)

    -- Add container to the canvas
    osrs.Ui.canvas:addChild(newWindow)
    onValueChange?: any

    The function callback invoked when the element's value is changed.

    -- Create new container
    local newWindow = osrs.Ui.window({title = "Example Window"})

    -- Create a new dropdown menu with a change function
    local menu = osrs.Ui.dropdown(
    {
    label = "Test",
    values = {"Test1", "Test2", "Test3"},
    onValueChange = function()
    osrs.print("Change")
    end
    }
    )

    -- Add dropdown to the container
    newWindow:addChild(menu)

    -- Add container to the canvas
    osrs.Ui.canvas:addChild(newWindow)
    positionMode: LayoutMode

    How this element should position itself.

    LayoutMode.AUTOMATIC
    
    -- Create a window that has automatic position mode, this is default
    local window1 = osrs.Ui.window({title = "Automatic Position Mode"})

    -- Create a window that has manual position mode
    local window2 = osrs.Ui.window(
    {
    title = "Manual Position Mode",
    positionMode = osrs.Ui.LayoutMode.MANUAL
    }
    )

    -- Add the windows to the canvas
    osrs.Ui.canvas:addChild(window1)
    osrs.Ui.canvas:addChild(window2)
    readonly: boolean

    The boolean for whether user input should change value.

    -- Create new container
    local newWindow = osrs.Ui.window({title = "Example Window"})

    -- Create a slider that cant be interacted with
    local slider = osrs.Ui.sliderInt({max = 100, value = 50, readonly = true})

    -- Add slider to the container
    newWindow:addChild(slider)

    -- Add container to the canvas
    osrs.Ui.canvas:addChild(newWindow)
    sameLine: boolean

    Flag to control whether this element should be placed on the same line as the previous element.

    false
    
    -- Create a container
    local window = osrs.Ui.window({title = "Example Window"})

    -- Create three buttons, with two of them on the same line
    local button1 = osrs.Ui.textButton({text = "Button 1"})
    local button2 = osrs.Ui.textButton({text = "Button 2"})
    local button3 = osrs.Ui.textButton({text = "Button 3", sameLine = true})

    -- Add buttons to the container
    window:addChild(button1)
    window:addChild(button2)
    window:addChild(button3)

    -- Add container to the canvas
    osrs.Ui.canvas:addChild(window)
    style: StyleTable

    The style, if any, that should be applied to this element.

    tooltip: string

    String to display to the user when hovered over the element.

    -- Create new container
    local newWindow = osrs.Ui.window({title = "Example Window"})

    -- Create a button with a tooltip
    local button = osrs.Ui.textButton({text = "Test", tooltip = "This is a Tooltip!"})

    -- Add slider to the container
    newWindow:addChild(button)

    -- Add container to the canvas
    osrs.Ui.canvas:addChild(newWindow)
    value: number

    The current value of the slider.

    0
    
    -- Create new container
    local newWindow = osrs.Ui.window({title = "Example Window"})

    -- Create a slider with a starting value
    local slider = osrs.Ui.sliderInt({value = 50, max = 100})

    -- Add slider to the container
    newWindow:addChild(slider)

    -- Add container to the canvas
    osrs.Ui.canvas:addChild(newWindow)
    visible: boolean

    Boolean indicating whether this UI element should draw itself.

    true
    
    -- Create new container
    local newWindow = osrs.Ui.window({title = "Example Window"})

    -- Create a button that is renderable, and one that is not
    local button1 = osrs.Ui.textButton(
    {
    text = "Peek-a-Boo",
    visible = false,
    onClick = function()
    osrs.print("BOO!")
    end
    }
    )
    local button2 = osrs.Ui.textButton(
    {
    text = "Render",
    onClick = function()
    button1.visible = not button1.visible
    end
    }
    )

    -- Add buttons to the container
    newWindow:addChild(button1)
    newWindow:addChild(button2)

    -- Add container to the canvas
    osrs.Ui.canvas:addChild(newWindow)
    x: number

    The horizontal component of this element's position, in UI coordinate space.

    -- Create a window with a set x position
    local window = osrs.Ui.window({title = "Example Window", positionMode = 1, x = 100})

    -- Add window to the canvas
    osrs.Ui.canvas:addChild(window)
    xRatio: number

    The percentage distance from the left side of the screen that this element's top-left corner should be placed at when positionMode is set to LayoutMode.PROPORTIONAL. The number needs to be a decimal.

    -- Create new container with a set xRatio and yRatio
    local newWindow = osrs.Ui.window({title = "Example Window", positionMode = 2, xRatio = 0.7, yRatio = .2})

    -- Add container to the canvas
    osrs.Ui.canvas:addChild(newWindow)
    y: number

    The vertical component of this element's position, in UI coordinate space.

    -- Create a window with a set y position
    local window = osrs.Ui.window({title = "Example Window", positionMode = 1, y = 100})

    -- Add window to the canvas
    osrs.Ui.canvas:addChild(window)
    yRatio: number

    The percentage distance from the top side of the screen that this element's top-left corner should be placed at when positionMode is set to LayoutMode.PROPORTIONAL. The number needs to be a decimal.

    -- Create new container with a set xRatio and yRatio
    local newWindow = osrs.Ui.window({title = "Example Window", positionMode = 2, xRatio = 0.7, yRatio = .2})

    -- Add container to the canvas
    osrs.Ui.canvas:addChild(newWindow)

    Methods

    • Adds a UI element to the pop up container.

      Parameters

      • element: UiPrimitive

        Imgui element to add to the pop up menu

        local button = osrs.Ui.textButton( { text="Clear", tooltip="Test" })

        local selectable = osrs.Ui.selectable({text = "Example", onClick = function() osrs.print("Example Print") end}) clear:addPopUpElement(test) osrs.Ui.leftPanel:addChild(button)

      Returns any

    • Removes a UI element from the pop up container.

      Parameters

      • element: UiPrimitive

        Imgui element to remove from the pop up menu.

        local button = osrs.Ui.textButton( { text="Clear", tooltip="Test" })

        local selectable = osrs.Ui.selectable({text = "Example", onClick = function() osrs.print("Example Print") end}) clear:addPopUpElement(test) clear:removePopUpElement(test) osrs.Ui.leftPanel:addChild(button)

      Returns any