Parsing Full Scripts
Overview
Section titled “Overview”The classic eval effect only handles statements — effects and conditions, the kind of code you find inside a trigger. It cannot understand structural lines like on join:, command /hello: or function greet():.
The parse script effect lifts that limitation. It runs the complete Skript loading pipeline — exactly like Skript does when it loads a .sk file — so it can parse and validate whole scripts, including:
- Events (
on join:,on death:, …) - Commands (
command /hello:) - Functions (
function greet(p: player):) - Options, and every other script structure
Each error and warning is returned as a structured parse entry carrying its line number, level and message — ideal for building linters, code editors or validation systems.
eval vs parse script
Section titled “eval vs parse script”eval | parse script | |
|---|---|---|
| Handles statements (effects/conditions) | ✅ | ✅ |
| Handles events, commands, functions | ❌ | ✅ |
| Error output | plain text | structured parse entries (line, level, message) |
| Added in | 1.0 | 1.3.0 |
Syntax Pattern
Section titled “Syntax Pattern”parse [without loading] [the] script %string% [and store [the] (error|result|entries) in %-objects%]Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
%string% | String | Yes | The complete Skript code to parse |
without loading | Flag | No | Validate only — do not register or run anything |
%-objects% | List | No | Variable to store the resulting parse entries |
Loading Modes
Section titled “Loading Modes”The effect has two modes, controlled by the optional without loading flag.
parse without loading the script {_code} and store the errors in {_errors::*}The script is fully parsed to collect every error and warning, then immediately unloaded. Nothing is registered, executed or kept active — no event listeners, no commands, no functions. This is the safe choice for validating untrusted or user-submitted code.
parse the script {_code} and store the errors in {_errors::*}Structures that parse successfully are kept active: events start listening, and commands and functions are registered on the server — as if the code were a real loaded script. Loaded scripts are automatically unloaded when ParseSK is disabled.
Reading Parse Entries
Section titled “Reading Parse Entries”The effect stores its result as a list of parse entries (the parse entry type). A parse entry
exposes four pieces of information through dedicated expressions:
parse line of %parse entry% # the line number (number), or -1 if unknownparse level of %parse entry% # "error" or "warning" (text)parse message of %parse entry% # the human-readable description (text)parse source code of %parse entry% # the offending source line (text)Printing a parse entry directly gives a ready-made summary, e.g. [error] line 3: Can't understand this effect: ....
| Expression | Returns | Description |
|---|---|---|
parse line of | Number | Line the entry refers to (-1 if unknown) |
parse level of | Text | "error" or "warning" |
parse message of | Text | The description of the problem |
parse source code of | Text | The source line that triggered the entry |
Usage Examples
Section titled “Usage Examples”Validate a Complete Script
Section titled “Validate a Complete Script”Check a full script — event header included — before doing anything with it:
command /checkscript: trigger: # A complete script, with an event, not just statements set {_lines::*} to "on join:" add " send ""Welcome!"" to player" to {_lines::*} add " set {joined::%player's uuid%} to now" to {_lines::*} set {_code} to join {_lines::*} with nl
parse without loading the script {_code} and store the errors in {_errors::*}
if {_errors::*} is not set: send "&aThe script is valid!" else: send "&cThe script has %size of {_errors::*}% problem(s)."Line-Aware Error Report
Section titled “Line-Aware Error Report”Use the parse entry expressions to build a precise, linter-style report:
parse without loading the script {_code} and store the errors in {_entries::*}
loop {_entries::*}: set {_entry} to loop-value if parse level of {_entry} is "error": send "&c✗ line %parse line of {_entry}%: %parse message of {_entry}%" send "&7 ┗ %parse source code of {_entry}%" else: send "&e⚠ line %parse line of {_entry}%: %parse message of {_entry}%"Load a Script at Runtime
Section titled “Load a Script at Runtime”Without the without loading flag, the script is registered for real:
command /deploy <text>: permission: admin.deploy trigger: set {_code} to {scripts::%arg-1%}
# Validate first... parse without loading the script {_code} and store the errors in {_errors::*} if {_errors::*} is set: send "&cDeployment aborted — the script has errors." stop
# ...then load it for real (events, commands and functions become active) parse the script {_code} send "&aScript '%arg-1%' deployed and active!"Code Validator (Discord)
Section titled “Code Validator (Discord)”A Discord command that validates whole scripts and reports each problem with its line:
discord command validate <text>: prefixes: ! trigger: parse without loading the script arg-1 and store the errors in {_entries::*}
if {_entries::*} is not set: make embed: set title of embed to "✅ Valid Script" set description of embed to "No errors or warnings found!" set color of embed to green reply with last embed stop
set {_report::*} to "" loop {_entries::*}: add "[%parse level of loop-value%] line %parse line of loop-value%: %parse message of loop-value%" to {_report::*}
make embed: set title of embed to "❌ Script Problems" set description of embed to "```%nl%%join {_report::*} with nl%%nl%```" set color of embed to red reply with last embedImportant Notes
Section titled “Important Notes”Reference
Section titled “Reference”Effect
Section titled “Effect”parse [without loading] [the] script %string% [and store [the] (error|result|entries) in %-objects%]Expressions
Section titled “Expressions”parse line of %parse entries%parse level of %parse entries%parse message of %parse entries%parse source code of %parse entries%parse entry — a single error or warning produced by the parse script effect.
Support
Section titled “Support”Need help with ParseSK?
- DiSky Discord Server
- Patreon Page
- HTTP Parse Server — validate scripts from outside the game