Attach a script to a sprite or the stage
add_scriptCompile a JSON action list into executable Scratch blocks attached under a chosen hat event (e.g., flag click or key press) for a specified sprite or the Stage.
Instructions
Compiles a JSON action list into real Scratch blocks and attaches it under a hat block. Example: {"target":"Cat","when":"flag","do":[{"say":["Hi!",2]},{"forever":[{"move":4},"bounce_on_edge"]}]}. Call dsl_reference for every available action, expression and hat.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| do | Yes | Ordered list of actions to run under the hat block | |
| when | No | Hat block: "flag" (default), "clicked", "clone", {"key":"space"}, {"broadcast":"go"}, "never" | |
| target | Yes | Sprite name, or "Stage" |