Script REPL (read–eval–print loop) Add-On is a debugging tool for Minecraft Scripting, that allows user to run JavaScript code in Minecraft: Bedrock Edition. This powerful add-on is great to use for debugging, prototyping, and learning JavaScript and Minecraft's scripting API.
Currenly JavaScript is the only programming language that allow developers to use Script APIs from within their code.
This add-on allows developers to debug JavaScript code and reports an error condition immediately in Minecraft in-game using this interpreter. This reduces the amount of script errors happened in your code development and time, and allows developers to experiment with the new features available in Script API modules in Minecraft.
You are advised to learn JavaScript free from online courses available online before learning how to use Minecraft's Scripting API, such as the following:
There are somewhat decent amount of resources available online related to script API. Important links have a ⭐.
⭐ Sample GameTests from Microsoft - Sample GameTest behavior files for Minecraft Bedrock Edition. Minecraft supports GameTests - a combination of JavaScript + MCStructures - for validating facets of Minecraft behavior.
⭐ Official Script API Documentation - Microsoft's official documentation of high-level introduction of experimental Script API
Jayly's Script API Documentation - Jayly's Script API documentation with guides and easy to use and understand API references for programming beginners.
Script API Examples - JavaScript code snippets that uses Script API modules only
Click here for a list of links related to resources for Minecraft Script API.
Here are some examples executing JavaScript in-game:
Get it? Cause Aether dimension does not exist in Minecraft.
JavaScript REPL [Use]
item through the following methods:/scriptevent interpreter:js
!javascript
Important
This feature is only available behind beta versions of interpreter only.
JavaScript REPL [Use]
to open the interpreterIn case you want to disable your code, you have to run /reload
command which requires operator permission to execute the command.
Note
This feature is not available to Script REPL v1.21.0 without Beta APIs experiment.
The Script Block can store and execute JavaScript code in a Minecraft world. It cannot be obtained or used in Survival mode without cheats.
The script blocks can either be obtained by using various commands, such as /give @s interpreter:script_block
or /setblock ~ ~ ~ interpreter:script_block
, or by pressing the pick block control on an existing script block.
Script blocks are not flammable, and have the same blast resistance as bedrock. They cannot cannot be mined in Survival mode, however they can be pushed with pistons and sticky pistons and the data inside the block persists.
A script block can execute JavaScript code when activated by pressure plates and buttons currently. Script output is displayed when player activates the script block.
To enter command or modify the script block, players must interact with the script block. The scripts can be entered in the text input within the modal form. The text limit for scripts in a script block is 32,767 characters, you can scroll through lines of code just like the NPC text prompt UI.
Scripts in a script block do not need to be prefixed with imports (e.g. import { world } from "@minecraft/server"
) as they do in the actual JavaScript files.
When finished inputing JavaScript code, save the code into the script block by pressing 'Save' button. Upon pressing the button it will not immediately execute scripts unlike the Script REPL item.
This is a very old showcase video of the add-on, fun fact the video includes the ability to run TypeScript code because this add-on used to be able to run TypeScript code.
First you go to the download section and click "Download Script REPL" (with or without experimentals), then the add-on will be downloaded to your device.
Import the add-on to Minecraft.
Important
Enable Beta APIs experiments in world settings. These experiments are needed to run Script REPL with Beta API features.
Enable Experiments in New Create World Screen
No experimental toggles needed to be enabled.
Each invidiual version of Script REPL supports various fields of the APIs. Each version of script REPL have the latest version of script modules as the dependency on their channels:
@minecraft/server
: 1.12.0-beta
@minecraft/server-ui
: 1.2.0-beta
@minecraft/server-gametest
: 1.0.0-beta
@minecraft/debug-utilities
: 1.0.0-beta
@minecraft/server
: 1.11.0
@minecraft/server-ui
: 1.1.0
@minecraft/server
: 1.13.0-beta
@minecraft/server-ui
: 1.3.0-beta
@minecraft/server-gametest
: 1.0.0-beta
@minecraft/debug-utilities
: 1.0.0-beta
@minecraft/server
: 1.12.0
@minecraft/server-ui
: 1.2.0
Note
All versions of Script REPL also loads external npm packages such as @minecraft/vanilla-data
and @minecraft/math
when executing JavaScript code.
These download links do not go through Boostellar, so there shouldn't be any malicious links.
This version is available to download for Minecraft: Education Edition. Keep in mind not every feature are available to this version of add-on. Contact JaylyMC for more infomation.
Important
Holiday Creator Features experiment is required to use this add-on.