Skript

Skript Skript 2.16.2

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the community!

    Now, what are you waiting for? Join the community now!

Skript 2.13.0-pre1

Hi all, we've got a new feature pre-release for you all. Thankfully, this one's a bit more reasonable in size than the massive releases of 2.10, 2.11, and 2.12. We have some great features and a bunch of behind-the-scenes API improvements for you this go around. Addon developers should pay special attention to the Type Properties section below.

Please also note our changes to the supported versions. 2.13 is 1.20.4+, and Paper only.

Below, you can familiarize yourself with the changes. Additionally, by clicking here, you can view the list of new syntax on our documentation site. As always, report any issues to our issues page!

Per our release model, we plan to release 2.13.0 on October 15th. We may release additional pre-releases before then should the need arise.

Happy Skripting!

Changes to Supported Versions and Platforms

As announced with 2.12, we have updated our policy for supported versions. Going forward, Skript will guarantee support for the last 18 months of Minecraft releases. This means 2.13 is 1.20.4+, while 2.14 will be 1.21+.

Additionally, with Paper forking itself from Spigot, it has become increasingly difficult to support both platforms. As a result, this version of Skript is dropping support for Spigot. Skript now requires Paper or a downstream fork of Paper, such as Purpur or Pufferfish.

Major Changes
- #7194 Adds support for equippable components and all correlating data. Smurfy put in a lot of work into the backing API for components, so look forward to a lot more component support in the next few releases!
Code:
set the allowed entities of {_item} to a zombie and a skeleton
make {_item} lose durability when hurt
if {_item} can be dispensed:
	add "Dispensable" to lore of {_item}
- #7464 Adds a structure that allows a script to be automatically reloaded when it is saved, if async loading is enabled in config.sk:
Code:
automatically reload this script:
    recipients: "Sahvde" # The names or uuids of players who, apart from console, will see the success/error messages in chat.
OR
auto reload:
    permission: myserver.see[i]auto[/i]reloads # all players with this permission will see the messages.
- #8165 Adds Type Property API. See below.
- #8207 Adds a debug info expression that prints out extra information about a value. Currently this consists of the value itself and its class, though this is subject to expansion in the future!
Code:
set {my_list::*} to 1, "2", and vector(1, 2, 3)
broadcast debug info of {my_list::*}
[SIZE=7]prints:[/SIZE]
[SIZE=7]1 (integer)[/SIZE]
[SIZE=7]"2" (text)[/SIZE]
[SIZE=7]x: 1, y: 2, z: 3 (vector)[/SIZE]

Type Properties (For Addon Devs)

Included in 2.13 is an experimental opt-in API for what we're tenatively calling 'type properties'. These are a way for addons to be able to use the same generic name of x or x contains y syntaxes that Skript does without causing syntax conflicts. You can register your type (ClassInfo) as having a property, such as Property#NAME for name of x, and Skript will automatically allow it to be used in the name of expression. For more details on how to do this and what else you can do with type properties, see the PR. We plan on making a more comprehensive API spec/tutorial once the implementation is solidified, but for now the PR description should be more than sufficient to try it out.

However, since this is still experimental and not well tested, it requires a secret config option to enable. To activate property syntaxes, add the line use type properties: true somewhere in your config.sk. Without it, Skript will still use the old syntaxes for things like name of. We hope you try out this new API and give us feedback on what works, what doesn't, and what you'd like to see for its full release in 2.14. The number of property-driven syntaxes is rather small, but we plan on adding many more in the coming months!

⚠ Breaking Changes
- #7985 Changes the method signature for the abstract EntityData#init. Adds parameter matchedCodeName and refactors matchedPattern.
- #8072 Enforces using physics instead of physic in the block update effect.

Changelog

