\eval
Runs the specified JavaScript / Script API code. This can be very useful for doing things such as running more advanced commands with JavaScript variables and conditions, or running commands with JavaScript escape codes(for example to put multiple lines of text in the name of an entity or use special unicode characters in commands without needing to copy and paste them into your game).
\eval
Dflt USM Sec Lvl: | admin |
---|---|
Dflt Required Tags: | canUseChatCommands |
Categories: | misc |
Version: | 1.1.0 |
Undo Supported: | N/A |
Functional: | Yes |
Deprecated: | No |
Syntax
\eval <ScriptAPICode: JavaScript>
Arguments
<ScriptAPICode: JavaScript>
: JavaScript
Result
Command | Trigger | Result |
---|---|---|
Any | The command is incomplete, or any argument is not specified correctly. | Unparseable |
An error occurs while running the provided JavaScript / Script API code. | Failed | |
Otherwise | Successful |
Examples
- Send a tellraw command message:
\eval world.sendMessage("Example message\nNew Line\nSender's Name: " + player.name + "\nToken Emoji: \uE105")
- API Reference:
world.sendMessage()
player
(Only available in the context of this command)
- API Reference:
- Give all players health boost with the level equal to their XP level:
\eval srun(()=>world.getAllPlayers().forEach((p)=>{p.addEffect("health_boost", 200, {amplifier: player.level, showParticles: false})}))
- API Reference:
History
This section of the page is empty.
You can help by expanding it.