github SkriptLang/Skript 2.12.1
Patch Release 2.12.1

latest release: 2.12.2
one month ago

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.

Happy Skripting!

Changelog

Additions / Changes

  • #8009 Adds launch as an alternative keyword for the 'shoot' event.
  • #8010 Adds support for checking whether an entity has any potion effects using the 'has potion' condition.
  • #8054 Adds support for Minecraft 1.21.8
  • #8076 Further tweaks the default syntax ordering to improve performance and error messages.

Bug Fixes

  • #8043 Fixes being able to wait for an indefinite amount of time.
  • #8046 Fixes an issue where attempting to register overloaded functions with an argument type of one function being convertable to an argument type of another failed.
  • #8068 Fixes an issue where literal specification could be too eager and fail with function parameters.
  • #8069 Fixes an issue where looping over all item types could result in an error on newer versions.
  • #8071 Fixes an issue where valid arguments for a single list parameter function sometimes failed to resolve to that function.
  • #8081 Fixes an issue where seemingly non-literal inputs for the 'x of item/entity type' expression caused the syntax to fail to parse.
  • #8082 Fixes an issue where valid statements including a section expression could fail to parse.
  • #8086 Fixes an issue where harnesses could not be equipped onto happy ghasts.
  • #8087 Fixes edge-case errors that could occur from rounding.
  • #8088 Fixes a few minor typographical errors in the configuration.
  • #8089 Fixes an issue where default expressions could fail to be used.
  • #8090 Fixes an issue where the 'loop value' expression was too accepting of loop-X inputs for specific types.
  • #8096 Fixes an issue where single list parameter functions were always chosen over functions with a specific number of parameters of the same type.

API/Development

  • #8000 Improves the testing assertion output for the 'contains' condition.
  • #8066 Fixes an issue where the project's checkstyle configuration incorrectly treated tab width.

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

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

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.

for {_index}, {_value} in {my list::*}:
    broadcast "%{_index}%: %{_value}%"
for each {_player} in all players:
    send "Hello %{_player}%!" to {_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.

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.

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.