Additions
- #7194 Adds support for equippable components and all correlating data.
- #7275 Adds elements for brewing stands such as brewing stand slots, fuel, time, and events.
- #7464 Adds a structure that allows a script to be automatically reloaded when it is saved, if async loading is enabled in config.sk.
- #7888 Adds an expression to get the midpoint between two locations or vectors.
- #7985 Adds a condition to check if an entity is spawnable in a world.
- #8008 Adds literals for the maximum and minimum numerical values, such as longs, doubles, or ints.
- #8101 Adds an expression to get and modify the players listed in the tab menu for a given player.
- #8113 Adds the ability to enchant an item at as a specific level, as if an enchanting table was used.
- #8134 Adds an expression to get the duration an entity has been alive for.
- #8207 Adds a debug info expression that prints out extra information about a value. Currently this consists of the value itself and its class, though this is subject to expansion in the future!

Changes
- #7797 Uses project.testEnv in build.gradle instead of updating the latest version for both.
- #7878 Allows specifying the amount of damage in the force entity to attack entity effect.
- #8072 Enforces using physics instead of physic in the block update effect.
- #8092 Allows using vehicle alone in the mount event.
- #8196 Adds a runtime error when attempting to get the distance between locations in different worlds.
- #8197 Adds support for changing the event-location for on portal.
- #8206 Adds a runtime error when using the sort effect and mapping the input to a null value, which cannot be sorted.

Bug Fixes
- #7985 Fixes being unable to spawn certain entities in certain states, such as red fox and snow fox.
- #8064 Fixes an issue where it was not possible to spawn a minecart.
- #8177 Fixes the 'cannot reset' and 'cannot delete' error messages being swapped around.
- #8182 Fixes the order of which queued variable changes are processed.
- #8185 Fixes at %time% [in] real time by triggering the code on the main thread.
- #8189 Fixes functions with 0 required parameters.
- #8195 Fixes an issue where the runtime error catching section would not catch errors after the default error limit is reached.
- #8199 Fixes issues with expression sections not claiming sections when used as function parameters.

API Changes
- #7985 Changes Pattern to allow providing null as the object for generic usage.
- #8011 Exposes the script loader executor via the Task api.
- #8035 Adds support for using an EntryData multiple times.
- #8065 Adds support for custom operators.
- #8116 Makes JSONGenerator available for addons and updates the docs.json format.
- #8120 Adds a method to get a Color as an ARGB integer.
- #8138 Adds getting pattern combinations from PatternElement and tests to catch possible pattern conflicts.
- #8150 Adds SimplifiedCondition for constant conditions. Condition implements Simplifiable.
- #8165 Adds the Type Property API.
- #8180 Changes the parameter name for Expression class from expressionType to expressionClass in Skript#registerExpression.
- #8195 Improves runtime error filtering with the introduction of RuntimeErrorFilter, which allows different consumers to apply different levels of filtering to the errors they print.
- #8201 Adds support for excluding packages from being loaded in ClassLoader.
- #8211 Improves the classes ExpressionList returns for acceptChange to more accurately reflect the changers of the expressions within the list.
- #8213 Fixes Functions#getJavaFunctions to only return JavaFunctions.

