Problem: When you make custom commands in Bedrock's Script API, the game's command parser checks your arguments BEFORE your script even runs. This breaks commands that need to accept:
-
Math expressions like "2 + 3 * (4 / 2)" - the + and * symbols get rejected
-
Multi-word messages without quotes - "msg @p hello there" gets split wrong
-
Symbols and special characters - !@#$ are treated as invalid
Current workarounds are bad:
-
Intercepting chat messages globally - conflicts with other addons
-
Forcing players to use quotes - confusing UX
-
Routing through /scriptevent - breaks command naming and permissions
My solution: Add a simple "scriptOnly" flag to CustomCommand definitions.
{ name: "my:calc", description: "Calculate anything", scriptOnly: true }
When true, the game engine skips parsing entirely and passes the raw command string to your script. You parse it however you want.
Why this is safe:
-
Works exactly like /scriptevent and chatSend (already accept raw input)
-
Permission checks still run - only parsing is skipped
-
Developers already handle parsing for those other APIs
-
No new attack surface - the raw string path already exists
Benefits:
-
Commands work as players expect
-
No more parser workarounds
-
Consistent with existing raw-string APIs
-
Minimal engine change (just bypass a check)
This is a small, additive change that fixes a major pain point for script developers. Please consider adding it to the next API update.
Please sign in to leave a comment.
0 Comments