github SkriptLang/Skript 2.14.1
Patch Release 2.14.1

3 hours ago

Skript 2.14.1

Supports: Paper 1.21.0 - 1.21.11

Today, we are releasing Skript 2.14.1 to resolve some of the issues found with Skript 2.14, and a significant number of older bugs too!

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

Happy Skripting!

Changelog

Additions

  • #8400 Adds the ability to suppress the warning when using a single ':' in a variable name.
  • #8407 Allows setting the item of an arrow projectile, which can change the item picked up when retrieving the arrow and can change the applied potion effects if the arrow is not a spectral arrow.

Bug Fixes

  • #8375 Fixes the function argument error displaying a 'null' value for the parameter name.
  • #8381 Fixes an issue where display name of <entity> returned the incorrect value.
  • #8382 Fixes an issue where apostrophes (') could not be used in literal specification (e.g. dragon's breath (damage cause)).
  • #8384 Refactors the open inventory effect to use Paper's Menu API, which fixes issues with anvils and smithing tables not functioning correctly.
  • #8390 Fixes an issue where the documentation for the 'any of' expression is missing version information.
  • #8395 Fixes issues where some expression sections would be erroneously parsed as sections when they clearly should not be.
  • #8401 Fixes an issue where using past/future world of x expressions wasn't returning the correct world in some scenarios.
  • #8403 Fixes an issue where parsing a region in a world where region data isn't loaded yet/is disabled would cause an exception.
  • #8404 Fixes incorrect example for the particle with speed expression.
  • #8405 Prevents the 'variables cannot be used here' warning from being used when it is not relevant.
  • #8408 Fixes an issue where function calls would not call the most recent version of a function.
  • #8416 Fixes an unintentional block on using x of y when both inputs were literal: 5 of flame particles.

API Fixes

  • #8392 Fixes an issues where the Expression and Structure syntax infos would incorrectly produce warnings about being internal.
  • #8394 Fixes an issue where test servers on GitHub Actions would randomly crash during shutdown.
  • #8399 Fixes an issue with comparing version strings that include postfixes like 'nightly' or 'pre1'.

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

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.

Click to reveal the experiments available in this release

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.

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

broadcast the first element of {queue}
# "hello" is now removed

broadcast the first element of {queue}
# "world" is now removed

# queue is empty
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}
# players 1 and 2 are guaranteed to be distinct

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:

set {_a} to 5
set {_b} to "some string"
... do stuff ...
set {_c} to {_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:

{_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.

catch runtime errors:
    ...
    set worldborder center of {_border} to {_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:

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:

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 {_item} to {_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

set the equipment slot of {_item} to helmet slot
    
set {_component} to the equippable component of {_item}
allow {_component} to swap equipment

For more details about the syntax, visit equippable component on our documentation website.

New Documentation Site

Over the past few months, we have been working hard to build our new documentation site. Not only do we have a new-and-improved syntaxes page, we are also finally launching a proper platform for official tutorials on using Skript, from writing scripts to building addons.

While this site is still under heavy development, the beta is available for viewing at https://beta-docs.skriptlang.org.

Join us on Discord

We have an official Discord community where we share announcements and and perform testing for upcoming features.

Thank You

Special thanks to the contributors whose work was included in this version:

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.

Don't miss a new Skript release

NewReleases is sending notifications on new releases.