[Click here to view the full list of commits made since 2.12.2](<https://github.com/SkriptLang/Skript/compare/2.12.2...2.13.0-pre1>)

Notices

Experimental Features
Experimental features can be used to enable syntax and other behavior on a per-script basis. Some of these features are new proposals that we are testing while others may have unsafe or complex elements that regular users may not need.

While we have tested the available experiments to the best of our ability, they are they are still in development. As a result, they are subject to change and may contain bugs. Experiments should be used at your own discretion.

Additionally, example scripts demonstrating usage of the available experiments can be found here.

<details>
<summary>Click to reveal the experiments available in this release</summary>

For-Each Loop

Enable by adding using for loops to your script.

A new kind of loop syntax that stores the loop index and value in variables for convenience.

This can be used to avoid confusion when nesting multiple loops inside each other.

Code:
for {[i]index}, {[/i]value} in {my list::*}:
    broadcast "%{[i]index}%: %{[/i]value}%"

Code:
for each {_player} in all players:
    send "Hello %{[i]player}%!" to {[/i]player}

All existing loop features are also available in this section.

Queue

Enable by adding using queues to your script.

A collection that removes elements whenever they are requested.

This is useful for processing tasks or keeping track of things that need to happen only once.

Code:
set {queue} to a new queue of "hello" and "world"

broadcast the first element of {queue}
[SIZE=7]"hello" is now removed[/SIZE]

broadcast the first element of {queue}
[SIZE=7]"world" is now removed[/SIZE]

[SIZE=7]queue is empty[/SIZE]

Code:
set {queue} to a new queue of all players

set {player 1} to a random element out of {queue} 
set {player 2} to a random element out of {queue}
[SIZE=7]players 1 and 2 are guaranteed to be distinct[/SIZE]

Queues can be looped over like a regular list.

Script Reflection

Enable by adding using script reflection to your script.

This feature includes:
- The ability to reference a script in code.
- Finding and running functions by name.
- Reading configuration files and values.

Local Variable Type Hints

Enable by adding using type hints to your script.

Local variable type hints enable Skript to understand what kind of values your local variables will hold at parse time. Consider the following example:
Code:
set {_a} to 5
set {_b} to "some string"
... do stuff ...
set {[i]c} to {[/i]a} in lowercase # oops i used the wrong variable
Previously, the code above would parse without issue. However, Skript now understands that when it is used, {_a} could only be a number (and not a text). Thus, the code above would now error with a message about mismatched types.

Please note that this feature is currently only supported by simple local variables. A simple local variable is one whose name does not contain any expressions:
Code:
{_var} # can use type hints
{_var::%player's name%} # can't use type hints

Runtime Error Catching

Enable by adding using error catching to your script.

A new catch [run[ ]time] error[s] section allows you to catch and suppress runtime errors within it and access them later with [the] last caught [run[ ]time] errors.
Code:
catch runtime errors:
    ...
    set worldborder center of {[i]border} to {[/i]my unsafe location}
    ...
if last caught runtime errors contains "Your location can't have a NaN value as one of its components":
    set worldborder center of {_border} to location(0, 0, 0)

Damage Sources

Enable by adding using damage sources to your script.

Note that type has been removed as an option for the 'damage cause' expression as damage cause and damage type now refer to different things.

Damage sources are a more advanced and detailed version of damage causes. Damage sources include information such as the type of damage, the location where the damage originated from, the entity that directly caused the damage, and more.

Below is an example of what damaging using custom damage sources looks like:
Code:
damage all players by 5 using a custom damage source:
	set the damage type to magic
	set the causing entity to {_player}
	set the direct entity to {_arrow}
	set the damage location to location(0, 0, 10)

For more details about the syntax, visit damage source on our documentation website.

Equippable Components

Enable by adding using equippable components to your script.

Equippable components allows retrieving and changing the data of an item in the usage as equipment/armor.

Below is an example of creating a blank equippable component, modifying it, and applying it to an item:
Code:
set {_component} to a blank equippable component:
	set the camera overlay to "custom_overlay"
	set the allowed entities to a zombie and a skeleton
	set the equip sound to "block.note_block.pling"
	set the equipped model id to "custom_model"
	set the shear sound to "ui.toast.in"
	set the equipment slot to chest slot
	allow event-equippable component to be damage when hurt
	allow event-equippable component to be dispensed
	allow event-equippable component to be equipped onto entities
	allow event-equippable component to be sheared off
	allow event-equippable component to swap equipment
set the equippable component of {[i]item} to {[/i]component}

Changes can be made directly on to the existing equippable component of an item whether using the item itself or the retrieved equippable component
Code:
set the equipment slot of {_item} to helmet slot
    
set {[i]component} to the equippable component of {[/i]item}
allow {_component} to swap equipment

For more details about the syntax, visit damage source on our documentation website.
</details>

Help Us Test
We have an official Discord community for beta testing Skript's new features and releases.

Thank You

Special thanks to the contributors whose work was included in this version:
- @Absolutionism
- @APickledWalrus
- @Chrissblock99 ⭐ First contribution! ⭐
- @Efnilite
- @erenkarakal
- @MrScopes ⭐ First contribution! ⭐
- @Pesekjak
- @sovdeeth
- @TheLimeGlass

As always, if you encounter any issues or have some minor suggestions, please report them at https://github.com/SkriptLang/Skript/issues.
If you have any bigger ideas or input for the future of Skript, you can share those too at https://github.com/SkriptLang/Skript/discussions.

Skript 2.12.2​


Today, we are releasing Skript 2.12.2 to continue resolving issues reported with 2.12.

We want to thank the contributors that made this release possible. Your work plays a crucial role in making Skript better, and we are immensely appreciative of the time and effort put into all contributions.

You can report any issues at https://github.com/SkriptLang/Skript/issues.

As always, be sure to read the changelog for full details.

Happy Skripting!
https://github.com/SkriptLang/Skript/releases/tag/2.12.2
Skript 2.12.1

Today, we are releasing Skript 2.12.1 to resolve some of the most common issues reported with Skript 2.12.0. This release includes support for Minecraft 1.21.8.

As always, you can report any issues on our issue tracker.

For the full changelog, please view our GitHub release page.

Happy Skripting!
Skript 2.11.2

As we prepare for Skript 2.12 in July, Skript 2.11.2 is here to resolve some additional bugs.

As always, you can report any issues on our issue tracker.

For the full changelog, please visit our GitHub release page.

Happy Skripting!
Skript 2.11.1

What better than a new Skript release to celebrate the beginning of May? Today, we are releasing Skript 2.11.1 which brings with it a handful of bug fixes.

As always, you can report any issues on our issue tracker.

For the full changelog, please visit our GitHub release page.

Happy Skripting!
We apologize for the delayed post. The full changelog is available at https://github.com/SkriptLang/Skript/releases/tag/2.11.0
Skript 2.10.1

Skript 2.10.1 is here to address some of the most prominent issues reported with 2.10.0.

As always, you can report any issues on our issue tracker.

Happy Skripting!

Breaking Changes
There have been a few minor breaking changes:
- When using "send" in the 'connect' effect, "server" is now a required keyword.
- Removed the pattern "[a] %\*color% %bannerpatterntype%"

Changelog

Bug Fixes

- #7450 Fixes an issue where tag lookups for the 'tag' expression would not check all possible tag sources.
- #7455 Fixes an issue with the experimental queue serialization.
- #7474 Fixes an issue where using 'or' in the 'is tagged' condition would not check against all tags.
- #7503 Fixes an issue where getting or changing the name of a block did not work.
- #7519 Fixes a syntax conflict between the 'send' effect and the 'connect' effect.
- #7521 Fixes multiple issues with 'fishing' documentation.
- #7525 Fixes an issue where the 'wearing' condition could check invalid slots, resulting in an exception.
- #7527 Fixes an issue where checking whether something is tagged as a different type (e.g. check if an entity is tagged as a type of item) would result in an exception.
- #7528 Fixes an issue where loot tables could not be serialized.
- #7537 Fixes an issue where the 'for each' loop did not fully iterate over the elements.
- #7540 Fixes an issue where some language entries could mistakenly be associated with non-Minecraft additions (e.g. custom biomes).
- #7546 Removes the pattern "[a] %\*color% %bannerpatterntype%" which caused significant parsing slowdowns in some Skript environments.
- #7557 Fixes an issue where the tests could fail if a locale other than English was used.
- #7559 Fixes an issue where some syntaxes contained "the" multiple times at the beginning.
- #7570 Fixes an issue where date variables from older versions would fail to load on 2.10.0.

API Changes
- #7526 Added support for regex-based highlighting for runtime errors.

Click here to view the full list of commits made since 2.10.0

Notices

Help Us Test

We have an official Discord community for beta testing Skript's new features and releases.

Thank You
Special thanks to the contributors whose work was included in this version:
- @APickledWalrus
- @Burbulinis
- @erenkarakal
- @Fusezion
- @Moderocky
- @Phill310
- @ShaneBeee
- @sovdeeth
- @TheAbsolutionism
- @UnderscoreTud

As always, if you encounter any issues or have some minor suggestions, please report them at https://github.com/SkriptLang/Skript/issues.
If you have any bigger ideas or input for the future of Skript, you can share those too at https://github.com/SkriptLang/Skript/discussions.
Skript 2.10.0

We are excited to share that Skript 2.10.0 is now available! It is one of our largest updates, with more than 150 new features, bug fixes, and API updates to play around with!

Below, you can familiarize yourself with the changes. Additionally, by clicking here, you can view the list of new syntax on our documentation site. As always, report any issues to our issues page!

Per our release model, we plan to release 2.10.1 on February 1st to address any immediate issues that are spotted with this release. Should it be necessary, an emergency patch release may come before then.

For the full changelog, please visit our GitHub Release Page: https://github.com/skriptlang/skript/releases/tag/2.10.0

Happy Skripting!
Skript 2.9.5

Skript 2.9.5 is here with a handful of new bug fixes. As always, you can report any issues on our issue tracker.

Happy Skripting!

Changelog

Tweaks

- #7232 Improved the documentation of the 'projectile hit' event to be up to date with the 'victim' syntax.

Bug Fixes
- #7062 Fixed an error that would occur when attempting to place blocks between two points above the world limit.
- #7120 Fixed an issue where various expressions (enchant effect, replace effect, vector expressions, etc.) would overwrite the indices of list variables used.
- #7152 Fixed an issue where player skull textures would not immediately load on Paper (loading is now forced).
- #7188 Fixed an issue where plural event values did not work with 'past' and 'future' time states.
- #7195 Fixed a few Turkish language mistakes.
- #7199 Fixed multiple issues with playing sounds on 1.21.3+.
- #7202 Fixed an error that could occur when using invalid regular expression patterns in the split expression.
- #7210 Fixed long overflow when performing arithmetic.
- #7230 Fixed an issue that could occur when trying to grow new tree types (e.g. pale oak).

API Additions
- #7120 Added a new 'Expression#changeInPlace()' method for changing the elements of an expression without changing the entire object. For example, this allows the values of a list variable to be updated while preserving the indices.
- #7207 Updated the 'Arithmetics#exactOperationExists' and 'Arithmetics#exactDifferenceExists' methods to be public. They act as a safe way to check arithmetic operation existence during the registration period.

Click here to view the full list of commits made since 2.9.4

Notices

Help Us Test

We have an official Discord community for beta testing Skript's new features and releases.

Thank You
Special thanks to the contributors whose work was included in this version:
- @Asleeepp
- @erenkarakal
- @ShaneBeee
- @sovdeeth
- @TheAbsolutionism
- @UnderscoreTud

As always, if you encounter any issues or have some minor suggestions, please report them at https://github.com/SkriptLang/Skript/issues.
If you have any bigger ideas or input for the future of Skript, you can share those too at https://github.com/SkriptLang/Skript/discussions.
Skript 2.9.4

Skript 2.9.4 is here with even more bug fixes and early support for Minecraft 1.21.3. As always, you can report any issues on our issue tracker.

Happy Skripting!

Changelog

Bug Fixes

- #7141 Fixes leather horse armor being unequipable.
- #7143 Fixed entries being case-sensitive, preventing using capital letters in entries like 'Usage: ' for commands.

Additions
- #7163/#7176 Added early support for Minecraft 1.21.3 features
This includes: Pale Garden biome, creaking entity, baby squid entity, baby glow squid entity, baby dolphin entity

Click here to view the full list of commits made since 2.9.3

Notices

Help Us Test

We have an official Discord community for beta testing Skript's new features and releases.

Thank You
Special thanks to the contributors whose work was included in this version:
- @Efnilite
- @erenkarakal
- @sovdeeth

As always, if you encounter any issues or have some minor suggestions, please report them at https://github.com/SkriptLang/Skript/issues.
If you have any bigger ideas or input for the future of Skript, you can share those too at https://github.com/SkriptLang/Skript/discussions.