OSRS Plugin API
    Preparing search index...

    Class IfType

    Represents a single component in an IfGroup. IfTypes can be "static" meaning they are created at design time and deserialized from dat files, or "dynamic" meaning they are created at runtime by script. The IfType class is monolithic, and contains the entire set of data fields used by all IfType.IfTypes, although fields will be ignored if they are not relevant for a given type.

    Index

    Constructors

    Properties

    aspectRatio: Vector2

    TBD docs.

    baseOpName: string

    The name of the subject that the ops belonging to this IfType act on.

    -- Prints out sidebar nouns (XP Tracker, Loot Tools, Hiscores)
    local ifType = osrs.IfType.retrieveIfType(728, 6)
    local table = ifType:getChildren()
    for index, value in ipairs(table) do
    osrs.print(value.baseOpName)
    end
    blendMode: BlendMode

    TBD docs/examples.

    All the direct children of this IfType. Note that only LAYER-type IfTypes have children. EXPENSIVE. Please cache the return value before iterating. TBD example.

    colour: osrs.Colour

    TBD docs/examples.

    colour2: osrs.Colour

    TBD docs/examples.

    colourOver: osrs.Colour

    TBD docs/examples.

    componentIndex: number

    The index of the ultimate static parent component of this IFType in its interface group. TBD example: RetrieveIfType.

    dataHeight: number

    TBD docs

    dataWidth: number

    TBD docs

    dataX: number

    TBD docs

    dataY: number

    TBD docs

    diagonalStartAtBottom: boolean

    TBD docs/examples.

    event: number

    TBD docs.

    eventCode: number

    TBD docs.

    fill: boolean

    TBD docs/examples.

    graphic: number

    The id number of the sprite displayed by a GRAPHIC type IfType.

    for indexCount= 0,20 do
    local ifType = osrs.IfType.retrieveIfType(162, indexCount)
    if(ifType.type == osrs.IfType.IfTypes.GRAPHIC) then
    osrs.print("IF TYPE GRAPHIC: " .. ifType.graphic)
    end
    end
    graphic2: number

    id number of additional graphic sprite. TBD more details and examples.

    graphicURL: string

    TBD docs/examples (read-only).

    height: number

    The height of the IfType.

    local ifType = osrs.IfType.retrieveIfType(728, 6)
    if(ifType.type == osrs.IfType.IfTypes.LAYER) then
    local table = ifType:getChildren()
    for index, ifTypeChild in ipairs(table) do
    osrs.print(ifTypeChild.graphic)
    osrs.print("WIDTH: " .. ifTypeChild.width .. ", Height: " .. ifTypeChild.height)
    end
    end
    hFlip: boolean

    TBD docs/examples

    hidden: boolean

    Boolean indicating whether to display the IfType and its children.

    local ifType = osrs.IfType.retrieveIfType(728, 6)
    local popoutBarIcons = ifType:getChildren()
    -- Hides Loot Tools Icon
    popoutBarIcons[2].hidden = true;
    id: number

    the id of the interface group this IFType belongs to. TBD example.

    isEntityOverlay: number

    Is this IfType part of the Entity Overlay system? TBD: add details once Entity Overlay system is exposed.

    isIf3: boolean

    TBD docs. Not expected to be of much use for plugin API.

    isRendering: boolean

    Returns true if the IfType is currently rendering to the screen. There is no event to monitor this, so you will have to poll it to detect changes. TBD example.

    isStatic: boolean

    Returns true if the IfType is a static component (equivalent to subId==-1). TBD: example.

    lastProcess: number

    TBD docs.

    layerId: number

    This is an opaque identifier for this IfType's direct parent, or -1 if it is a top-level static layer. Read-only.

    layerIdXMax: number

    See layerIdXMin.

    layerIdXMin: number

    Dynamic layers will have this filled out. It denotes the range of subids in the ultimate static parent that might belong to us. Likely low relevance to PluginAPI.

    linkObjNumber: number

    TBD docs/examples.

    linkObjType: number

    TBD docs/examples. (Will be one of osrs.gamevals.objtypes). This will tell you what's in each inventory cell.

    modeHeight: SizeMode
    model1Id: number

    TBD docs/examples.

    model1Type: ModelTypes

    TBD docs/examples.

    model2Id: number

    TBD docs/examples.

    model2Type: ModelTypes

    TBD docs/examples.

    modelAnim: number

    TBD docs/examples.

    modelAnim2: number

    TBD docs/examples.

    modelHei: number

    TBD docs/examples.

    modelSpin: number

    TBD docs/examples.

    modelWid: number

    TBD docs/examples.

    modelXAn: number

    TBD docs/examples.

    modelXOf: number

    TBD docs/examples.

    modelYAn: number

    TBD docs/examples.

    modelYOf: number

    TBD docs/examples.

    modelZAn: number

    TBD docs/examples.

    modelZoom: number

    TBD docs/examples.

    modeWidth: SizeMode
    modeX: AlignMode

    Represents the alignment of the X-Coordinate of the IfType.

    modeY: AlignMode

    Represents the alignment of the Y-Coordinate of the IfType.

    opNames: string[]

    The list of ops belonging to this IfType.

    local ifType = osrs.IfType.retrieveIfType(728, 6)
    local table = ifType:getChildren()
    for index, ifTypeChild in ipairs(table) do
    local opNameList = ifTypeChild.opNames
    for index, opName in ipairs(opNameList) do
    osrs.print(opName .. " " .. ifTypeChild.baseOpName )
    end
    end
    orthog: boolean

    TBD docs/examples (this may refer to orthographic rendering of the model).

    outline: number

    TBD docs/examples.

    overlayId: number

    TBD docs. Read-only.

    overlayType: OverlayTypes

    TBD docs. Read-only.

    parent: osrs.IfType

    Gets this IfType's direct parent. If this IfType is a static component, returns nil.

    rotate: number

    TBD docs/examples.

    screenCoords: Vector2

    Returns the screen coordinates of the upper left corner of this IfType. This value is computed every time it is accessed (by summing the offsets of all parents).

    scrollPos: Vector2

    TBD docs. Read-only.

    scrollSize: Vector2

    TBD docs. Read-only.

    shadowColour: osrs.Colour

    TBD docs/examples

    sourceName: string

    The label of the IfType descriptor, if top-level IfType. Otherwise, is empty. TBD: Confirm that this is available in retail builds.

    -- Retrieves the popout bar
    local ifType = osrs.IfType.retrieveIfType(728, 6)
    -- Prints "popout"
    osrs.print(ifType.sourceName)
    startAngle: number

    TBD docs/examples (0-65535 range)

    staticParent: osrs.IfType

    Gets this IfType's ultimate static parent, or itself if it is static.

    stopAngle: number

    TBD docs/examples (0-65535 range)

    strokeWidth: number

    TBD docs/examples

    subId: number

    -1 for static components. For dynamic components, this is the array index into the ultimate static parent component's children array.

    text: string

    The string to display by a TEXT type IfType.

    for indexCount= 0,20 do
    local ifType = osrs.IfType.retrieveIfType(162, indexCount)
    if(ifType.type == osrs.IfType.IfTypes.TEXT) then
    osrs.print("IF TYPE TEXT: " .. ifType.text)
    end
    end
    text2: string

    Secondary text string. TBD: example.

    tiling: boolean

    TBD docs/examples.

    transparency: number

    How transparent the IfType should be. 0 - Fully Opaque, 255 - Transparent

    local changePerSecond = 4
    local ifType = osrs.IfType.retrieveIfType(728, 6)
    local table = ifType:getChildren()
    local lastChange = 0
    local transparencyValue = 0

    -- Gradually makes the sidebar icons transparent
    local loopTransparent = function()
    local currentTime = osrs.getTime()
    if (currentTime - lastChange >= (1/changePerSecond)) then
    for index, value in ipairs(table) do
    value.transparency = transparencyValue
    end
    transparencyValue = transparencyValue + 5
    osrs.print("Transparency Value: " .. transparencyValue)
    lastChange = currentTime
    if(transparencyValue > 255) then
    return false
    end
    end
    return true
    end

    drawToken = osrs.setInterval(loopTransparent, 0, drawToken)
    type: IfTypes

    The category of IfType this object belongs to.

    local ifTypeLayer = osrs.IfType.retrieveIfType(728, 6)
    local ifTypeGraphic = osrs.IfType.retrieveIfType(728, 17)
    osrs.print(ifTypeLayer.type)
    osrs.print(ifTypeGraphic.type)
    if(ifTypeLayer.type == osrs.IfType.IfTypes.LAYER) then
    osrs.print("This IfType is a Layer.")
    end
    vFlip: boolean

    TBD docs/examples

    width: number

    The width of the IfType.

    local ifType = osrs.IfType.retrieveIfType(728, 6)
    if(ifType.type == osrs.IfType.IfTypes.LAYER) then
    local table = ifType:getChildren()
    for index, ifTypeChild in ipairs(table) do
    osrs.print(ifTypeChild.graphic)
    osrs.print("WIDTH: " .. ifTypeChild.width .. ", Height: " .. ifTypeChild.height)
    end
    end
    x: number

    The x-coordinate of the IfType, relative to its parent.

    local ifType = osrs.IfType.retrieveIfType(728, 6)
    if(ifType.type == osrs.IfType.IfTypes.LAYER) then
    local table = ifType:getChildren()
    for index, ifTypeChild in ipairs(table) do
    osrs.print(ifTypeChild.graphic)
    osrs.print("X: " .. ifTypeChild.x .. ", Y: " .. ifTypeChild.y)
    end
    end
    y: number

    The y-coordinate of the IfType, relative to its parent.

    local ifType = osrs.IfType.retrieveIfType(728, 6)
    if(ifType.type == osrs.IfType.IfTypes.LAYER) then
    local table = ifType:getChildren()
    for index, ifTypeChild in ipairs(table) do
    osrs.print(ifTypeChild.graphic)
    osrs.print("X: " .. ifTypeChild.x .. ", Y: " .. ifTypeChild.y)
    end
    end

    Methods

    • Subscribe to a UI event. It is legal for the same function to be subscribed to DIFFERENT events, but double-subscribing to the same even will fail, and return false.

      Parameters

      • callback: EventCallbackPolytype

        the callback that will be invoked. The exact callback type is dependent on the event.

      • event: number

        The Id of the event to subscribe to.

      Returns boolean

      true if the subscription succeeded (can fail because of double-registration, or because event doesn't exist--check debug console).

    • Unsubscribe from a UI Event.

      Parameters

      • callback: EventCallbackPolytype

        The same callback you used to register for the event.

      • event: number

        The event the callback was registered for.

      Returns boolean

      true if the subscription was successfully found and removed.