New Dialog Button Running Code (Expression) — Skript

Addon: Skript · Category: Expression

Syntax

[new] dialog button labeled %component% [with tooltip %component%] [with width %number%] running [code]

Description

Creates a dialog button whose code runs when a player clicks it. The button sends the dialog's input values back with the click, so 'dialog input' works inside the section. The player who clicked is the event-player. The section runs on the server, so it can do anything a normal trigger can. Use 'new dialog button' without 'running code' for a button with a fixed client-side action. Warning: the button's callback key is live from parse time onward, and any player can send a click for it at any time with arbitrary input values, not just the player it was shown to. Always validate anything read from 'dialog input' before trusting it.

Examples

set {_buy} to new dialog button labeled mm("<green>Buy") running code:
	send "You bought %dialog input ""qty""% items!" to player

View source