Play Strawberry Docs
Scripts

Scripts

Use lifecycle callbacks, commands, events, gameplay resources, and the public script API.

Events and commandsHow a script reacts to game events and adds commands, with the details of clicks, items, fishing, projectiles and packets.Script lifecycleRegister in on_load, clean up what you own in on_unload, and know what the server removes for you.Events and handler optionsChoose priority, blocking, ignore-cancelled and a failure verdict for each handler, and read what each event carries.Commands and suggestionsBuild a command tree with typed arguments, answer suggestions, and keep secrets out of the log.Tab-complete and command listsUse the tab-complete and send-commands extension events to control completions and the command list.SchedulerSync tasks run on the game tick, async tasks run beside it; both count game ticks and can be cancelled.PermissionsPlayer permission nodes are separate from the sandbox permissions your script asks for.Data folder and persistenceKeep files in your private data folder and data on game objects, and check everything you read back.Text and translationsBuild structured messages and load translations under your own namespace.Inventory menusBuild an inventory menu, open it for a player and handle its clicks safely.Bedrock formsOpen Bedrock forms for Bedrock players and check every response against the form you opened.Java dialogsShow dialogs with bodies, inputs and action buttons, and check each click.Scoreboards and teamsManage objectives, scores, display slots and teams without overwriting another feature.Boss barsCreate a boss bar, manage who sees it, and remove it when the feature ends.Displays and interactionsShow text, blocks and items with display entities, animate them together, attach parts to entities and use interaction entities as click targets.Blocks, drops and explosionsBreak and edit blocks, drop items, control explosions, add your own blocks, protect builds and react to what the world does to blocks.World generationMake a world's chunks with your own ChunkGenerator, add biomes and worlds with data packs, and test your generator on your machine.AI goalsGive mobs goals and targets, move them to a place, switch their AI off and handle mobs that turn into other mobs.Inter-script communicationExchange small, versioned messages with another script and handle both kinds of error.Password hashingLet the server hash and check passwords with Argon2id, off your script's time and off the game tick.Login and security scriptsWhat a login or protection script needs so that a slow or broken script never lets an action through.Limits, failures and restartsThe limits the server puts on a script, and what happens when a script fails.Efficient and safe scriptsBound the work and state of every call, and measure instead of assuming speed.Sub-serversMove players between your server's sub-servers, and create, start and stop them from a script.Resource packsDescribe your resource pack once and build the Java and the Bedrock zip from it with strawberry-kit, the same bytes every time.Game updates and your worldsDeclare the worlds your game makes, so a new version of your game ships new maps while players keep their progress.Maps on the screenShow players a map of the place around them on the HUD and in the Tab list, with markers and a party, on a vanilla Java client.Your server's own packPut the two zips of your last pack build on your own server with one command, so every player gets the pack of their edition when they join.What Bedrock players seeWhat a Bedrock player gets for each Java feature that your server, its scripts and its pack use.Players and entitiesLook up and move players, change what one of them sees, and work with mobs, mannequins and other entities from your script.RecipesRegister crafting, cooking, smithing and stonecutter recipes, use your own custom items as ingredients, remove recipes and read the ones the server has.Custom itemsAdd textures, models, sounds and custom items to the server's own resource pack, and set what an item does through its components.Simulated playersRun scripted play tests of your game on your developer server with players that your script drives.Play testsWrite a scenario file, and bots play your game on your developer server while every step is checked.Menus and screensBuild inventory menus and screen menus with the UI script, within its limits, and see what Bedrock players get.Module scriptsExport functions that your other scripts on the same server call, with the limits and the error codes a call can answer.Animated charactersBring a Blockbench model with bones and animations and get a mob that walks, plays its animations, takes damage and has a boss bar of its own look.Play Strawberry's toolsAdd your own items, textures, models and animated characters, and show menus that use them, with the strawberry-tools crate.