Skip to content
ForgeCastDocs

Overlays

Put your plugin's own values (a timer, a score, a queue) into the streamer's overlays.

Functions

overlay.set(name, value)

Show a value in the streamer's overlays, live. In an overlay's text, {{plugin.<your plugin id>.<name>}} shows it (a number can be shortened as on any variable: {{plugin.my-counter.total | compact}} shows 12K). A name is a letter, then up to 31 letters, digits or _. A value is text (up to 500 characters), a number or true/false (shown as on/off); nil takes it away. Up to 50 values. They leave the overlays when the plugin stops.

  • name: string
  • value: string|number|boolean|nil

overlay.get(name)

A value you set (nil when there is none).

  • name: string

Returns string|number|boolean|nil

overlay.clear()

Take all your values out of the overlays.

overlay.press(button, callback)

Press a button setting of your running overlays (the animation or sound it starts plays), like pressing it on the Overlays page.

  • button: string. the button setting's name
  • callback: fun(shown: integer?, error?: string), optional

overlay.confetti(opts, callback)

Confetti over the stream.

  • opts: { seconds: number?, count: integer?, colors: string[]? }, optional
  • callback: fun(shown: integer?, error?: string), optional

overlay.rain(spec, callback)

Emotes or emoji falling down the stream: { image = emotes.image(":fire:") } or { text = "🔥" }.

  • spec: { image: string?, text: string?, count: integer?, seconds: number? }
  • callback: fun(shown: integer?, error?: string), optional

overlay.lower_third(spec, callback)

A name card that slides in at the bottom ("Ann · our newest member").

  • spec: { title: string, subtitle: string?, accent: string?, position: "left"|"right"|"center"|nil, seconds: number? }
  • callback: fun(shown: integer?, error?: string), optional

overlay.spawn(widget, opts, callback)

Show a widget or overlay from your library for a moment, with its settings filled in. It has to have been used once (pressed Use). x and y place its middle (0 to 1 across the stream).

Name

Type

overlay.draw(id, tree, opts)

Draw your own small widget on stream, from the same elements as windows (text, headings, badges, pictures, bars, rows, columns, tables; nothing to click). Drawing the same id again replaces it.

Name

Type

overlay.clear_draw(id)

Take a drawing (or a canvas) off the stream.

  • id: string

overlay.performance(mode, callback)

Set how much your running overlays may spend drawing: "auto", "quality", "balanced" or "saver".

  • mode: "auto"|"quality"|"balanced"|"saver"
  • callback: fun(changed: integer?, error?: string), optional

Canvas:clear(color)

Start the frame again (filled with a colour, or see-through).

  • color: string, optional

Returns Canvas

Canvas:rect(x, y, w, h, color)

A filled rectangle.

Returns Canvas

Canvas:circle(x, y, r, color)

A filled circle.

Returns Canvas

Canvas:line(x1, y1, x2, y2, color, width)

A line.

Returns Canvas

Canvas:text(x, y, text, color, size, align)

Text (align "left", "center" or "right").

Returns Canvas

Canvas:image(url, x, y, w, h)

A picture (an https address, an emote, or assets.url).

Returns Canvas

Canvas:commit()

Show the frame drawn since the last commit (false when it came too soon: 20 frames a second at most).

Returns boolean

Canvas:hide()

Take the canvas off the stream.

overlay.canvas(spec)

A drawing surface on stream for games chat plays (snake, a pixel wall…): draw, then :commit(). Up to 500 drawings a frame.

  • spec: { id: string?, width: integer?, height: integer?, x: number?, y: number? }

Returns Canvas

Types

Open a type to see its fields; type names above link here.

On this page